Please help: formatting a custom post type on a page template
-
Hey all,
Hoping to get some help, I’m sure what I am trying to do is extremely easy however I have only been using WordPress for 3 days so bare with me.
I have created a template to display a custom post type, the code below is what I have so far:
<?php /** * Template Name: Kudos Template * * Selectable from a dropdown menu on the edit page screen. */ ?> <?php get_header(); ?> <div id="container"> <div id="content"> <!-- Displays page title using <h1> tags for formating --> <?php the_title('<h1>', '</h1>'); ?> <!-- Pull posts from testimonails (This is a custom post type) --> <?php $type = 'testimonails'; $args=array( 'post_type' => $type, 'post_status' => 'publish', 'paged' => $paged, 'posts_per_page' => 10, 'caller_get_posts'=> 1 ); $temp = $wp_query; // assign orginal query to temp variable for later use $wp_query = null; $wp_query = new WP_Query($args); ?> <!-- Load template part to encourage code reuse --> <?php get_template_part( 'loop', 'index' );?> </div><!-- #content --> </div><!-- #container --> <?php get_sidebar(); ?> <?php get_footer(); ?>
For each post I am hoping to hoping to add a featured image which is aligned to the left of the post. Is it possible to wrap a <div> around each post so I can style how each post looks? Ideally I would like the featured image to automatically get inserted into a <div> which is aligned to the left.
Essentially I would like to wrap a main <div> around each post, with a further two <div>’s inside, one for the content and one for the image.
Thanks in advance for all of your help!
Lewis.
- The topic ‘Please help: formatting a custom post type on a page template’ is closed to new replies.