All in One SEO Pack
[resolved] Can we use the plugin's fields in our theme? (4 posts)

  1. Michael Soriano
    Posted 3 years ago #

    Great plugin! Been a long time user, but would like to see additional functionality.

    I want to know if I can use the plugin title and description in my theme.

    Basically, in my theme, I want to include those fields within the loop. I am thinking of using it in my archive pages.

    So in archive.php, instead of calling the_excerpt or the_content, i would like to use the plugin's description.

    How do i go about doing this?

    Thank you.


  2. Michael Soriano
    Posted 3 years ago #

    Anybody know how to do this? to clarify:

    All in One SEO has custom titles and descriptions for each post. I want to be able to echo this out in my theme.

    For example, in archive.php -> i want to use the All in One SEO description instead of the_content() or the_excerpt().

    The reason is, I have hundreds of posts, and I've always edited the All in One SEO title and description to be more "attractive" to the reader - and I want to use it in my archive pages. This will also make the archive pages better in Google - because it won't show duplicate content.

    Please advise.

  3. Peter Baylies
    Plugin Contributor

    Posted 3 years ago #


    This is possible; it might be easier to set this text as a manual excerpt, as All in One SEO Pack will use that as the description if no description is present as well; but what you can do is filter the_excerpt (or the_content) and have it display the post meta _aioseop_description for the post, which is where the description is stored.


    add_filter( 'the_excerpt', 'sfwd_aioseop_show_desc' );
    function sfwd_aioseop_show_desc( $text ) {
        global $post;
        if ( !empty( $post ) && $desc = get_post_meta( $post->ID, '_aioseop_description', true ) {
            $text = $desc;
        return $text;
  4. Michael Soriano
    Posted 3 years ago #

    f*ck yeah. this is exactly what i need. thanks bro

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • All in One SEO Pack
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.