• Resolved Doodlebee

    (@doodlebee)


    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!

Viewing 1 replies (of 1 total)
  • Thread Starter Doodlebee

    (@doodlebee)

    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 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘Pulling Page content into top of category – an issue’ is closed to new replies.