Plugin Update: Assign Categories to Pages – version 1.2

by Amit Verma on August 15, 2010

in Blogging

Updates in version 1.2:
Compatible with WordPress 3

Why it wasn’t working with WP3

WordPress had introduced Post Types in WP2.9. The default post types are post, page, attachment, revision, and nav-menu-item. WordPress had no restriction on applying taxonomies (category and tag) on any post type but had given the option to select for “post” post type only.

In WP3, the post type needs to be registered with taxonomy to be able to attached to it. The “page” post type is not registered with Category taxonomy so the plugin wasn’t able to save categories for pages in database.

What have been changed to make it compatible with WP3

I have used register_taxonomy_for_object_type function to enable “page” post type for Categories.

Be Sociable, Share!

{ 22 comments… read them below or add one }

Jie September 3, 2010 at 9:08 am

hi, Please help me, I new to wordpress… I’ve downloaded and activated your plugin but some how the option for “auto-insertion of Posts on the Pages which belong to the same category” feature does not seemed to be working even after I’ve checked the option….

Reply

Amit Verma September 3, 2010 at 2:12 pm

Have you mapped the page to the category which you are checking?

Reply

Toscano September 15, 2010 at 7:57 pm

Hi, I think this plugin is great, but i don’t know how to show pages and post of chechek in the same category, I have this (before I’ve activated the “Show the Pages on Category pages” preference), but this only shows posts, not pages on the same category:

have_posts()) : $featured_query->the_post();
$do_not_duplicate[] = $post->ID ?>

<div id="post-” >
<a href="” rel=”bookmark” title=”Permanent Link to “>

Reply

Amit Verma September 16, 2010 at 9:10 pm

change post type before running the query.

$query->set( ‘post_type’, array( ‘post’, ‘page’ ) );

Reply

Toscano September 16, 2010 at 10:43 pm

that’s works, thanks a lot!!

Reply

NikC September 20, 2010 at 9:42 pm

Hi

I Installed the pluging and did some testing with it, it worked as the page I wanted was created, but I have since removed the plugin but the page for the categories that was auto generated is still there, any idea who to get rid of this page as it just gives me a 404 ?

Many Thanks

Nik

Reply

Amit Verma September 21, 2010 at 10:51 pm

This plugin doesn’t create any page. If you are opening a category page, you can check for permanent link structure.

Reply

DG September 22, 2010 at 1:03 am

Hi Amit,
I’m working on my personal site: diegograglia.net/site/
I downloaded your plugin because I’m using pages on the Nav Bar, but I can’t get some of those pages to show on the featured slideshow. The slideshow works by assigning a category to it, that’s why I thought your plugin would help.
I understand I have to edit the page.php but I don’t really see what it is that I have to do. Any help would be much appreciated.
Thanks a lot!
DG

Reply

Amit Verma September 23, 2010 at 9:24 pm

what are these slideshows? Are these posts or are you using custom post types?

Reply

DG September 24, 2010 at 3:19 am

Hi Amit, thanks for your reply. The slideshow is part of the theme and it’s configured through a Featured Category. The stories featured there are posts, and I couldn’t manage to include pages there.
In the end I found a solution for what I was looking for through a different method. I created posts assigning one each to the Categories on the nav bar, so they basically look like pages, and I could still feature them on the Slides.
Best,
DG

Reply

Cesar November 27, 2010 at 2:32 am

Dear Amit:

This plugin is great. I was wondering if a categories Widget is available for this plugin.

I would like to see, in the sidebar of each page, just the subcategories of the category associated. Is that possible?

Thanks,

César

Reply

Amit Verma November 29, 2010 at 1:15 pm

It is very much possible. I will post the code in a day or two.

Reply

cesar December 7, 2010 at 4:54 am

Thank you very very much for this help Amit. I will try this tomorrow and keep you updated.

I think this plugin is very important. The only way to distribute contents over pages.

Kind Regards,

César

Reply

Amit Verma December 7, 2010 at 9:44 am

I am glad you find it useful.

Reply

Marlyse Comte December 15, 2010 at 1:03 am

Great plugin – saves me the gray hair I was just about going to get, trying to do it myself :)

How can I display the assigned categories on the pages => admin page?

I can chose the category from the popup and it filters just fine – but it would be nice if it gets listed just as in the posts => admin page. Obviously the intention was there to show them as the header contains the column name for it.

Thanks!

Reply

Marlyse Comte December 15, 2010 at 10:16 pm

Great plugin and saved me from getting gray hair as I was just about to try and write something the like!

Especially useful that it allows for filtering on the PAGES overview page. One problem though, it does not list the categories in the column. The header shows, but not the rows. The categories are obviously assigned as I can filter via popup.

Can you fix that?

Reply

Amit December 31, 2010 at 6:35 pm

Sorry for the late reply. Could you please put some more light on the problem with example links?

Reply

pat January 23, 2011 at 10:40 pm

I tried the following code that you posted above but it errors out on the following line:
$includeCat.=$category->cat_ID.’, ‘; because of the comma. Is there a fix for that?

[php]
<?php
global $post;

$categories=get_the_category($post->ID);
if(count($categories)>0){
$i=1;
foreach((get_the_category($post->ID)) as $category) {
if($i==count($categories))
$includeCat.=$category->cat_ID;
else
$includeCat.=$category->cat_ID.’, ‘;
$i+=1;
}
?>

<ul><?php wp_list_categories(‘title_li=&child_of=’.$includeCat.’&show_count=0′); ?></ul>
<?php } ?>
[/php]

Reply

Amit January 24, 2011 at 3:36 pm

It was because of faulty single quote. Try using code given below.

[php]
<?php
global $post;

$categories=get_the_category($post->ID);
if(count($categories)>0){
$i=1;
foreach((get_the_category($post->ID)) as $category) {
if($i==count($categories))
$includeCat.=$category->cat_ID;
else
$includeCat.=$category->cat_ID.’, ‘;
$i+=1;
}
?>

<ul><?php wp_list_categories(‘title_li=&child_of=’.$includeCat.’&show_count=0′); ?></ul>
<?php } ?>
[/php]

Reply

Sandor Kiss February 5, 2011 at 5:47 pm

I would like to show full posts on the pages with category. Now I can see only the clickable titles.
I know, there is some tweeking in the template files, and sure, You can give me the solution here, but would you be kind to instruct me, where to put the given lines?
I have no clue, I am not a php guy.
Thanks

Sandor

Reply

Amit Verma January 3, 2011 at 9:37 pm

Got your point.

I will try and fix that.

Reply

Amit Verma January 25, 2011 at 11:45 pm

I have done this and included in next update. Thanks for pointing it.

Reply

Leave a Comment

Previous post:

Next post: