I’ve broken the short code for Contact Form 7!

From the codex: The shortcode parser uses a single pass on the post content. This means that if the $content parameter of a shortcode handler contains another shortcode, it won’t be parsed. http://codex.wordpress.org/Shortcode_API The codex also provides the solution to your issue, which is to use the funciton do_shortcode() If the enclosing shortcode is intended … Read more

Previous/Next with the same category

next_post_link() accepts a third argument which will limit the links to the same category. There is an example of this usage in the Codex: next_post_link( ‘%link’, ‘Next post in category’, TRUE ); in_same_term (boolean) (optional) Indicates whether next post must be within the same taxonomy term as the current post. If set to ‘true’, only … Read more

Custom shortcode not being included in content paragraph [duplicate]

The ‘contact’ function should return a string instead of echoing. So the above, should look like: function contact() { $contact = get_field(‘contact’,options); return $contact; } add_shortcode(‘contact’, ‘contact’); Shortcodes are written by providing a handler function. Shortcode handlers are broadly similar to WordPress filters: they accept parameters (attributes) and return a result (the shortcode output). See … Read more

If post has non-shortcode string

That’s indeed a basic PHP question. Use strpos(). Example: if ( false !== strpos( $post->post_content, ‘foo’ ) ) { wp_enqueue_script(); } Ps. I suggest you to not hook into wp_enqueue_scripts() but a later hooks, e.g. the_content and then load the JavaScript in the footer. This works best under all circumstances as wp_enqueue_scripts and wp_head are … Read more

My title is showing after the shortcode

You needs to change buffer like this: <?php function shortcode_callback() { ob_start(); //my code here return ob_get_clean(); } add_shortcode(‘shortcode’, ‘shortcode_callback’); ?> Please check after replace ob_get_clean(); in your code with return ob_get_clean(); then it’s working fine.

Whats wrong with my code? Need To add String to shortcode? [closed]

$special_id = ‘ . do_shortcode(‘[url_path_number]’)’ ; Is completely wrong. do_shortcode() is a function and shouldn’t be inside quotes, because that just makes a string that says “do_shortcode()”. I don’t even know what you’re trying to do with the dot at the beginning. $special_id = do_shortcode(‘[url_path_number]’); Is correct.

Adding shortcode [closed]

Short codes are designed to be used by people without needing to code or access php files. Simply put that code in a post or page content. (add new post, edit post, and new page, edit page, etc. Save the post / page. and then the shortcode does it’s “magic” of creating the gallery on … Read more