• Resolved extremerecruitment

    (@extremerecruitment)


    my site is http://www.yachtprovisioningservice.com/

    i have created a home page which is based on the default template

    i want the home page to list:
    1- featured posts under heading ‘Featured Company’
    2- unde rthis the last 3 new psots posted to the site.

    i presume i need to create a template for this.
    can anyone help me with what code i need and how to get this done?

    many thanks
    EFrem

Viewing 4 replies - 1 through 4 (of 4 total)
  • you can use below code just replace your post type (page,post, etc.).

    <?php // The Query
    $args = array('post_type'=>'your_post_type',
                  'cat'=>'featured_posts',
                  'post_per_pages'=>'3',
                  'order'=>'ASC');
    
    	query_posts( $args );
    // The Loop
         while ( have_posts() ) : the_post(); ?>
    			<h2> <a href="<?php the_permalink(); ?>">
     <?php the_title(); ?> </a></h2>
            <div> the_content(); </div>
    <?php endwhile;
    // Reset Query
    wp_reset_query(); ?>

    Thread Starter extremerecruitment

    (@extremerecruitment)

    sorry, do i need to create a new template or where do i post this..
    thanks

    if you do not have a home.php in your template you can create it.

    either

    you can add this code in :-

    single.php if you want to show posts on home page
    or
    page.php if you want to show pages on home page

    it’s better to create a home.php file in your theme folder. The final code look like this,

    <?php
    get_header(); ?>
    
    		<div id="container">
    			<div id="content" role="main">
    
    			<?php // The Query
    			$args = array('post_type'=>'your_post_type',
    			              'cat'=>'featured_posts',
    			              'post_per_pages'=>'3',
    			              'order'=>'ASC');
    
    				query_posts( $args );
    			// The Loop
    			     while ( have_posts() ) : the_post(); ?>
    						<h2> <a href="<?php the_permalink(); ?>">
    			 <?php the_title(); ?> </a></h2>
    			        <div> the_content(); </div>
    			<?php endwhile;
    			// Reset Query
    			wp_reset_query(); ?>
    
    			</div><!-- #content -->
    		</div><!-- #container -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    Thread Starter extremerecruitment

    (@extremerecruitment)

    sorry i cant get this to work….
    will leave it
    thanks for trying…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘home page help’ is closed to new replies.