WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Creating 'Featured posts' with loop and custom post type (2 posts)

  1. RETALI8
    Member
    Posted 1 year ago #

    Hi,
    I know to a degree this is covered in the codec under #multiple_loops, but I am wondering if anybody can recommend the best/most efficient way to achieve the following.

    I want to have the 'home' page displaying a loop which ONLY displays post types that are marked as Featured (through I imagine either a custom post type or category?).

    The loop on the 'blog' section of the page will contain all blog posts, including those marked as 'featured.

    I also don't want the slug for the permalinks of featured posts to be 'featured' but fall under whatever category will be appropriate for the post.

    Thanks!

  2. RETALI8
    Member
    Posted 1 year ago #

    I ended up using

    <?php query_posts('category_name=featured&posts_per_page=3'); //only display featured posts

    In the loop on the homepage.
    By categorising a post as 'featured' it will display in the loop on the homepage as well as well as in the feed of the regular 'blog' section. To avoid the slug of the permalink being marked featured, I assign the category of 'featured' after choosing the category it should appear in.

    Not sure if it's necessarily the most elegant solution, however It works for the purpose of this particular theme.

Topic Closed

This topic has been closed to new replies.

About this Topic