Home Forums Front-end Issues ACF Shortcode in Title, in Widget Title, in Search Results


ACF Shortcode in Title, in Widget Title, in Search Results

  • I am trying to create website to sell digital goods. Each product have it’s own version, and it can be updated. I use WooCommerce, and all versions are displayed in title and in attributes. But I can’t edit attribute field directly, and I also don’t like to write two times new version. So, I installed ACF and with the help of shortcode and php I can control now version numbers in title and in custom attribute field. Everything is working as intended, but I faced some big problems with displaying shortcode in different places.

    By default WordPress allow me to use shortcode only in post, to use it in title for example, I need to add something like thisin functions.php
    add_filter( 'the_title', 'do_shortcode' );

    But, it doesn’t work in other places on website at all. I can’t make it working in WooCommerce widgets, such as last products or featured products, I tried different combinations for “do_shortcode”.

    Also, default WordPress search and other plugins for search, and even plugin that displays tables of products are also don’t understand the shortcode, and showing only the shortcode itself, not the value.

    I also tried some plugins such as Shortcodes Anywhere or Everywhere, it didn’t help, ACF shortcode is not working in widget titles, in search result title etc etc.

    Product Page + Widgets
    Search Results

  • No one has answered because this is not really an ACF question even though you are using the sortcode supplied by ACF. What you need to do is to get answers from all of the other plugins that show content on how you can make their output apply the shortcode.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.