WordPress.org

Ready to get started?Download WordPress

Forums

Spun
customise which posts appear on homepage (4 posts)

  1. Iain Taylor
    Member
    Posted 1 year ago #

    Question:
    Is there a way to customise which posts appear on home page vs perhaps a blog section.
    My goal is to have the home page filled with fixed posts vs a blog section that has a collection of all posts.
    I read the forum item on having fixed home page items and understand that this part will have to be manual for now.

    Idea:
    - some themes have the ability to have a post "tag" or "category" type that the home page listens to in order to know which posts to post. E.g. using "featured" tag.
    - possibly a way to add sections that list posts that have a specific "tag" or"category"

    Notes:
    - I have gone through current topics but could not find any that covered this
    - I have set up and am using a Spun Child theme to make custom changes.
    Thanks in advance.
    Iain

  2. ludovicosecuela
    Member
    Posted 1 year ago #

    Yes Please I need this !!!

    Please... i think "category" is the best way to customise which posts appear on home page.

  3. paulwpxp
    Font hero
    Posted 1 year ago #

  4. akseli_a
    Member
    Posted 12 months ago #

    You have to add a few lines of code in 'The Loop' that runs as the index page loads. The file in question that must be modified is: wp-content/themes/spun/index.php

    ORIGINAL:

    get_header(); ?>
    
    		<div id="primary" class="content-area">
    			<div id="content" class="site-content" role="main">
    			<?php if ( is_home() && ! is_paged() ) : ?>
    				<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
    			<?php endif; ?>
    
    			<?php if ( have_posts() ) : ?>
    
    				<?php /* Start the Loop */ ?>
    
    				<?php while ( have_posts() ) : the_post(); ?>

    and change that to:
    MODIFIED:

    <div id="primary" class="content-area">
    			<div id="content" class="site-content" role="main">
    			<?php if ( is_home() && ! is_paged() ) : ?>
    				<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
    			<strong><?php endif; ?>
    			<?php if ( is_home() ) {
    			query_posts($query_string . '&cat=-3');</strong>
    			}
    			?>
    			<?php if ( have_posts() ) : ?>
    
    				<?php /* Start the Loop */ ?>
    
    				<?php while ( have_posts() ) : the_post(); ?>

    What you want to modify is: '&cat=-3'); and add -3,-5,-8... etc

    More detailed instructions: http://codex.wordpress.org/The_Loop

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic