Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Center area post/pages (http://forum.bytesforall.com/forumdisplay.php?f=32)
-   -   Stop certain posts from appearing on home page ? (http://forum.bytesforall.com/showthread.php?t=15600)

jonb2010 Oct 8, 2011 08:11 AM

Stop certain posts from appearing on home page ?
 
I am trying to stop certain posts from appearing on the front page of www.mummybird.com

I have created a page for reviews as I don't want the reviews clogging up the home page.

I've added this to the index.php
<?php if (is_front_page() && !is_paged() )
$posts = query_posts($query_string . '&cat=-108'); ?>

It works on the first home page but the review posts then start appearing on the second page. It's also started doubling posts that appear on the first page and putting then on the second page again.

Anybody got any suggestions how I can make this happen ?

thanks Jon

juggledad Oct 8, 2011 07:19 PM

what are the review posts?
where did you add that code in index.php?
take a look at the custom query template in the Gold Forum/Tutorials

jonb2010 Oct 9, 2011 03:56 AM

Review posts are just in the Review category to appear only on the Review Page.

I've been trying the custom query you mentioned but whatever I try it try I end up with no posts on the front page at all.

I saved the template as home.php and edited it like below, then tried it without the separate "$args =;" and it still doesn't show any pages.

$custom_fields = get_post_custom($post->ID);
$my_custom_field = $custom_fields['custom_query'];
$args = '';

$args = query_posts( 'cat=-108' );

if (have_posts()) {
$paged = (get_query_var('paged'));
get_query_var('paged');
$args= $args."&paged=$paged";
}

query_posts($args);
?>

I've had to delete home.php from the server as every time I upload it I lose my front page posts. Not sure what I'm doing wrong. Any ideas ?

jonb2010 Oct 11, 2011 10:32 AM

Anybody got any ideas ?

juggledad Oct 11, 2011 11:48 AM

Try changing the line to
$args = $args + '&cat='-108'

jonb2010 Oct 15, 2011 01:31 AM

Hi Juggledad, I just tried that bit it comes up with this error on the front page and doesn't load.
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/donna/public_html/wp-content/themes/atahualpa/home.php on line 21

If I gave you a login would you be able to take a look ? Quite happy to make a donation for your help :)

I've put this back into the original index.php in the meantime.

<?php if (is_front_page() && !is_paged() )
$posts = query_posts($query_string . '&cat=-108'); ?>

juggledad Oct 15, 2011 03:24 AM

Be glad to take a look but it won't be till Sunday due to an all day commitment today


All times are GMT -6. The time now is 01:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.