How to apply an ID to Shortcode Embedded iframe

1.- Add this to your child theme’s functions file: add_filter(“embed_oembed_html”, function( $html, $url, $attr ) { if ( !empty( $attr[‘id’] ) ) { $html = str_replace( “<iframe”, sprintf( ‘<iframe id=”%s”‘, $attr[‘id’] ), $html ); } return $html; }, 10, 3); 2.- Now use ‘ ); Hope that helps.

Gravity forms – get shortcode attribute from post content

If you only have 1 shortcode in the post content, catch the id with this: <?php $text = get_the_content(); preg_match_all(“\bid=”([0-9]+)\b”, $text, $matches); var_dump($matches[0]); ?> In your example [gravityform description=”true” id=”23″ title=”true”], it would output: 23 However, if you use other shortcodes or simple text, in the same post, with that same structure id=123, you might … Read more

Create a custom taxonomy that will be used to create and filter markers in a Google Map

Here’s a fully working example to get you started. Register the “marker” taxonomy register_taxonomy( ‘marker’, ‘post’, array( ‘hierarchical’ => false, ‘update_count_callback’ => ‘_update_post_term_count’, ‘label’ => __( ‘Markers’, ‘textdomain’ ), ‘labels’ => array( ‘name’ => __( ‘Markers’, ‘textdomain’ ), ‘singular_name’ => __( ‘Marker’, ‘textdomain’ ), ‘menu_name’ => _x( ‘Markers’, ‘Admin menu name’, ‘textdomain’ ), ‘search_items’ => … Read more

How to pass variables to custom filter from multiple functions

I think from your code add_action( ‘wp_footer’, ‘purewpns_googlefont_loader’ ); Function purewpns_googlefont_loader maybe typo mistake. You use the action wp_footer and added empty array which obviously print empty array. Okay. You can use: googlefont_filter_callback( $font ); Except $fonts = apply_filters( ‘googlefont_loader’, $fonts ); In function googlefont_loader() And add filter in function googlefont_filter_callback like: function googlefont_filter_callback( $fonts=array() … Read more

Remove ‘p’ tags around shortcodes and ‘img’

First, what you are trying to do is an abuse of the shorcode system. You should not use them to replace html elements. That aside, the p comes from the content. You either need to use [div]….[/div] and than you will get the content as the second parameter to the shortcode function and you can … Read more

Create shortcode in WordPress, using one variable in 3 functions?

use function to call variable function give_value(){ $acfvalue = get_field( ‘short_title’ ); return $acfvalue; } function hprice(){ return ‘<h2>’. give_value() . ” Price list in India” .'</h2>’; } add_shortcode( ‘pprice’, ‘hprice’ ); function hspecs(){ return ‘<h2>’. give_value() . ” Full Specification” . ‘</h2>’; } add_shortcode( ‘pspecs’, ‘hspecs’ ); function hreview(){ return ‘<h2>’. give_value() . ” … Read more