WordPress.org

Ready to get started?Download WordPress

Forums

Pinboard
Post of the specified category on the frontpage (4 posts)

  1. petrusbr
    Member
    Posted 2 years ago #

    Do you know, how to get ex. 2 post of the specified category on the front page. The default option is showing a selected number of post from all categories. I don't like it :)

  2. skywalker108
    Member
    Posted 1 year ago #

    Hi, did you figure out how to do this? I want to do the same thing on brooklynfireproof.com/cafe we have 3 posts which are up there now and they come up when I use different page templates. I am setting up Events Manager and want to have the category Events posts flow under the first 3 posts, so hoping there is a place in the loop or content.php to code this in-- I don't know much php so if anyone can help it would be greatly appreciated.

  3. paul.a.cunn
    Member
    Posted 1 year ago #

    This may seem kind of backwards but this is what I did and it seemed to work well. Get the plugin "WP Hide Post" this will enable an option to hide posts in certain places on your website. Hide any of the posts from the front page you want. This way only the posts you want are on the front page. Unfortunately this does mean going into each post a marking the "Hide on Front Page" but its easy once you start making new posts.

    Cheers!

  4. zarza
    Member
    Posted 1 year ago #

    I overcame this problem. I only wanted one category of post to appear on the home page. That is besides the sticky posts that are in the slider.

    I used this code on the index.php page: <?php query_posts('cat=9'); ?>

    The category id number for me was 9. Replace the nine with your number.

    Mind you I'm working on a child theme so I can always go back to the original index file if I mess it up. See the code below for placement of this post. I am sure you can add additional categories. I made one category of post for the purpose of showing up on the home page.

    Also I shut off the larger posts that appear first, so my site is all masonry blocks. I did that in the theme options area.

    Placement of the above code:

    <?php if( have_posts() ) : ?>
    <div class="entries">
    <?php query_posts('cat=9'); ?>
    <?php while( have_posts() ) : the_post(); ?>

    It starts on around line 14.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.