All Good Things Must Come To An End

As you all know, I have been doing WordPress plugins and supporting it for the past 6 years. These 6 years of my life, I have been through my polytechnic education, my national service as well as my university education.

I just graduated from university in December 2009 and have been looking for full-time jobs. I am offered a full-time job and will be starting work on 1st February 2010.

I regret to say that I am NOT ABLE to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

However, I WILL still update my plugins whenever I can and you still can report bugs to me via email and I will try to fix it.


Author Topic: Turn off ranking for specific categories  (Read 1563 times)

0 Members and 1 Guest are viewing this topic.

Offline tombrazelton

  • Newbie
  • *
  • Posts: 10
    • View Profile
  • WordPress Version: WordPress 2.8.x
  • Theme Name: Custom
Turn off ranking for specific categories
« on: 18 November 2009, 19:06 »
I'm sure this has already been covered, but I ran a search and couldn't find anything.

I'm interested in turning off ranking for posts within a certain category.

Some of my posts share categories, but it's okay if those rankings are switch off.

How do I go about making this change?

With thanks!

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,535
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: Turn off ranking for specific categories
« Reply #1 on: 18 November 2009, 19:09 »
Code: [Select]
<?php
if(in_category(array(1,2,3)) {
the_ratings();
}
?>
The code above only displays the ratings code when in category 1 2 or 3

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline tombrazelton

  • Newbie
  • *
  • Posts: 10
    • View Profile
  • WordPress Version: WordPress 2.8.x
  • Theme Name: Custom
Re: Turn off ranking for specific categories
« Reply #2 on: 18 November 2009, 19:19 »
Sorry, I'm a bit of a novice with code.

Where is this code located?

What do I change to eliminate ranking from a specific category?

Does each category have a numerical equivalent? Where do I find that?

Thanks!

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,535
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: Turn off ranking for specific categories
« Reply #3 on: 19 November 2009, 08:01 »
1. Erm I will not know where you place the post ratings code in your theme. index.php? archive.php? single.php?
2. You cannot. That code will just hide it instead of eliminate it.
3. When you edit the category, note the URL on top which says cat_ID=2, the 2 here is your cat id.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline tombrazelton

  • Newbie
  • *
  • Posts: 10
    • View Profile
  • WordPress Version: WordPress 2.8.x
  • Theme Name: Custom
Re: Turn off ranking for specific categories
« Reply #4 on: 19 November 2009, 17:20 »
Unfortunately, when I replaced <?php if(function_exists('the_ratings')) { the_ratings(); } ?> with your code (including only category 3 in the array) it caused my homepage to break.

What am I doing wrong?

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,535
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: Turn off ranking for specific categories
« Reply #5 on: 19 November 2009, 18:30 »
Ops missing another )

Code: [Select]
<?php
if(in_category(array(1,2,3))) {
the_ratings();
}
?>

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline tombrazelton

  • Newbie
  • *
  • Posts: 10
    • View Profile
  • WordPress Version: WordPress 2.8.x
  • Theme Name: Custom
Re: Turn off ranking for specific categories
« Reply #6 on: 19 November 2009, 20:31 »
I'm sorry. I don't know if this is accomplishing what I need it to.

I have kind of a unique set up. I run a web comic and it uses publishing theme called ComicPress to display images on the home page.

It's tied into the category system, using the category "Comics" to display the comic image as well as a corresponding blog.

There are sub-categories I use on my site for guest comics, movie reviews and sketches - and those are the categories that I want to exclude. But all of them display under "Comics."

There might not be a way around this, but I thought I would at least attempt to explain the situation to see if it generated any ideas.

My web site is theaterhopper.com, if you wanted to take a look.

Thanks!

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,535
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: Turn off ranking for specific categories
« Reply #7 on: 20 November 2009, 04:56 »
You just need the category ID for guest comics, movie reviews and sketches placed inside the array() part and it will be hidden when the user view this 3 categories.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline tombrazelton

  • Newbie
  • *
  • Posts: 10
    • View Profile
  • WordPress Version: WordPress 2.8.x
  • Theme Name: Custom
Re: Turn off ranking for specific categories
« Reply #8 on: 20 November 2009, 15:31 »
I must be doing it backwards, or something. Because this code doesn't work for me.

My category IDs are comics = 3, guest comics= 18, reviews = 4 and sketches = 27.

When I put 18,4,27 into the array, the rating disappears on the comics, but stays in place for each of the categories I'm trying to remove.

I'm sure it's a conflict with the custom coding on my site.

The other issue is that the results of the guest strips, reviews and sketches that have already been voted on appear in the sidebar widget and on the results page I've set up to show my most popular posts.

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,535
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: Turn off ranking for specific categories
« Reply #9 on: 20 November 2009, 16:25 »
Code: [Select]
<?php
if(!in_category(array(1,2,3))) {
the_ratings();
}
?>

add 1 ! in front

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline tombrazelton

  • Newbie
  • *
  • Posts: 10
    • View Profile
  • WordPress Version: WordPress 2.8.x
  • Theme Name: Custom
Re: Turn off ranking for specific categories
« Reply #10 on: 22 January 2010, 21:43 »
Hello!

Sorry to drag this post out of the basement. But I don't think I saw your revision to add a "!" to the code before I was distracted by a shiny object and forgot to check back.

