Separating Custom Template logic
Separating Custom Template logic
Separating Custom Template logic
You are correct, [login_form] is the shortcode that you should use. From the Shortcode API The add_shortcode function is used to register a shortcode handler. It takes two parameters: the shortcode name (the string used in a post body), and the callback function name. From what I can understand is that the shortcode calls a … Read more
You are passing the parameters wrong, try with something like this: function get_telephone($attrs) { $attr = shortcode_atts( array( ‘name’ => ‘John Doe’ ), $attrs ); return attr[‘name’]; } add_shortcode( ‘telephone’, ‘get_telephone’ ); In the post you call the shortcode like this: [telephone name=”Jose”] Anyway, inside the get_telephone function you should add some logic to get … Read more
According to Codex: function shortcode_function_name( $atts ) { $atts = shortcode_atts( array( ‘attr1’ => ”, ), $atts, ‘your-shortcode-name’ ); return ‘<div id=”‘.$atts[‘attr1′].'”>Your Predefined Content</div>’; } add_shortcode( ‘your-shortcode-name’, ‘shortcode_function_name’ ); Adding [your-shortcode-name attr1=”Value1″] to the content of any post/page will give the following output <div id=”Value1″>Your Predefined Content</div>. Adding [your-shortcode-name attr1=”Value1″] to the content of any … Read more
It’s easier to remove specific shortcodes than it is to remove_all_shortcodes() and enable specific shortcodes. To disable specific shortcodes from display everywhere, you would use the following: <?php add_filter( ‘the_content’, ‘oxo_remove_shortcodes’, 0 ); function oxo_remove_shortcodes( $content ) { /* Add the shortcodes that you would like to remove to the array below. */ $shortcode_tags = … Read more
Try the following code: function caption_shortcode( $atts, $content = null ) { $content = do_shortcode($content); return ‘<span itemprop=”articleSection”>’. str_replace( array( ‘<‘, ‘>’ ), array( ‘<’, ‘>’ ), $content ) .'</span>’; } add_shortcode( ‘source’, ‘caption_shortcode’ ); remove_filter( ‘the_content’, ‘wpautop’ ); remove_filter( ‘the_excerpt’, ‘wpautop’ );
May I suggest you provide details as to the exact problem, and what the results are of your example code? Also, it seems like you are saying that the pages you want to get the titles of are siblings of the parent, which is the home page, so in fact, they are not children at … Read more
Problem in creating a shortcode form custom post type slider
Thanks to the response by @bueltge : Added extra line in the __construct() function: public function __construct() { $this->var = $this->shortcode_1(); //added add_shortcode( ‘the_single’, array( $this, ‘shortcode_2’ )); }
WordPress has this little minimally documented function, wp_video_shortcode() Just pass an array with the necessary information as if you were writing out the shortcode.