WordPress.org

Ready to get started?Download WordPress

Forums

Load a given single post in Custom Post Type archive (best practice?) (1 post)

  1. jtost
    Member
    Posted 2 years ago #

    Hi everybody!

    I have a custom post type in my site named "services" whose capability is 'page'. The template structure that I have is:

    • archive-services.php - archive template
    • single-services.php - single post template
    • sidebar-services.php - sidebar that lists all the posts of the 'services' type with wp_list_pages (it highlights the current posts)

    The permalink structure for the archive is mysite.com/services/ and for the single posts mysite.com/services/post-1.

    And here comes my question. I need to load a given page on mysite.com/services/ instead the archive, and this page has to be highlighted in the sidebar.

    Which would be the best practive (and "cleanest") to get this behaviour? Changing the main query/loop inside archive-services.php? Adding a template redirect in functions.php?

    Thanks in advance for your help!

Topic Closed

This topic has been closed to new replies.

About this Topic