Shortcodes not working in an AJAX call

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

has_shortcode for content added after the content

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

How I make a shortcode for this code?

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

manipulate a plugins shortcode

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

Prevent add_shortcode from escaping a tag

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

Displaying a random user with a shortcode

By default WordPress allow only order ASC and DESC. However, you can use WP_User_Query and the action pre_user_query to adjust the query (that is passed by reference) just like you want. This is efficient because you get only one user, not all. function my_user_by_rand( $ua ) { // remove the action to run only once … Read more

Plugin form unable to process

You missed name attribute of <input type=”submit” value=”<?php _e(‘Submit’); ?>”/> HTML tag. i.e. It should be looks like: <input type=”submit” name=”Submit” value=”<?php _e(‘Submit’); ?>”/> Else, You have to change if condition inside function form_processing() OLD: if(isset($_POST[‘Submit’])){ Replace with: if(isset($_POST[‘rollNumber’])){ Hope this will helps you.

filter title from shortcode

why not to use the_title filter? add_filter(‘the_title’, ‘the_title_filter’); function the_title_filter($title){ $post = get_post(get_the_id()); //enter code here return $title; } as for shortcode – its imposible. in logical way – imposible.