Support » Plugin: Head Meta Data » How to add more shortcodes and use them in SEO plugins and post Excerpt?

  • Resolved TekGirlyMama

    (@tekgirlymama)


    Hi, great looking plugin, thank you.

    How to add additional functions and shortcodes?
    Can the shortcodes be added to SEO plugins like Autodescription or Yoast META fields?
    How about shortcodes in the post excerpt hand-crafted summary text?

    Thanks
    e

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Glad to help:

    1) “How to add additional functions and shortcodes?”

    Do you mean write your own functions and shortcodes?

    2) “Can the shortcodes be added to SEO plugins like Autodescription or Yoast META fields?”

    I haven’t tried adding shortcodes to those plugins specifically, but in general WordPress shortcodes can be added to any WP Post or Page (or Custom Post Type). They also may be added to certain widgets, among other places.

    3) “How about shortcodes in the post excerpt hand-crafted summary text?”

    I haven’t tried it, so basically same response as #2.

    Let me know if I can provide any further infos!

    Hi Jeff, thanks for such a fast reply on Saturday night. Workaholics we are 🙁

    Yes, I tried doing something like below code as add on function for a shortcode like [year] to dynamically display this year’s value. Work in post title and content and widgets but can’t get it working in places like post excerpt and in meta (using Autodescription for SEO plugin).
    Probably not in the scope of your plugin and I do apologize for that and bothering you on the weekend on top of my other sins.

    Though would it be possible to add my custom function shortcodes in your meta fields or others I make in this plugin?

    Since you can do a shortcodes and plugins I am kinda hoping you’d be able to point me to the right solution, if you don’t mind me asking. Thanks anyway and wish you a happy relaxing Sunday…

    What I use that is not working for excerpt and SEO Meta fields:

    //* Activate shortcode function in Post Title
    add_filter( ‘the_title’, ‘do_shortcode’ );

    //* Enable Post Meta Shortcode Support
    add_filter( ‘single_post_title’, ‘do_shortcode’ );

    // Enable shortcodes in text widgets
    add_filter(‘widget_text’, ‘do_shortcode’);

    // Enable shortcodes in post excerpt
    add_filter(‘get_the_excerpt’, ‘do_shortcode’);

    //* Activate shortcode function in SEO Autodescription plugin Title and Meta Description
    add_filter( ‘autodescription_title’, ‘do_shortcode’ );
    add_filter( ‘autodescription_description’, ‘do_shortcode’ );

    //* and in Autodescription OG and Twitter titles and descriptions
    add_filter( ‘autodescription_og_title’, ‘do_shortcode’ );
    add_filter( ‘autodescription_og_description’, ‘do_shortcode’ );
    add_filter( ‘autodescription_twitter_title’, ‘do_shortcode’ );
    add_filter( ‘autodescription_twitter_description’, ‘do_shortcode’ );

    //* Shortcode to DYNAMICALLY display the CURRENT year
    //* shortcode: [year]
    add_shortcode( ‘year’ , ‘current_year’ );
    function current_year() {
    $year = date(“Y”);
    return “$year”;
    }

    Plugin Author Jeff Starr

    (@specialk)

    Glad to help:

    1) “Though would it be possible to add my custom function shortcodes in your meta fields or others I make in this plugin?”

    Head Meta Data is not really that extensible. For something as elaborate as this it would make more sense to just write your own plugin. Of course feel free to cannibalize whatever parts of HMD that you may need (it’s all open source, check the license).

    2) “What I use that is not working for excerpt and SEO Meta fields”

    Is that code from some other plugin? If so, the best place to ask would be the plugin developer. I am able to answer any questions about HMD, but not about other people’s plugins.

    I hope you get this sorted, let me know if I can provide any further infos, glad to help however possible.

    Thanks for your reply.
    Got that code from hunting online.
    Thanks, have a nice weekend!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to add more shortcodes and use them in SEO plugins and post Excerpt?’ is closed to new replies.