• I’m unable to get the shortcode to work on category pages, is there something that needs to be added for this to work?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Hot Themes

    (@hotwptemplates)

    Hello,

    It doesn’t matter if a page is post, page, or category. It should work everywhere. Can you send a link to your site so we can check your category page?

    Thanks,

    Milos
    HotThemes

    Thread Starter jammin184

    (@jammin184)

    Here’s a page where it is working fine:
    Here’s a category page where it is not:

    • This reply was modified 4 years, 9 months ago by jammin184.
    Plugin Author Hot Themes

    (@hotwptemplates)

    Hello,

    The plugin you are using for your e-commerce pages is probably not executing shortcodes or this feature is disabled. I guess it won’t execute any shortcode, not only our plugin’s shortcode.

    Best regards,
    Milos

    Thread Starter jammin184

    (@jammin184)

    The ‘e-commerce’ plugin is WooCommerce. Other shortcodes work in WooCommerce, so this plugin does not work for WooCommerce.

    Plugin Author Hot Themes

    (@hotwptemplates)

    Hello,

    It’s strange, can you try any other shortcode in the same place where Hot Random Image shortcode is and confirm it works?

    Thanks,
    Milos

    Thread Starter jammin184

    (@jammin184)

    Yes, other shortcode works that start and end with [ ]
    Not sure if it has anything to do with this plugin’s shortcode starting and ending with { }

    Plugin Author Hot Themes

    (@hotwptemplates)

    Hello,

    You can change shortcode to use [ instead. Edit plugin file hot_random_image.php and change this line:

    if ( !preg_match("#{randomimage}(.*?){/randomimage}#s",$srchtml) ) {

    to this:

    if ( !preg_match("#[randomimage](.*?)[/randomimage]#s",$srchtml) ) {

    This line:

    if (preg_match_all("#{randomimage}(.*?){/randomimage}#s", $srchtml, $matches, PREG_PATTERN_ORDER) > 0) {

    to this:

    if (preg_match_all("#[randomimage](.*?)[/randomimage]#s", $srchtml, $matches, PREG_PATTERN_ORDER) > 0) {

    and finally this line:

    $srchtml = preg_replace( "#{randomimage}".$hotrandomimage_input."{/randomimage}#s", $html, $srchtml );

    to this:

    $srchtml = preg_replace( "#[randomimage]".$hotrandomimage_input."[/randomimage]#s", $html, $srchtml );

    Please let us know if the plugin works now.

    Best regards,
    Milos

    Thread Starter jammin184

    (@jammin184)

    No sorry that didn’t work. The page is still just showing the shortcode instead of the image.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Not working in category page’ is closed to new replies.