Skip to content

Category Page Extender Plugin

Wordpress Plugin to insert posts into pages by category

Donate
Appreciate the plugin? Consider making a donation here.

Category Page Extender enables you to insert posts into various pages on you blog according to the corresponding categories. It includes page navigation if you wish to limit the number of posts per page.

Download Category Page Extender here

Category Page Extender is based on the relations set up using the Category Page plugin by pixline.

***YOU MUST HAVE THE CATEGORY PAGE PLUGIN INSTALLED IN ORDER FOR CATEGORY PAGE EXTENDER TO WORK.

Installation:

  1. First install category page by pixline
  2. Download the plugin Zip archive.
  3. Upload `Category Page Extender` folder to your `/wp-content/plugins/` directory
  4. Activate the plugin through the ‘Plugins’ menu in WordPress
  5. Setup some relationships between Categories and Pages using the Category Page plugin (see Category Page documentation here)
  6. Tweak `page.php` in your theme folder (see below).
  7. Enjoy!

Tweaking the ‘page.php’ file:

Open up page.php in your template folder (you may also set up a seperate a Page Template)

For the most basic setup, insert the following below the loop statement in the page.php file:

<?php if( function_exists(page2cat_pages)){
     page2cat_pages(get_the_ID());
} ?>

I recommend you wrap the function in your standard post class. For example:

<div class="post">
     <?php if( function_exists(page2cat_pages)){
          page2cat_pages(get_the_ID());
     } ?>
</div>
***You can use get_the_ID() and $post->ID interchangeably. However I changed the instructions to use primarily get_the_ID() since I feel it tends to be more reliable.

Plugin Options

<?php if( function_exists(page2cat_pages)){
     page2cat_pages(get_the_ID(), posts per page, number of pages);
} ?>

Posts per page: (default = 10) set to 0 to show all
This sets the number of posts to show at one time on the page.

Number of pages: (default = 15) set to 0 to show all
This tells how many page numbers to show at a time on the page navigation bar.

Example of Category Page Extender with variables:

<?php if( function_exists(page2cat_pages)){
     page2cat_pages(get_the_ID(), 5, 10);
} ?>

This will list 5 posts and up to 10 page numbers at a time on the page navigation bar.

<?php if( function_exists(page2cat_pages)){
     page2cat_pages(get_the_ID(), 5, 0);
} ?>

This will list 5 posts and show all the page numbers available on the page navigation bar.

<?php if( function_exists(page2cat_pages)){
     page2cat_pages(get_the_ID(), 0);
} ?>

This will list all posts associated with the category/page.


Customizing Post Display

Category Page Extender uses a generic code to display each post. You can customize it or copy and paste new code from your index.php file from the theme. You will find the code starting on line 76.

***Note that by default Category Page Extender only shows the excerpt of the post. To change this, replace:

<?php the_excerpt() ?> 

on line 79 with:

<?php the_content() ?>

See code and highlight line below:

	<?php
	///////////////////////////////////////////////////////////////////////////
	///          You can replace the code below to match your theme         ///
	/// (you can copy this from your archive.php, index.php or customize it ///
	///////////////////////////////////////////////////////////////////////////
	?>

	<?php // ----- Start Code Replace ------ ?>

		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
			<div class="post">

					<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
					<div class="entry">
						<?php the_excerpt() ?>
					</div>
					<div class="postmetadata"><?php edit_post_link('Edit', '', ' | '); ?> <?php the_time('d F Y') ?> |  <?php the_author_posts_link('namefl'); ?> | <?php the_category(', ') ?> |  <?php comments_popup_link('No Comment', '1 Comment', '% Comments'); ?> | <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>" class="more">Read More</a> <?php the_tags('<br /> Tags: ', ', ', ''); ?></div>

				</div>

		<?php endwhile; endif; ?>

	<?php // ----- End Code Replace ------ ?>

	<?php
	///////////////////////////////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////////////////
	?>
Please note
If you post code in the comments section, I recommend you wrap the code with wordpress’s sourcecode feature.

</code>

<code>Type your code here.</code>

<code> </code><code>

Otherwise your code may not show up when posted.

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: