WordPress.org

Support

Support » Plugins and Hacks » All in One SEO Pack » Archive title not being rewritten

Archive title not being rewritten

  • I have noticed that the post archive title is not being rewritten and there is actually no setting in AIOSEOP to set what it should be anyway.

    I am using WooCommerce, which may or may not be part of the problem, but I can’t disable it to test as it is providing the custom post type. The page that I noticed it on is the shop front page, which is basically just an archive page of the “products” post type.

    I tried changing the Use Original Title option, but it makes no difference what it’s set to.

    Cheers

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

Viewing 15 replies - 1 through 15 (of 28 total)
  • Plugin Contributor Peter Baylies

    @pbaylies

    Peter,

    There are options for setting titles for custom post type archive pages in the plugin; under Custom Post Type Settings, make sure you have Enabled “SEO for Custom Post Types” and “Enable Advanced Options”; check all the post types you want to use, and then check “Custom titles” as well, and you’ll have options for setting the title format there. Also, it’s possible to customize the title further using the aioseop_title filter.

    Hate to contradict you, but there is no setting on my screen for custom post archives. Custom posts, yes, but not archives. Have a look at this screen grab

    Plugin Contributor Peter Baylies

    @pbaylies

    Peter,

    Sorry, you’re right; I’ve been working on this, but of course none of that is in the plugin yet. For now, you would have to use the aioseop_title filter to do this, then.

    I Peter, could you give some directions ? i’m actually facing the same problem with custom post type archive named “property”…
    I want to rewrite the archive page with the site name and some other infos.

    thanks a lot.

    I’m running 2.1.2 of AIOSEO and it’s still not fixed, so here’s how I’m working around it. This requires getting your hands dirty and editing the header.php file, so won’t be of help to you if you either don’t know how, or don’t have access to the theme files:

    1. In AIOSEO General Settings, set “Use Original Title” to Disabled
    2. In AIOSEO Performance settings set “Force Rewrites” to Disabled
    3. In the header.php file, find the code which starts with <title> and ends with </title> and replace it with:

    <title><?php if ( is_archive() ) { $postType=get_post_type(); echo $postType . " | "; bloginfo( 'name' ); echo " | "; bloginfo( 'description' ); } else { wp_title(''); }; ?></title>

    (note that this is hard-coding the title to how I want it – which is “page name | site name | site description” – so you might want to edit that to suit you.)

    Hope that’s of help

    Peter

    Plugin Contributor Peter Baylies

    @pbaylies

    Peter,

    You shouldn’t need to do that, either – here’s how you can do this with the aioseop_title filter in All in One SEO Pack:

    add_filter( 'aioseop_title', 'peter_rewrite_custom_titles' );
    
    function peter_rewrite_custom_titles( $title ) {
        if ( is_post_type_archive() ) {
            $postType=get_post_type();
            $title = $postType . " | " . bloginfo( 'name' ) . " | " . bloginfo( 'description' );
        }
        return $title;
    }

    Thanks a lot !!!! i imagine that i can target a specific archive type by putting the name within the : if ( is_post_type_archive(‘property’) )
    for example…

    Plugin Contributor Peter Baylies

    @pbaylies

    numero7,

    Yes, you can do that as well, as per the Codex.

    Thanks Peter. I did wonder about the aioseop_title filter, but couldn’t find any documentation, so I just decided to hack it the direct way!

    numero7 – the filter method should go in your functions.php file (sorry if you knew that already 😉 )

    Both methods write the post type into the title using get_post_type() so you might not need to do any further targeting.

    Hopefully though, both methods will soon be redundant – eh, Peter? 🙂

    Plugin Contributor Peter Baylies

    @pbaylies

    Indeed, it’s in the works; but until then, happy hacking!

    Hi what about the description ? I’m trying also to rewrite the description in my post type archive because actually I cant control what google takes on my page to fill the description field.

    Is there an update on this? I am having the same issue with a WooCommerce install where the main page for the store is title Publications but the page title is shown as Products. I would like this page to have a title of Publications.

    Plugin Author Steve Mortiboy

    @wpsmort

    Support Manager at Semper Fi

    Hi douginbrooklyn,

    This functionality is currently in testing prior to release. We hope to release in the next week or two at most.

    Awesome – thanks!

    Looking forward to this too! You guys are great.

Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘Archive title not being rewritten’ is closed to new replies.
Skip to toolbar