A little query help please.
-
Argh, me and PHP. Could somebody give me a hand?
I’m querying a custom post type in a widget using the following query:
<?php query_posts(array( 'post_type' => 'blog', 'showposts' => 10 ) ); ?> <?php while (have_posts()) : the_post(); ?> <P STYLE="font-size: 14px; font-weight: bold;"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></font> <p><?php echo get_the_content(); ?></p> <?php endwhile;?>
So far so good, were it not that I crop the content using the
more
tag and that does not work on single posts and pages. So I figured I’d just add a little if-statement, but it doesn’t do the trick.I’ve got this:
<?php query_posts(array( 'post_type' => 'blog', 'showposts' => 10 ) ); ?> <?php while (have_posts()) : the_post(); ?> <P STYLE="font-size: 14px; font-weight: bold;"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></font> <p><?php if ( is_single() ) { echo get_the_excerpt(); } else { echo get_the_content(); } ?></p> <?php endwhile;?>
I have tried a few variations, like without the
echo_get
, but the result remains the same: full blog-posts on single posts.Any help is appreciated.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘A little query help please.’ is closed to new replies.