Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Autofocus+ Pro Theme | Remove categories from front page WordPress

  • SOLVED

Hello,

I'm new to the forum and would greatly appreciate some advice. I'm using the Autofocus+ Pro theme and my test/working wordpress site is currently hosted at:

http://cynthiapcaster.org/wordpress/

I would like two posts excluded from the grid of images on the front page. These posts are:

"Music" post
http://cynthiapcaster.org/wordpress/archives/283
(categorized as "Music")

and

"About" post
http://cynthiapcaster.org/wordpress/archives/563
(categorized as "About")

I want these two posts removed from the grid of images on the front page because I am already linking to these posts in the menu under the "Music" and "About" menu items respectively and is confusing to have them appear in the post image grid as well.

Any thoughts?

I think I need to insert code into the "thematic-functions.php" file.

My thought is the code would look something like this:


if ( is_home() ) {
query_posts( 'category_name=-music,-about' );
}


But I'm not sure exactly where to put it...

Any help would be appreciated.

Thanks!

Answers (2)

2011-02-02

jonnyjaniero answers:

Firstly, its seem both 'about' and 'music' are static pages so cant see why you've set them up as categories. if they were pages, they wouldn't show in grid (for sure). I believe the theme supports the new wordpress 3.0 menu so you could then pick and choose what is included in your main nav, because as it stands, it lists categories (maybe why you allocated 'about' and 'music' as categories in the first place.
so that said, the above is a better option for you.
i believe the following is the snippet that targets home page grid query

<?php query_posts(array(

'post__not_in' => get_option('sticky_posts'),

'caller_get_posts' => 1,

'cat' => '-'.$af_blog_catid,

'exclude' => $postno,

'paged' => $paged,

)); ?>


so ammend to...

<?php query_posts(array(

'post__not_in' => get_option('sticky_posts'),

'caller_get_posts' => 1,

'cat' => '-5, -6,'.$af_blog_catid,

'exclude' => $postno,

'paged' => $paged,

)); ?>


the -5, -6 respond to category id. you can find these in admin> categories> hover over category and you will see the id appear in browser.
you would need to change -5, -6, to the relevant category id's.
that said, i still prefer the first solution, change them to pages.

hope this helps


Daniel Marsden comments:

Jonny,

Thanks for your help and input.

I want "Music" and "About to be posts instead of pages because I prefer the look of post content over page content in this theme. I just thought the design looked better and didn't want to rip up the pages css and restyle them.

I am categorizing the "Music" and "About" posts respectively as "Music" and "About" to get them into the menu using the wordpress 3.0 menu.

Now I just need to remove these categories from the front page image grid.

I placed the code you supplied into my "thematic-functions.php" file, reuploaded the file via FTP, cleared cache and generated a new post to zap the cache again but it's still not removing these posts from the front page. The good news that the new post (which is categorized as "Uncategorized") is not not showing up - so that's a sign something is working.

Here is the code I am using:

<?php } //end featured sliding option check ?>

<?php query_posts(array(
'post__not_in' => get_option('sticky_posts'),
'caller_get_posts' => 1,
'cat' => '-'.$af_blog_catid,
'paged' => $paged,
)); ?>

<?php } //end sticky post check ?>

<?php query_posts(array(
'post__not_in' => get_option('sticky_posts'),
'caller_get_posts' => 1,
'cat' => '-1,-2,-3,-4,-5,-6,-7,-8,-9,-10'.$af_blog_catid,
'exclude' => $postno,
'paged' => $paged,
)); ?>

<?php }


As you can see I am excluding category id's 1-10 with no effect.

I am also including a screen capture of my categories section: when I hover over the "About" category for example, it doesn't give me a category id, it just shows the label "About".

Again, thanks for your help. If this is too much work I can increase the award price for you.