WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Pulling Page content into top of category - an issue (2 posts)

  1. Doodlebee
    Member
    Posted 3 years ago #

    Hey all,

    I'm pulling Page content into the top of a category template. it's working fine, except that this particular Page is broken up into sections with <!--nextpage-->. In the Page itself, it's working as it should - paginating each section. But on the Category page, it's not paginating - it's showing ALL of the page content at once.

    I don't need pagination for the Page content sections, but I do just want to pull the Page content for the *first* Page into the top of the category page.

    I know - sounds confusing. But I hope I'm being clear enough.

    Does anyone know how to pull just the first part of the Page content (chopping it off at the first <!--nextpage-->) into the category template?

    What I have for my category.php file is this:

    <?php get_header(); ?>
    
        <?php if(have_posts()) : ?>
    
        <div id="outerwrap" class="clear">
        <h3>Category title here</h3>
    
    	<?php if(is_category('dogs')) { ?>
    
          <div <?php post_class('clear') ?> id="post-<?php the_ID(); ?>">
    
            <div class="entry clear">
    	    <?php $dogs = get_page_by_title('Page name here');
    	    	  $dogsID = $dogs->ID;
    	    	  $dogs = get_page($dogsID);
    	          $dogscontent = apply_filters('the_content', $dogs->post_content);
    	          echo $dogscontent;
    	    ?>
    	    <!--/entry-->
    	    </div>
    
    	  <!--/post-<?php the_ID(); ?>-->
    	  </div>
    
    <?php } ?>

    You can see, when it echoes "$dogscontent", there's nothing I can find that will paginate said content. Anyone know what I'm missing?

    Thanks!

  2. Doodlebee
    Member
    Posted 3 years ago #

    Heh. Nevermind - I figured it out.

    <?php get_header(); ?>
    
        <?php if(have_posts()) : ?>
    
        <div id="outerwrap" class="clear">
        <h3>Category title here</h3>
    
    	<?php if(is_category('dogs')) { ?>
    
          <div <?php post_class('clear') ?> id="post-<?php the_ID(); ?>">
    
            <div class="entry clear">
    	    <?php $dogs = get_page_by_title('Page name here');
    	    	  $dogsID = $dogs->ID;
    	    	  $dogs = get_page($dogsID);
    	          $content = $dogs->post_content;
    	  	  list($first) = explode('<!--nextpage-->', $content);
    	          $dogscontent = apply_filters('the_content', $first);
    	          echo $dogscontent;
    	    ?>
    	    <!--/entry-->
    	    </div>
    
    	  <!--/post-<?php the_ID(); ?>-->
    	  </div>
    
    <?php } ?>

    Maybe that'll help someone else :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.