• on this page i have the following php code which pulls in the excerpts of recent posts at the bottom of the page:

    <?php
    $custom_query = new WP_Query( 'posts_per_page=3&cat=1' );
    if ( $custom_query->have_posts() ) : while ( $custom_query->have_posts() ) : $custom_query->the_post(); ?>
    
    <p id="title"><?php the_title(); ?></p>
    <p id="small-date">Posted on: <?php the_time('F j, Y') ?></p>
    <?php the_excerpt(); ?>
    <hr />
    <?php endwhile; else : ?>
    
    <h3>Sorry...</h3>
    <p>No posts were found.</p>
    
    <?php endif; ?>

    i’m using the exec-php plugin to make it work inside the page.

    but for some reason, this php messes up the captioned images in the section above. you can go to this test page i setup to see what it looks like when there’s no php code in there.

    please advise what’s wrong. thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Did you resolve this? It looks like you’ve disabled the exec-php plugin just now.

    Thread Starter goldmember

    (@goldmember)

    it’s enabled now. please advise.

    Thread Starter goldmember

    (@goldmember)

    so apparently the excerpt was messing it up. i have the following code in there now which is working:

    <?php $recent = new WP_Query("cat=1"); while($recent->have_posts()) : $recent->the_post();?>
    <a href="<?php the_permalink() ?>">
    <?php the_title(); ?></a>
    <p id="small-date">Posted on: <?php the_time('F j, Y') ?></p>
    <?php endwhile; ?>

    but i’d really like to have this code in there, which includes the excerpt:

    <?php $recent = new WP_Query("cat=1"); while($recent->have_posts()) : $recent->the_post();?>
    <a href="<?php the_permalink() ?>">
    <?php the_title(); ?></a>
    <?php the_excerpt(); ?>
    <p id="small-date">Posted on: <?php the_time('F j, Y') ?></p>
    <?php endwhile; ?>

    any idea why the excerpt line is causing a problem?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘php messing up captioned pics’ is closed to new replies.