Skip to content

Instantly share code, notes, and snippets.

View gjportegies's full-sized avatar

Guus gjportegies

  • Amsterdam
View GitHub Profile
@gjportegies
gjportegies / wp-seo-tweaks.php
Created February 16, 2026 15:39 — forked from theJasonJones/wp-seo-tweaks.php
Had to a few tweaks to the WP-SEO breadcrumbs. This is what I did.
<?php
// Remove the last link in breadcrumbs
// WHY? Because it an span tag that contains the title of the page
// But you're already on the page, so what's the point?
add_filter( 'wpseo_breadcrumb_links', 'jj_wpseo_breadcrumb_links' );
function jj_wpseo_breadcrumb_links( $links ) {
//pk_print( sizeof($links) );
if( sizeof($links) > 1 ){
array_pop($links);
@gjportegies
gjportegies / magento-2-category-collection-cheatsheet.md
Created January 8, 2026 13:59 — forked from DominicWatts/magento-2-category-collection-cheatsheet.md
magento 2 : category collection cheatsheet #magento2

Category Collection Cheatsheet

Import statement

use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory;

/**
 * @var CategoryCollectionFactory
 */
@gjportegies
gjportegies / instructions.md
Created March 25, 2025 15:18 — forked from michielgerritsen/instructions.md
Find old Luma code so you can convert it to Hyvä Alpine.js code

Introduction

The goal of this script is to help you migrate you old Magento Luma code to Hyvä compliant code. Luma used to rely on Require.js to manage it's javascript components. Hyvä relies on Alpine.js for this. For a lot of modules there are already compatibility modules available. Custom code you have to convert yourself.

Usage

There are several ways to use this code:

  • Using Tampermonkey (Chrome) or Greasemonkey (Firefox). If you have that installed just click on "Raw" by the requirejs-finder.user.js file.
  • (Temporary) By injecting it into Magento's head. Open the admin and navigate to Content -> Design -> Click your theme -> HTML -> Head -> Add `` and place the code above between the two script tags.
@gjportegies
gjportegies / [WordPress] Automated setup with Bedrock, Sage and Valet
Created September 4, 2024 15:32 — forked from studiocaro/[WordPress] Automated setup with Bedrock, Sage and Valet
My workflow contains Bedrock, Sage and Valet from Laravel. The latter is something you'll have to install first, otherwise this script won't work!
#!/bin/sh
echo "🎉 👏 Congrats with the new project! 🎉 👏
I'm setting up your fresh WordPress install for you."
# Make new folder
printf "Enter folder name of your choice -> "
read FOLDER
mkdir $FOLDER
cd $FOLDER
@gjportegies
gjportegies / external-video.liquid
Created April 10, 2024 08:07 — forked from liamgriffin/external-video.liquid
Shopify theme section that displays an externally hosted video
<div class="video-section">
<h2>{{ section.settings.heading }}</h2>
{%- if section.settings.video_url.type == 'youtube' -%}
<iframe src="https://www.youtube.com/embed/{{ section.settings.video_url.id }}" class="youtube" allow="autoplay; encrypted-media" title="{{ section.settings.description | escape }}"></iframe>
{%- else -%}
<iframe src="https://player.vimeo.com/video/{{ section.settings.video_url.id }}" class="vimeo" allow="autoplay; encrypted-media" title="{{ section.settings.description | escape }}"></iframe>
{%- endif -%}
</div>
{% schema %}
@gjportegies
gjportegies / identify.php
Created July 10, 2023 14:47 — forked from peterjaap/identify.php
Identify used Magento 2 frontend extensions in a Luma install
<?php
// Run with the URL pointing to a require-config.js as the first argument;
// php identify.php http://magento2demo.firebearstudio.com/pub/static/frontend/Magento/luma/en_US/requirejs-config.js
$content = file_get_contents($argv[1]);
preg_match_all(
'/(?P<quote>\'|")(?P<extension>[[:alnum:]]+_[[:alnum:]]+)\/js\/.+?(?P=quote)/m',
$content,
$matches
@gjportegies
gjportegies / wc-show-cart-contents-total.php
Created March 16, 2021 08:06 — forked from woogists/wc-show-cart-contents-total.php
[Theming Snippets] Show cart contents / total
// Use in conjunction with https://gist.github.com/woogists/c0a86397015b88f4ca722782a724ff6c
<a class="cart-customlocation" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf ( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
@gjportegies
gjportegies / wc-show-cart-contents-total-ajax.php
Created March 16, 2021 08:06 — forked from woogists/wc-show-cart-contents-total-ajax.php
[Theming Snippets] Show cart contents / total Ajax
/**
* Show cart contents / total Ajax
*/
add_filter( 'woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment' );
function woocommerce_header_add_to_cart_fragment( $fragments ) {
global $woocommerce;
ob_start();
@gjportegies
gjportegies / EmailValidation.php
Created February 3, 2021 09:11 — forked from gwleuverink/EmailValidation.php
Experiment loading livewire component from gist
public $email;
public function updated($name)
{
$this->validateOnly($name, [
'email' => 'required|email',
]);
}