• Resolved jream

    (@jream)


    Hello!

    Is there any way to allow shortcodes in the page title and descriptions? We are running 300 websites in a multisite environment and need the ability to pull the site name and location into the title and description. We already have a custom plugin where these shortcodes are generated. I just need a way for All in One SEO to allow the shortcode in the page titles and descriptions.

    Thanks for any help you may be able to provide!

    Josh

    https://wordpress.org/plugins/all-in-one-seo-pack/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter jream

    (@jream)

    Does anyone have any suggestions for this?

    Hi jream,

    Yes, you can filter aioseop_title and aioseop_description like so:

    add_filter( 'aioseop_title', 'do_shortcode' );
    add_filter( 'aioseop_description', 'do_shortcode' );
    Thread Starter jream

    (@jream)

    That did it! I’m not sure how that works, but it did the trick. Thank you so much! I’ve been stuck on this for days. I really appreciate the help!

    Thread Starter jream

    (@jream)

    Sorry to open this back up, but I’m noticing that your solution works great for the titles but not the descriptions. I double checked my code and it looks identical to what you indicated.

    Any thoughts?

    Hi jream,

    Try this instead and see if it improves matters:

    add_filter( 'aioseop_title', 'do_shortcode' );
    add_filter( 'aioseop_description_override', 'do_shortcode' );
    Thread Starter jream

    (@jream)

    My goodness, your support is the best I’ve ever seen!

    Unfortunately, that didn’t help. Again, it’s working fine for the title.

    The following is what I have in my page settings for description:

    Contact [ic-dealer-name] for your flooring needs. [ic-dealer-address] [ic-dealer-city] , [ic-dealer-state] [ic-dealer-zip] [ic-dealer-phone]

    But is renders as:

    Contact for your flooring needs. ,

    Hi jream,

    The good news is, the fact that the shortcodes aren’t showing up in the description means that they are getting found and run. The bad news, of course, is that they aren’t working as expected. I don’t know what those shortcodes are or how they’re coded, but if they depend on custom fields / post meta, then that may be why they aren’t working, it could be that the post isn’t set up properly when the description is getting output; or it may be due to the page you’re on, or something else that’s running as well.

    Thread Starter jream

    (@jream)

    I created a plugin where enter various data items per site. Here’s a sample of how the “dealer name” is coded and registered.

    function ic_getdealername() {
        return get_option('ic_dealer_name');
    }
    add_shortcode('ic-dealer-name', 'ic_getdealername');

    They seem to work everywhere in the content and widgets.

    Hi jream,

    I’ve confirmed this behavior; try checking the box at the bottom of the All in One General Settings that says “Never Shorten Long Descriptions”; click Update Options, and see if that fixes your issue.

    Thread Starter jream

    (@jream)

    aaannd… that did the trick! Thanks so much! And again, you guys have the best support known to man!

    Thanks Peter!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Shortcodes in titles’ is closed to new replies.