This file contains 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 | |
/** | |
* Testing out WP 6.7 Block Bindings stuff. | |
* | |
* @see Block Bindings iteration for WordPress 6.7 #63018 | |
* @link https://github.com/WordPress/gutenberg/issues/63018 | |
* | |
* @package demo-plugin | |
*/ |
This file contains 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
{ | |
"name": "acf/car-details-condensed", | |
"title": "Car Details condensed (ACF Block)", | |
"description": "Display car details in a query loop.", | |
"category": "demo-acf-blocks", | |
"icon": "car", | |
"acf": { | |
"mode": "preview", | |
"renderTemplate": "template.php" | |
}, |
This file contains 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
<!-- wp:group {"tagName":"section","metadata":{"name":"Cards","categories":["text","about"],"patternName":"twentytwentyfour/cards-4"},"align":"wide","style":{"spacing":{"margin":{"top":"var:preset|spacing|30"}}},"layout":{"type":"grid","columnCount":null,"minimumColumnWidth":"16rem"}} --> | |
<section class="wp-block-group alignwide" style="margin-top:var(--wp--preset--spacing--30)"><!-- wp:cover {"url":"https://images.rawpixel.com/editor_1024/czNmcy1wcml2YXRlL3Jhd3BpeGVsX2ltYWdlcy93ZWJzaXRlX2NvbnRlbnQvbHIvcHgxMDg2NTYxLWltYWdlLWt3dnk1Y2l1LmpwZw.jpg","dimRatio":70,"customOverlayColor":"#515151","isUserOverlayColor":true,"tagName":"article","metadata":{"name":"Card"},"className":"is-style-card\u002d\u002danimated-default","style":{"border":{"radius":"12px"},"color":[]},"layout":{"type":"default"}} --> | |
<article class="wp-block-cover is-style-card--animated-default" style="border-radius:12px"><span aria-hidden="true" class="wp-block-cover__background has-background-dim-70 has-background-dim" style="background-color:# |
This file contains 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
<!-- CURRENT block markup --> | |
<div class="wp-block-group cards"> | |
<div class="wp-block-cover"> | |
</div><!-- .wp-block-cover --> | |
</div><!-- .wp-block-group --> | |
<!-- DESIRED block markup --> | |
<ul class="wp-block-group cards"> | |
<li class="wp-block-cover card"></li> |
This file contains 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
{ | |
"$schema": "https://schemas.wp.org/trunk/theme.json", | |
"version": 3, | |
"title": "Mock", | |
"blockTypes": [ "core/paragraph" ], | |
"styles": { | |
"color": { | |
"background": "#93008A", | |
"text": "#FFFB20" | |
}, |
This file contains 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
add_action( 'acf/include_fields', function() { | |
if ( ! function_exists( 'acf_add_local_field_group' ) ) { | |
return; | |
} | |
acf_add_local_field_group( array( | |
'key' => 'group_662ae89971cc7', | |
'title' => 'Call to action', | |
'fields' => array( | |
array( |
This file contains 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
/** | |
* Enqueues custom block styles for the theme. | |
* | |
* This function scans the styles folder in the theme to locate block styles. | |
* It then enqueues each block style using the `wp_enqueue_block_style` function. | |
* | |
* @url https://developer.wordpress.org/reference/functions/wp_enqueue_block_style/ | |
*/ | |
function devrel_enqueue_custom_block_styles() { |
This file contains 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 | |
$my_link = get_field( 'my_link' ); | |
if ( $my_link ) { | |
$link_url = ! empty( $my_link['url'] ) ? $my_link['url'] : 'https://google.com'; | |
$link_title = ! empty( $my_link['title'] ) ? $my_link['title'] : 'Your quote here...'; | |
$link_target = $my_link['target'] ? $my_link['target'] : '_self'; | |
} | |
?> | |
<a href="<?php echo esc_url( $link_url ); ?>" target="<?php echo esc_attr( $link_target ); ?>"><?php echo esc_html( $link_title ); ?></a> |
This file contains 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
function enqueue_my_awesome_script_if_there_is_block( $content = '' ) { | |
if ( has_block( 'core/list' ) ) { | |
wp_enqueue_script( | |
'my-awesome-script', | |
plugins_url( 'hello-world.js', __FILE__ ), | |
array(), | |
'0.1.1', | |
true | |
); | |
} |
This file contains 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 | |
/** | |
* Limit capabilities of editing ACF fields, | |
* post types, taxonomies and more in WP Admin. | |
*/ | |
/** | |
* @link https://www.advancedcustomfields.com/resources/how-to-hide-acf-menu-from-clients/ | |
*/ | |
add_filter( 'acf/settings/show_admin', 'demo_acf_show_admin' ); |
NewerOlder