WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Front page to display only selected posts

[Resolved] Front page to display only selected posts

  • Hello, is there any way to force my front page to display only certain posts and not all of them? There is no such option in my theme. My site: http://www.euro-freelancers.eu. I do not want to use a static homepage and do not feel comfortable with coding. Thanks in advance.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Klick Design
    Member

    @klick-design

    Did you want to just limit the number of posts or pick out certain posts?

    Create a specific “Category” in your “post” section, and only call that “category” on your home page.

    In other words, I suggest learning to use “Categories”

    Thank you. I have categorised all my posts under “news” and even if I create another category and file a post under that category, it still appears on the front page. What can I do?

    Klick Design
    Member

    @klick-design

    I have a custom home page template and use this code which limits to just the latest post.

    <?php
    /**
     * Template Name: Home Page
     *
     * This is the template that displays all pages by default.
     * Please note that this is the WordPress construct of pages
     * and that other 'pages' on your WordPress site will use a
     * different template.
     *
     * @package WordPress
     * @subpackage Twenty_Twelve
     * @since Twenty Twelve 1.0
     */
    
    get_header(); ?>
    
    	<div id="primary" class="site-content">
    		<div id="content" role="main">
              <!--?php if ( function_exists('yoast_breadcrumb') ) {
    	yoast_breadcrumb('<p id="breadcrumbs">','</p>');
    } ?-->
    
    			<?php while ( have_posts() ) : the_post(); ?>
    				<?php get_template_part( 'content', 'page'); ?>
    <!--klick-design.co.uk to show latest post on Home Page-->
    			<div class="entry-content">	<?php
    $args = array( 'numberposts' => 1 );
    $lastposts = get_posts( $args );
    foreach($lastposts as $post) : setup_postdata($post); ?>
    	<h2>Latest News Article <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    	<?php the_post_thumbnail(); the_excerpt(); ?><!--if I want to include images and full post use the_content and for thumbnails the_post_thumbnail(); see http://codex.wordpress.org/Function_Reference/the_post_thumbnail -->
    <?php endforeach; ?></div><!--#entry-content-->
    <!--end of post addition by klick-design.co.uk -->
    				<?php endwhile; // end of the loop. ?>
    		</div><!-- #content -->
    	</div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    If you are using a child theme with a home page template then this might help you.
    You can see you can increase the number of posts to show.
    $args = array( 'numberposts' => Number of posts here );

    Thanks. I don’t have a child theme with a home page template. Isn’t there a more simple way to do it, maybe by playing around with the category or tag function?

    Klick Design
    Member

    @klick-design

    If there is no option in your theme, then you would have to alter something as far as I understand, It might help others come up with a solution if you mention which theme you are using in your posts.

    keesiemeijer
    Moderator

    @keesiemeijer

    As this is a premium theme which you paid for, your purchase should have included support from either the theme author or where you purchased the theme from. It would be best to contact them for specific instructions on how to customize the theme.

    Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Front page to display only selected posts’ is closed to new replies.