How to use author meta in shortcode?
the_author_meta() prints the content immediately. Use instead: $amztrack = get_the_author_meta( ‘amz’, FALSE ); This will return the value.
the_author_meta() prints the content immediately. Use instead: $amztrack = get_the_author_meta( ‘amz’, FALSE ); This will return the value.
You should be returning $location from get_location, instead of echoing it. Your function currently echos the location as soon as it runs, thereby outputting the result before the rest of the copy.
I would suggest that you remove the php from the form and instead write out the relevant HTML in your shortcode code. Loop through wp_dropdown_categories and create a dropdown Loop through clocations and build your collection of checkboxes Drop the wp_nonce_field and code up something simple yourself using a hidden field. Essentially the code doesn’t … Read more
You are using get_post_meta incorrectly, so it is returning FALSE every time. As PHP equates ‘0’ and FALSE, your div will always be displayed. The correct syntax for get_post_meta is: <?php $meta_values = get_post_meta($post_id, $key, $single); ?> where $post_id is the only required argument.
function shortcode_only_wpse_96114($content) { $regex = get_shortcode_regex(); preg_match_all(“https://wordpress.stackexchange.com/”.$regex.”https://wordpress.stackexchange.com/”,$content,$matches); if (!empty($matches[0])) { $content = do_shortcode(implode(‘ ‘,$matches[0])); } return $content; } add_filter(‘the_content’,’shortcode_only_wpse_96114′,1); That should check for any registered shortcodes and if present completely replace the post content with the output of the shortcode(s), removing any other content. If no shortcodes are found the post content gets returned as … Read more
First of all… It’s a really poor quality code, I guess. You assume that there will be only one tabs widget on page (it’s recognized by HTML id param, so placing 2 widgets on same page would generate invalid HTML code). You also implement only one shortcode, which parses it’s content. But I don’t think … Read more
You missed the src part. It should have been: Go on the Shortcode section of the Audio / Video support in Core post. $post_content=”lorem ipsum dolor lorem ipsum “; if( preg_match( ‘#\#s’, $post_content, $matches ) && preg_match(“https://wordpress.stackexchange.com/”([^”]+)”https://wordpress.stackexchange.com/”, $matches[0], $m) ){ echo $m[1]; // echoes http://wpthemetestdata.files.wordpress.com/2008/06/originaldixielandjazzbandwithalbernard-stlouisblues.mp3 //set as featured } The first regex will get your … Read more
Short answer but I think it is all you need. do_shortcode(“[book id=’1′ /]”); Reference: http://codex.wordpress.org/Function_Reference/do_shortcode
Your shortcode is designed to print results directly on the page so it isn’t possible to first check if the output is empty before printing. However, the shortcode runs a specific function and you can use that function directly in a couple ways. Method 1: You can add some additional PHP logic to your template … Read more
try to put this code before replace text in string inside if( !empty( $_POST[‘scembed’] ) ) { $_POST[‘scembed’] = stripslashes( $_POST[‘scembed’] ); Note problem occuring because your quote are escaped in string, so ” becomes \”