• So I hornswaggled this code from another post that I found. It works brilliantly. I imagine I can simply add in a call for the thumbnail to get the featured image for each page, as well. So let’s just assume that I’ll do that. ??

    <?php
    				  $args=array(
    				  'orderby' =>'parent',
    				  'order' =>'asc',
    				  'post_type' =>'page',
    				  'post__in' => array(2,10,9,7),
    				   );
    				   $page_query = new WP_Query($args); ?>
    
    					<?php while ($page_query->have_posts()) : $page_query->the_post(); ?>
    					   <div class="teaser">
    						<h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
    						<?php the_excerpt(); ?>
    					    </div>
    					<?php endwhile; ?>

    What I’m always aiming to do is to call things by their slug rather than ID so I can have two separate WordPress installations and not have to maintain the code in two different places as I always have a copy running local and then a copy out on the web that is the “live” site.

    In the end effect, I want to add this code to my “front-page.php” template that comes with Twenty Twelve (in a child theme). This would enable me to do something like this where you see these yellow boxes below the slider here…

    https://wellmanspub.com

    Then the client would be able to adjust those as they like, editing the page excerpt or featured image. Nice and tidy.

    Any help?

  • The topic ‘Displaying page title, excerpt and featured image by slug on homepage’ is closed to new replies.