Tinymce shortcodes within shortcode contents
Tinymce shortcodes within shortcode contents
Tinymce shortcodes within shortcode contents
I believe the problem is you are not calling do_shortcode() in the output buffer. You don’t need to be running the loop within the output buffer since I can assume get_content_template() simply returns HTML with embedded shortcodes. Save that to a string variable, then run that through the do_shortcode() and save the echoed output to … Read more
For this, you’ll actually want to utilize the wp_enqueue_scripts action instead of wp_head. wp_enqueue_scripts is technically the proper way to add scripts and styles to your site. This action allows us to both register scripts and styles for later use (which is what we want here) and allows us to output scripts and styles to … Read more
You should read the Shortcode API as suggested. This should give you an overview of what is happening and how shortcodes should be used. One important thing to remember here, shortcode content should be returned, not echo’ed. Here is also a tutorial that help me a lot. Just a quick tip here, shortcodes should always … Read more
you could remove_shortcode( ‘nggallery’ ); and then add it again: function put_script_after_nggallery_shortcode( $atts ){ global $nggShortcodes; $nggShortcodes->show_gallery($atts); //or otherwise duplicate the callback function wp_enqueue_script(‘special-ngg-sciprt’, ‘url-to-script’, null, null, true); } add_shortcode( ‘nggallery’, ‘put_script_after_nggallery_shortcode’ ); i’m not sure my show_gallery will work, but seems logical what script do you need to add? why not just wp_enqueue_script on … Read more
The correct way is not to do it. Shortcodes are supposed to be self contained and represent an insertion point to some complicated HTML that is harder to get right or due to security permissions is impossible to insert in its pure HTML form. Globals are hated magic when you write proper code, now think … Read more
Look at the source of the_content(): function the_content($more_link_text = null, $stripteaser = false) { $content = get_the_content($more_link_text, $stripteaser); $content = apply_filters(‘the_content’, $content); $content = str_replace(‘]]>’, ‘]]>’, $content); echo $content; } As you can see, there is no filter to prevent that. If you really need inline JavaScript in an XML document you have to escape … Read more
You can do that with using the depth argument. I also created an array of your arguments for better readability. The depth argument accepts the following parameters: ‘depth’ (int) Number of levels in the hierarchy of pages to include in the generated list. Accepts -1 (any depth), 0 (all pages), 1 (top-level pages only), and … Read more
I figured it out. With the shortcode set as [camp_posts type=”academic, sports”] the code that does the trick is this: function camp_posts_function($atts) {//Creates shortcode [camp_posts type=”academics, sports”] $atts=shortcode_atts( array( ‘type’ => ‘nothing’, ), $atts, ‘camp_posts’); $ShortcodeAtts=esc_attr($atts[‘type’]);//Puts “type” attribute into a variable $ShortcodeAttsArray = explode(‘,’, $ShortcodeAtts); $IDout = array();//Initializes array foreach($ShortcodeAttsArray as $slug) { array_push($IDout, get_category_by_slug($slug)->term_id);//Gets … Read more
If you want to display the attached image gallery, from another post, you can use: where the custom id attribute is the post ID. If you want limit the number of items in a gallery, there seems to be a plugin available on wordpress.org called Limit parameter for gallery shortcode (no affiliation). It uses the … Read more