How to implement theme shortcodes in text outside of pages?

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);

Shortcodes: override a shortcode / change shortcode on the fly

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

Woocommerce Filter Main Loop by Tag [closed]

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

How to echo an array returned by a function

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

Shortcode tags appear on mobile themes

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

How do I use “while” and “end while” inside of the echo do_shortcode with ACF Repeater?

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)