Support » Plugins » filtering the_content in a custom loop

  • Hi everyone,

    I have a custom loop set up in a page template of mine. First, the regular loop gets the default content for the page. Then, in the custom loop, the_content is called again for each post. The content is being pulled up fine, but a plugin filter that I added only seems to effect the first call of the_content() (eg. the one in the default loop). How can I get it called each time? Here’s the code:

    Plugin Code:

    function add_jumplinks_pluginv($str) {
    	return 'bob'; // line for easy testing
      //return str_replace('href="','target="_blank" href="/scripts/jump.php?link=',$str);

    And here’s an excerpt from the page template:

    <div class="storycontent">
    		<?php the_content(__('(more...)')); ?>
    	<div id="genrepage_info">
            <a href="<?php bloginfo('url'); ?>/submit/?submit_genre=<?php echo $current_cat; ?>">Submit material</a> to this genre<br /><br />
            <a href="<?php bloginfo('url'); ?>/category/<?php echo $current_cat; ?>/feed">Subscribe to the RSS feed</a> for this genre <span class="whatis">(what is this?)</span><br />
    <?php endwhile; endif; ?>
    <hr class="between_windows" />
    <!-- Here's the second loop -->
    <div class="inner_window">
      $current_cat = strtolower($post->post_title);
    <?php $my_query = new WP_Query('category_name='.$current_cat.'&showposts=10'.'&paged='.$paged); ?>
    <?php if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    	 <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    	<div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> — <?php the_tags(__('Tags: '), ', ', ' — '); ?> <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div>
    	<div class="storycontent">
    	                          <!-- add the jump link -->
    		<?php //echo add_jumplinks($post->post_content);
  • The topic ‘filtering the_content in a custom loop’ is closed to new replies.