7

I made a custom post type called "friends".

I am able to correctly list my friends using this urls:

http://mysite/friends/friend1/

http://mysite/friends/friend2/

http://mysite/friends/friend3/

But I have a "logic" problem with the "archive page"

My problem is:

If I use the "has_archive" option of my custom field I am able to see my page but I am not able to use SEO plugins to improve my page in term of searchability and I am not able to put some content inside the page before the while ( have_posts() ) statement using "the_content" statement I would normally use in a page template.

If I try to use a Page with the slug /slugfriends/ I am able to use SEO plugins, I can even write some content and I can then use query_posts to cycle through my friends but it seems that there is no possibility to have the same slug reserved for my custom post type. So i seems that I can have:

http://mysite/slugfriends/ (served by my page)

http://mysite/friends/friend1/ (served buy custom post type)

http://mysite/friends/friend2/

but I can't have:

http://mysite/friends/ (served by my page)

http://mysite/friends/friend1/ (served buy custom post type)

http://mysite/friends/friend2/

Is there anyone that has reached the goal to have such configuration running? Maybe using some hooks or similar? I tried in many ways but no one seems to work.

Regards, Marcello

1 Answer 1

1

I don't know what content you want to insert in your archive page, but you can always use the file "archive-friends.php" as you can see in the Template Hierarchy to loop your "friends" post type.

Then, to customize the SEO, I recommend you the plugin WordPress SEO by Yoast because it has a strong compatibility with custom post types, so that you will be able to define your SEO description and titles for your "friends".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.