Inserting a variable into a shortcode inside php
Inserting a variable into a shortcode inside php
Inserting a variable into a shortcode inside php
You can run the text through do_shortcode: echo do_shortcode( $your_text_with_shortcodes ); or you can apply the_content filters to the text, which does the same thing as above along with some additional formatting goodies, like auto paragraphs and texturize: echo apply_filters(‘the_content’, $your_text_with_shortcodes);
Is a plugin out of the question? Seems like that would be the exact solution to your problem.
Does a String Replacing script affect shortcode output?
Here’s what I’ve done:created a shortcode where I do [myplugin language=”fr” id=”5″][myplugin language=”us” id=”8″] and then, when this page is called, it calls myplugin twice. If it’s not on the right page, my plugin returns nothing. So, when this page is called: if it’s on a domain like “mydomain.fr” I just call do_shortcode(“othershortcode 5”) if … Read more
First Question: Solved by copying and modifying the “archive-product.php” template file. if(is_product_tag(array(‘audio’))) : include ‘archive-product-audio.php’; // includes custom loop else: // default archive loop endif; Second Question: Solved by simply filtering the Recent Products shortcode via “function.php”. add_filter(‘woocommerce_shortcode_products_query’, ‘removeAudioTags’); function removeAudioTags($args){ $args[‘tax_query’] = array(array( ‘taxonomy’ => ‘product_tag’, ‘field’ => ‘slug’, ‘terms’ => array(‘audio’), ‘operator’ => … Read more
You cannot return an array from inside a shortcode, this will lead to the following error Array to string convertion ….. The output from a shortcode needs to be a string, so you need to convert your array to a string. You also cannot echo anything inside a shortcode, neither can you use functions or … Read more
Mobile theme plugins typically sniff the user agent and just switch out your main theme for a bundled “mobile friendly” generic one. In the process, any shortcodes registered in your theme are no longer recognised, and they just display as plain text. Check out the plugin documentation, or contact the developer, and see if they … Read more
You need to generate the shortcode within the loop, and then execute it afterwards: if ( have_rows( ‘homepage_slider’ ) ) { $shortcode=”[ux_slider timer=”4500″ arrows=”true” bullets=”true” auto_slide=”true” nav_color=”light”]”; while ( have_rows(‘homepage_slider’) ) { the_row(); $shortcode .= ‘[ux_banner bg=” ‘ . get_sub_field( ‘slider_image’ ) . ‘ ” height=”600px” text_color=”light” text_align=”center” text_pos=”center” text_width=”70%” parallax_text=”0″ parallax=”3″ effect=”sparkle”] <h1>’ . … Read more
Why can’t I type [ ] opening and closing brackets on the Visual tab?