Shortcodes in Options Panel textareas
simply use echo do_shortcode($textarea_value); (answer by @Bainternet)
simply use echo do_shortcode($textarea_value); (answer by @Bainternet)
You need to reset the post data after your get_posts loop since your calling setup_postdata. It would be better to remove the setup_postdata all together. global $post; $recent_posts = get_posts( $yourargshere ); foreach($recent_posts as $post) : $return = ‘<h4 class=”recent-post-title c0″>’ . $post->post_title . ‘</h4>’; $return .= ‘<p class=”recent-content c0″>’ . apply_filters( ‘the_excerpt’, $post->post_excerpt ) … Read more
The problem was the double quotes which are needed in normal shortcode usage in posts and pages for some reason when using do_shortcode the double quotes in the attributes where breaking the function. Working code below <div> <?php $lat = get_field(‘woo_maps_lat’); $long = get_field(‘woo_maps_long’); echo do_shortcode(‘[forecast location=’ . $lat .’,’.$long. ‘]’); ?> </div>
Use the parent method to pass data back to your meta field. Create a JS function to handle the passing of data from Thickbox to the meta field: function foo_interstitial(data){ $(‘.form-field-selector’).val(data); } Add a submit handler to your thickbox instance that passes to the parent.foo_interstitial() function. $(‘.thickbox-submit-selector’).submit(function(){ var _value_to_pass = $(‘.field-to-pass-selector’).val(); parent.foo_interstitial(_value_to_pass); });
As of WordPress 3.6 you can put comma-delimited entries in the category_name property of the arguments array like this: $args = array( ‘category_name’ => ‘news2014,news2015’, ); query_posts($args); This works if the categories are both at the root level (no parent)
You can use the do_shortcode() function. do_shortcode(‘[your-shortcode option1=foo option2=bar]’); Or in your case: $price = get_post_meta($post->ID, ‘_price’, true); #Dynamically generate the plugin shortcode $new_price = do_shortcode(“[plugin-shortcode price=$price]”); Hope this helps you out!
Try installing the following plugin: http://wordpress.org/extend/plugins/gallery-extended/ You’ll be able to set how many images to show via this code: Hope this helps!
Do not call do_shortcode(). Use the associated handler instead. And if you want to call the shortcode without parameters you have to make the parameters optional in the handler’s declaration: function custom_slidessc($atts = array(), $content = null) So what you need is: return ‘<img>’ . custom_slidessc();
Figured out both issues. You can keep a count and find out when you are on the first iteration in the same go. static $count; if(!$count) { $count = 1; $state=” active”; } else { $count++; $state=””; } From the PHP Manual. “A static variable exists only in a local function scope, but it does … Read more
I would simply find the function that the shortcode is pointing to and call it directly with your variable. It seems like there would be less room for error. example: actual_products_shortcode_function($mycat);