Skip to content

Instantly share code, notes, and snippets.

View Jehu's full-sized avatar

Marco Michely Jehu

View GitHub Profile
@Jehu
Jehu / etch-image-enhancement.php
Created September 19, 2025 16:00
EtchWP Image Enhancement for WordPress
<?php
/**
* Etch Image Enhancement for WordPress
*
* Enhances Etch page builder images by automatically adding missing attributes:
* - srcset (responsive image sources)
* - width & height (extracted from filename or metadata)
* - alt text (from attachment meta or title)
* - sizes (responsive sizing hints)
*
@Jehu
Jehu / image-bg-position-support.php
Last active September 21, 2025 11:54
Etch Page Builder Integration for Image Background Focus Position Plugin - https://www.wordpress-focalpoint.com
<?php
/**
* Etch Page Builder Integration for Image Background Focus Position Plugin
*
* This file provides compatibility between the Image Background Focus Position plugin
* and the Etch page builder. Add this code to your child theme's functions.php file.
*
* Requires: Image Background Focus Position plugin to be active: https://www.wordpress-focalpoint.com/
*
@Jehu
Jehu / ma-custom-fonts.php
Created September 8, 2025 14:45
Use MA Custom Fonts Script with EtchWP
/**
* 1) Download the Script from https://www.altmann.de/en/blog-en/code-snippet-custom-fonts/
* 2) Add this to line 395
*/
// Etch: Add custom fonts CSS to Etch Builder preview
add_filter('etch/preview/additional_stylesheets', function ($stylesheets) {
if ($this->css_output == 'file') {
$css_path = $this->fonts_base->dir . '/' . self::SLUG . '.css';
if (file_exists($css_path)) {
@Jehu
Jehu / splide-with-custom-pagination.js
Last active October 8, 2024 09:00
Splide with custom pagination that only shows that many dots
/**
* Show only MAX_DOTS in Splide Pagination.
*
* This code generates a custom pagination.
* Therefore you need to disable the Splide pagination with the option `pagination: false`.
* You can configure the number of visible pagination dots via MAX_DOTS.
* The active dot is moved from left to right and starts at the left if the end of
* MAX_DOTS is reached. So the user can see that there is something happen when using the Slider.
*/
@Jehu
Jehu / bicks-code-signing.php
Last active August 8, 2024 17:55
wp-cli Bricks Code Signing - save in mu-plugins folder
<?php
namespace Bricks;
class MWE_BRICKS_SIGN_CODE
{
public function __construct() {
if (defined('WP_CLI') && WP_CLI) {
// https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-add-command/
\WP_CLI::add_command('bricks', '\Bricks\MWE_BRICKS_SIGN_CODE');
}
@Jehu
Jehu / anker-active.js
Created June 4, 2024 08:49
Add CSS Class 'active' to navigation anker links
const updateActiveEl = (list) => {
if (!list) return;
var hash = window.location.hash;
if (!hash) {
let first = list.querySelector("a");
if (first) {
first.classList.add("active");
}
return;
}
@Jehu
Jehu / function.php
Last active September 13, 2023 14:10
WordPress: set category menu active on post single page
<?php
/**
* helper function to test if post is in subcategory
*/
if (!function_exists("mwe_is_in_subcategory")) {
function mwe_is_in_subcategory($categories, $_post = null)
{
foreach ((array) $categories as $category) {
$subcats = get_term_children((int) $category, "category");
@Jehu
Jehu / function.php
Created August 21, 2023 13:30
filter Bricks term query for custom taxonomy tag
<?php
// Include only terms where posts do have a term from custom 'hersteller' taxonomy
add_filter(
"bricks/terms/query_vars",
function ($query_vars, $settings, $element_id) {
if ($element_id !== "qaajzi") {
return $query_vars;
}
@Jehu
Jehu / function.php
Created August 9, 2023 08:36
Load ACSS in Gutenberg
<?php
// Load ACSS Gutenberg editor styles
function mwe_acss_gutenberg_styles() {
$url = site_url( '/wp-content/uploads/automatic-css/');
wp_enqueue_style( 'mwe-acss-gutenberg', $url . 'automatic-gutenberg-editor.css', false, '1.0', 'all' );
}
add_action( 'enqueue_block_editor_assets', 'mwe_acss_gutenberg_styles' );
@Jehu
Jehu / functions.php
Created December 13, 2022 12:22
SEOPress manual FAQ Schema + Metabox.io – Use related custom FAQ post type
/**
* FAQ Schema.org for MetaBox Relationship if manual FAQ Schema is active
*
* @See https://www.seopress.org/support/hooks/filter-manual-faq-schema/
*/
add_filter('seopress_pro_get_json_data_faq','sp_pro_schema_faq_json', 10, 2);
function sp_pro_schema_faq_json($json, $context)
{
$relationship_id = 'faq-page'; // Replace with your Relationship ID