May an attribute have no value?
May an attribute have no value?
May an attribute have no value?
Shortcode should return string ready to append to content. You can’t return an array, because it won’t be printed correctly. So if your shortcode should return an array, you have to figure out how this data should be formatted. One way to do it is to use commas to separate the values: return implode( ‘, … Read more
The easy way would be to create a Shortcode in the functions.php file of your theme and then use it in Gutenberg. Gutenberg has a built-in block to add shortcodes. Basically, you will add the following code to your functions.php file, function get_forum_post_information( $atts ) { // The PHP Code that you want to execute … Read more
Shortcode, vs blocks, vs templates – what would you do for choosing or creating custom post data in editor?
Modify shortcode so and are not used?
Simulate shortcodes with javascript
I believe you could use template_redirect to handle the redirect step: function my_page_template_redirect() { if ( !is_page( ‘overview’ ) && is_user_logged_in() ) { wp_redirect( home_url( ‘/thinkingmachines/overview/’ ) ); die; } } add_action( ‘template_redirect’, ‘my_page_template_redirect’ );
Try this: <?php function howitworks() { $page = get_page_by_title(‘shop’); $html=””; if (have_rows(‘steps’, $page->ID)) : $html .= ‘<div class=”test”>’; while (have_rows(‘steps’, $page->ID)) : the_row(); $image = get_sub_field(‘icon’); $html .= ‘<div class=”col”> <img src=”‘.$image[‘sizes’][‘thumbnail’].'” alt=”‘.$image[‘alt’].'” title=”‘.$image[‘alt’].'” /> <h2>’.get_sub_field(‘step’).'</h2> <p>’.get_sub_field(‘description’).'</p> </div>’; endwhile; $html .= ‘</div>’; endif; return $html; } add_shortcode(‘howitworks’, ‘howitworks’); ?> EDIT: I change up my code … Read more
Insert HTML in content property and render it using shortcodes
Use it like this, this defined(‘REST_REQUEST’) will help you to disable running on the backend gutenberg block editor function generate_new_member_form() { if(defined(‘REST_REQUEST’)) return; ob_start(); ?> // a form // to generate this form there is some code that uses objects or functions // only available in the front end <?php return ob_get_clean(); } add_shortcode(‘new-member-form’, ‘generate_new_member_form’);