nottinghamjazz
Member
Posted 3 years ago #
I have a blog for my band.
I also want to add non-band related posts to my blog (to drive more viewers to my site) but I don't want those unrelated posts to appear on the homepage of the blog. When a user views my blog I want only the relevant band posts to appear on the homepage.
How do I suppress some posts from being added automatically to the top of my blog homepage, but still make those posts indexable (and hence googleable) ?
Does this question make sense? Thanks
asfodel
Member
Posted 3 years ago #
You can use categories to accomplish this. Use a separate category for the non-band related posts and then edit the code to exclude that category from the main page.
http://codex.wordpress.org/The_Loop#Exclude_Posts_From_Some_Category
roya khosravi
Member
Posted 3 years ago #
to display posts from all categories except category_id 18:
in /wp-content/themes/your theme/index.php
.....
<?php if (have_posts()) : ?>
<?php if (is_home()) query_posts("cat=-18"); ?>
<?php while (have_posts()) : the_post(); ?>
....
nottinghamjazz
Member
Posted 3 years ago #
Wow that was super smart. I found all I needed to add was:
<?php if (is_home()) query_posts("cat=-5"); ?>
beneath the <?php if (have_posts()) : ?> and before the <?php while (have_posts()) : the_post(); ?> lines at the top of my default theme index.php
Thank you for your help!
samandiriel
Member
Posted 2 years ago #
Good trick, just what I was looking for to prevent posts with video from appearing on my main page!
Many thanks!