I can't display my page content
-
I made a custom template for my homepage and it display my custom post type and post below is my code.
custom post type:<?php if (have_posts()) : { $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("showposts=4&post_type=post_type_products&paged=$paged"); } while(have_posts()) : the_post(); ?> <div class="inside-div-4columns"> <div class="thumb-wrap"><?php if ( has_post_thumbnail()) the_post_thumbnail('post-thumbnails'); ?></div> <h1><?php the_title(); ?></h1> <p><?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt,30); ?></p> <a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>">Read more...</a> </div> <?php endwhile; ?> <?php endif; ?>
post:
`<?php // Display blog posts on any page
$temp = $wp_query; $wp_query= null;
$wp_query = new WP_Query(); $wp_query->query(‘showposts=1’ . ‘&paged=’.$paged);
?>
<ul class=”blog”>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?><div class=”image-wrap”>
<?php if ( has_post_thumbnail()) the_post_thumbnail(‘post-thumbnails’); ?>
<div class=”top-image”></div>
</div>
<h1><?php the_title(); ?></h1>
<p><?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt,50); ?></p>
<a href=”<?php the_permalink(); ?>”>Read more…</a>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>`and this query i use to get the content of the page that I make a front page.
<?php if(have_posts()) : ?> <?php while(have_posts()) : the_post(); ?> <?php the_content(); ?> <?php endwhile; ?> <?php endif; ?>
`but unfortunately this is not working it return the first content of my post.. any idea?
- The topic ‘I can't display my page content’ is closed to new replies.