• Resolved Quentin

    (@qur)


    Hello,

    I can’t seem to figure out how to use the _aioseop_description (auto-generated) in my template. I saw some answer everywhere but none seems to be working.
    I have activated the social extension to get Open Graph.
    On some pages I have created share buttons.
    I would like to add something like:
    <?php $og_description = get_post_meta($post->ID, '_aioseop_description', true); ?>
    To use that variable in my sharer’s url, for example for twitter:
    <li class="twitter"><a target="_blank" href="https://twitter.com/intent/tweet?url=<?php echo $og_link; ?>&text=<?php echo $og_description; ?>&via="><span class="socicon_twitter"></span></a></li>
    It works for title, url… but can’t get to retrieve the meta description.

    Any ideas?

    Best regards,

    Quentin

    https://www.ads-software.com/plugins/all-in-one-seo-pack/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Steve M

    (@wpsmort)

    You don’t need to do this in your template. If you don’t set a OG description for a post or page then All in One SEO Pack will use the Meta description as the OG:description so when that post or page is shared the Meta description is used.

    Thread Starter Quentin

    (@qur)

    That works for Facebook and Google+ automatically.
    For twitter, pinterest or to share via email then I need to retrieve the content of meta description or og:description. Like in my example of the twitter sharer url.

    Thread Starter Quentin

    (@qur)

    I reload the post, I can’t find the answer.
    Is there a way to retrieve the content of meta description or og:description generated by All in One SEO?

    Something like:

    <?php $og_description = get_post_meta($post->ID, '_aioseop_description', true); ?>

    Sincerely,

    Quentin

    Is there a solution to this problem ?

    <?php echo get_post_meta(get_the_ID(), ‘_aioseop_description’, true); ?> – Show description but not auto generate descriptions?

    How can I show auto generate descriptions in custom metatags?

    Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    What custom meta tag are you wanting to put them in?

    I use in <head>

    <meta property=”og:description” content=”<?php echo get_post_meta(get_the_ID(), ‘_aioseop_description’, true); ?>” />

    But this not show auto generate descriptions!

    Michael Torbert

    (@hallsofmontezuma)

    WordPress Virtuoso

    The post meta _aioseop_description is only when you manually create a description. The auto-generated one is dynamically generated on pageload, and is not stored in the database.

    By default, your og:description should already be showing the autogenerated description. However, if you need it for something you can try to access the get_main_description() function from the All_in_One_SEO_Pack class.

    In a future version, I’ll make it easier to use the built-in API to access this functionality.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Use Meta description in template (loop)’ is closed to new replies.