This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add custom HTML tag(s) to GenerateBlocks Loop Item | |
* @link https://generate.support/topic/gb-headline-dynamic-data-open-in-new-tab-not-workin/#post-165999 | |
*/ | |
add_filter('block_type_metadata', function($metadata) { | |
if (isset($metadata['name']) && $metadata['name'] === 'generateblocks/element') { | |
$metadata['attributes']['tagName']['enum'] = array_merge( | |
$metadata['attributes']['tagName']['enum'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* I'm using this with my GeneratePress child theme. Add to functions.php. | |
* @see https://youtu.be/xQMCRfICp7E | |
*/ | |
/** | |
* Enqueue simple lightbox assets by default | |
* @link https://wordpress.org/plugins/gallery-block-lightbox/ | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ACF Block PHP for custom blocks where a post object field selects post for output. | |
* Custom hook name for use with GenerateBlocks elements. | |
* | |
* @link https://www.advancedcustomfields.com/resources/create-your-first-acf-block/ | |
* @see https://youtu.be/TZsVq-jd0Ao | |
*/ | |
// don't access this file directly! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Content security policy with nonces. Doesn't work great with caching. | |
* | |
* Do some security stuff to harden WordPress. | |
* Must be included in functions.php | |
* | |
* @package GenerateChild | |
* @see https://content-security-policy.com/ Reference guide for content security policies | |
* @see https://csp-evaluator.withgoogle.com/ Test with Google's CSP Evaluator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Parse query string parameters. | |
* @example [ahd_parse_query_string param="parameter_name"] | |
*/ | |
function ahd_parse_query_string_func( $atts ) { | |
// get shortcode attributes | |
$atts = shortcode_atts( array( | |
'param' => '', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"key": "group_675735fb4fdc1", | |
"title": "Resources Block", | |
"fields": [ | |
{ | |
"key": "field_675735fb56013", | |
"label": "Resources Block", | |
"name": "", | |
"aria-label": "", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
/** | |
* Activate swiper.js for testimonials | |
*/ | |
doHeroSlider(); | |
function doHeroSlider() { | |
// get hero slider element | |
const heroSlider = document.getElementById('heroSlider'); | |
// shut it down if slider isn't present |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'generate_page_hero_background_image_url', function( $url ) { | |
$headers = array( | |
esc_url(get_field('radnomizer_image_one')), | |
esc_url(get_field('radnomizer_image_two')), | |
esc_url(get_field('radnomizer_image_three')), | |
esc_url(get_field('radnomizer_image_four')), | |
esc_url(get_field('radnomizer_image_five')) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Output the post title. | |
* [gpc_post_title] | |
*/ | |
add_shortcode( 'gpc_post_title', 'gpc_post_title_func' ); | |
function gpc_post_title_func() { | |
return get_the_title(); | |
} |
NewerOlder