WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Front page to display only selected posts (9 posts)

  1. speed101
    Member
    Posted 1 year ago #

    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.

  2. Klick Design
    Member
    Posted 1 year ago #

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

  3. Amado.Miami
    Member
    Posted 1 year ago #

    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"

  4. speed101
    Member
    Posted 1 year ago #

    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?

  5. Klick Design
    Member
    Posted 1 year ago #

    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 );

  6. speed101
    Member
    Posted 1 year ago #

    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?

  7. Klick Design
    Member
    Posted 1 year ago #

    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.

  8. keesiemeijer
    moderator
    Posted 1 year ago #

    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.

  9. speed101
    Member
    Posted 1 year ago #

    Thank you.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.