Skip to content

Instantly share code, notes, and snippets.

@eudesgit
eudesgit / wp-plugin-gutenberg-block-render.php
Last active June 14, 2018 17:32
A render function for a WordPress Gutenberg block in PHP
<?php
/**
* CALLBACK
*
* Render callback for the dynamic block.
*
* Instead of rendering from the block's save(), this callback will render the front-end
*
* @since 1.0.0
* @param $att Attributes from the JS block
@eudesgit
eudesgit / wp-gutenberg-dynamic-block.js
Created April 3, 2018 18:33
Creates a simple editable WordPress Gutenberg block that is rendered on server side.
/**
* Simple dynamic block sample
*
* Creates a block that doesn't render the save side, because it's rendered on PHP
*/
// Required components
const { __ } = wp.i18n;
const { registerBlockType, RichText } = wp.blocks;
@eudesgit
eudesgit / wp-slider-revolution-accesibility-fixer.js
Created July 27, 2018 15:37
Script to make WordPress Slider Revolution Plugin slides more accessibile
/**
* Manipulates Slider Revolution HTML to make it more W3C compliant
*
* It's required to meet basic W3C accessibility standards.
* To make it work out, the following Slider Revolutions options have to be filled:
* - Slider title
* - Slider > Link & Seo > Enable Link = Enable
* - Slider > Link & Seo > Link Type = Regular
* - Slider > Slide Link > "The full page URL"
* - Slider > Slide info > A description with the same words from the slider image.
@eudesgit
eudesgit / wp-generate-custom-feed-rss.php
Last active August 16, 2023 09:08
How to generate custom RSS on WordPress
<?php
/**
* Generating your own custom RSS feed with custom URL and parameters
*/
/**
* Initialise RSS feed
* @see https://developer.wordpress.org/reference/functions/add_feed/
*/
function init_rss_feed_custom( ) {