Home > Software design >  Top Rated Products do_shortcode in php not working when attributes added
Top Rated Products do_shortcode in php not working when attributes added

Time:07-01

When I add this code: <?php echo do_shortcode("[top_rated_products orderby="rand" per_page="15"]"); ?> to my php page, it doesn't work, but it works when I use this: <?php echo do_shortcode("[top_rated_products ]"); ?>

Is there any way to allow for the first code to be used?

CodePudding user response:

You have to wrap the shortcode in single quotes like

do_shortcode('[top_rated_products orderby="rand" per_page="15"]');
  • Related