shortcode for logo image
Change ‘name’ => ”, to ‘name’ => ‘logo’, Then when there is no name field passed to the shortcode, it will default to logo, which will load logo.png.
Change ‘name’ => ”, to ‘name’ => ‘logo’, Then when there is no name field passed to the shortcode, it will default to logo, which will load logo.png.
The How It would be much better and easier if you’d just add the script directly to the main body instead of the AJAX call. The same goes with the shortcode result. Just use the shortcode as argument inside wp_localize_script(): wp_localize_script( ‘script-handle’, ‘pluginObject’, array( ‘contactForm’ => do_shortcode( ‘[contact-form-7 id=”698″ title=”Meet The Team Email”]’ ), ) … Read more
In the Loop, it would be: $authorname = get_the_author_meta(‘user_nicename’); Or: $authorname = get_the_author_meta(‘displayname’); Or: $authorname = get_the_author_meta(‘nickname’); Or any field that get_the_author_meta() accepts. $authorname = get_the_author_meta(‘user_nicename’,123); If you just need to echo the name just use the_author_meta() instead: the_author_meta(‘user_nicename’,123);
Depends on the shortcode. If you have access to the shortcode’s handler function, that function’s second argument is the content inside the shortcode: function wpse20136_shortcode( $atts, $content ){ // $content has the content inside xxx } register_shortcode( ‘xxx’, ‘wpse20136_shortcode’ ); For getting all content not in shortcodes, that’s easy. strip_shortcodes() does that: strip_shortcodes( get_the_content() ); … Read more
Try this: function example_shortcode( $atts ) { $shortcode_output = “<p>Some shortcode content.</p>”; $shortcode_output .= “<p>More shortcode content.</p>”; ob_start(); do_action(‘below_shortcode’); $below_shortcode = ob_get_contents(); ob_end_clean(); $shortcode_output .= $below_shortcode return $shortcode_output; }
You can filter the HTML output for oEmbed with oembed_result. Now test the HTTP host of the URL for www.youtube.com and add the parameter. The oEmbed result is cached in a post meta field to avoid too many requests. To update old posts I have added an activation helper that clears those cached content for … Read more
It’s safe, you won’t have any problem using it, the only caution about Hyphens and Shortcodes comes from the Codex. Take caution when using hyphens in the name of your shortcodes. In the following instance WordPress may see the second opening shortcode as equivalent to the first (basically WordPress sees the first part before the … Read more
Pass the content in do_shortcode() will process all the shortcodes in it. So either make the change in your theme or plugin according to your setup. // Lets say $data contains custom field data including shortcodes $processed_data = do_shortcode( $data ); // will contain processed shortcodes
Place the below code to your themes functions.php or inside your plugin and the [return_post_id] shortcode will print the post ID. add_shortcode( ‘return_post_id’, ‘the_dramatist_return_post_id’ ); function the_dramatist_return_post_id() { return get_the_ID(); } Hope that helps.
Simple answer: add_shortcode( ‘hidemytext’, ‘__return_false’ ); But shortcodes should never be used like that. Imagine what happens when the plugin or theme with that shortcode is turned off: everyone can see the content now. This is not very user friendly. So switch the logic: show nothing or the bare shortcode tag by default, show the … Read more