WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. michael
    Member
    Posted 10 months 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.

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

  2. michael
    Member
    Posted 10 months 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
    Member
    Plugin Author

    Posted 10 months ago #

    michael,

    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.

    Example:

    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
    Member
    Posted 10 months ago #

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

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.