I was looking at my site again, trying to figure out how to block ranking on those categories and after I applied the revised code, it worked! The ranking stars no longer appear on the home page for guest strips, movie reviews or sketches.

One more question...

How to I achieve the same feat on the ranking page I've established that publishes all the data?

http://www.theaterhopper.com/about/ratings/

I have my Top 25 comics and my Bottom 25 comics. How do I exclude guest strips, movie reviews and sketches from these results?

Also, is this the same data that is pulled into the sidebar widget on the home page (http://www.theaterhopper.com - scroll down a little bit)

Thanks for your help!

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,535
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: Turn off ranking for specific categories
« Reply #11 on: 23 January 2010, 04:01 »
Sorry you can't exclude data/category, you can only choose which category to include.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline tombrazelton

  • Newbie
  • *
  • Posts: 10
    • View Profile
  • WordPress Version: WordPress 2.8.x
  • Theme Name: Custom
Re: Turn off ranking for specific categories
« Reply #12 on: 25 January 2010, 16:11 »
I don't understand?

If I apply the "if(!in_category(array(18,27,4)))" code to the home page, it prevents the ranking tool from appearing on those specific categories. It excludes them.

But the same thing can't be done when the plugin pulls stats on the Top 25 comics? It can't hide them from view?

Can the code be written to ONLY include one category instead of excluding the three others?

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,535
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: Turn off ranking for specific categories
« Reply #13 on: 25 January 2010, 18:23 »
1. Yes you can prevent it from displaying because in_category() is not a PostRatings function, it belongs to WP.
2. Yes.
3. The code by default INCLUDE category, it DOES NOT exclude them.

Code: [Select]
<?php if (function_exists('get_highest_rated_category')): ?>
   <ul>
      <?php get_highest_rated_category(2); ?>
   </ul>
<?php endif; ?>
Will only display highest rated post from the category ID 2.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline tombrazelton

  • Newbie
  • *
  • Posts: 10
    • View Profile
  • WordPress Version: WordPress 2.8.x
  • Theme Name: Custom
Re: Turn off ranking for specific categories
« Reply #14 on: 25 January 2010, 19:57 »
That appears to have done the trick. But then, how do I get it to display the Top 25 posts with 10 votes or more? Because right now, it's displaying the Top 10 with no minimum vote criteria.

The previous code looked like this:

<?php if (function_exists('get_highest_rated')): ?>
   <ul>
      <?get_highest_rated('post', 10, 25); ?>
   </ul>
<?php endif; ?>

Where do I sneak the ('post', 10, 25) into the revised code. Does it fit within the new category parenthesis?

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,535
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: Turn off ranking for specific categories
« Reply #15 on: 25 January 2010, 20:33 »
Code: [Select]
<?php if (function_exists('get_highest_rated_category')): ?>
   <ul>
      <?php get_highest_rated_category(CATEGORY_ID'post'1025); ?>
   </ul>
<?php endif; ?>

Replace CATEGORY_ID with your category ID

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline tombrazelton

  • Newbie
  • *
  • Posts: 10
    • View Profile
  • WordPress Version: WordPress 2.8.x
  • Theme Name: Custom
Re: Turn off ranking for specific categories
« Reply #16 on: 25 January 2010, 21:26 »
This code makes sense, although I think we might be at a dead end.

Here's the thing... two of my categories - guest comic and reviews - have to be checked in tandem with the comics category to display on the home page. It's kind of a hang up of the Comixpress content engine that I have tied up with Wordpress.

So, as a result, I don't think the ranking page knows to exclude a post with two category IDs. It just looks at the one ID and displays the results.

Does that make sense?

At this point, I'm thinking that it needs to be something resolved within Comixpress and not your plugin. That is, unless you have any ideas?

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,535
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: Turn off ranking for specific categories
« Reply #17 on: 26 January 2010, 04:15 »
Erm, sorry I don't really get what you mean, but even if the post is 2 categories, as long as one of them are stated in get_highest_rated_category(), it will list the post.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

Offline tombrazelton

  • Newbie
  • *
  • Posts: 10
    • View Profile
  • WordPress Version: WordPress 2.8.x
  • Theme Name: Custom
Re: Turn off ranking for specific categories
« Reply #18 on: 26 January 2010, 13:36 »
Lemme see if I can explain my situation another way.

The way my site is set up is kind of based around images. There needs to be a comic image for the blog post to anchor to.

So, there is one category called "comics" and it's numerical representation is 3. These are the posts that I want the plugin to rank and display.

The second category I have is "guest comics" and it's numerical representation is 18. Technically, the images/posts fall under the "comics" category first. If they didn't, they wouldn't appear on the main page. But I created the "guest comics" sub-category as a way of identifying posts through the Wordpress dashboard. I want to exclude these posts - the guest comics that are labeled both 3 and 18.

This is why I think we're at a dead end. Because it sounds like your code will display a category, but it won't obscure a category with multiple category identifiers.

That's why I feel I need to go back to the people who wrote Comicpress (the content display engine) and ask them how to reformat the code so that the "comics" and "guest comics" categories are mutually exclusive (while still allowing the guest comics category to appear on the home page). Once I do that, I think I will be able to take full advantage of your plugin.