How to display only certain categories on the 404 page

Posted in: Newspaper
Post count: 93

I tried changing the code of the 404.php page to

$args = array(
‘post_type’=> ‘post’,
‘showposts’ => 6
);
query_posts(‘cat =-65,-1559,-1481,-8,-1280’);

from
$args = array(
‘post_type’=> ‘post’,
‘showposts’ => 6
);
query_posts($args);

But all of the categories are still showing up. I want only app reviews to show up on the 404.

Post count: 780

Hello,

please try:

$args = array(
‘post_type’=> ‘post’,
‘showposts’ => 6,
‘cat’ => ‘cat =-65,-1559,-1481,-8,-1280’
);

Post count: 93

That doesn’t seem to work. I get a white page when I try accessing a 404.

Post count: 780

Hello,
hmm… can I see your code? Maybe we messed up 🙂

Post count: 93
Post count: 780

Hello,
please delete cat = 🙂 leave only the id’s there with minus. Sorry but I messed the code up. http://screencast.com/t/ci5Kbzw1PGmF


$args = array(
‘post_type’=> ‘post’,
‘showposts’ => 6,
‘cat’ => ‘-65,-1559,-1481,-8,-1280′
);

Radu from tagDiv

  • This reply was modified 12 years by Radu.
  • This reply was modified 12 years by Radu.
Post count: 93

That doesn’t work and niether does:

$args = array(
‘post_type’=> ‘post’,
‘showposts’ => 6,

);
query_posts($args, ‘cat=-65,-1559,-1481,-8,-1280’);

This works though:

$args = array(
‘post_type’=> ‘post’,
‘showposts’ => 6,
);
query_posts(‘cat=-65,-1559,-1481,-8,-1280’);

What does the “post_type” and showposts arguments do? Obviously what I did above doesn’t include those arguments, so I’d like to know what I’m letting out.

I’m still curious how to do it so that the ‘cat’ argument is saved in the $args array.

Post count: 854

hello,
on http://codex.wordpress.org/ you can find a lot of answer to your wordpress (not our theme) code question.

post_type = what is the post type; in this example is post but can be of other type (attachment for ex)

showposts = how many posts of this type to show.

Thanks for you message.
Radu A.

Post count: 93

I asked here because it seems that removing the post_type and showposts argument, or modifying showposts, doesn’t affect the 404 page.

‘$args = array(
‘post_type’=> ‘post’,
‘showposts’ => 6,
);
query_posts(‘cat=-65,-1559,-1481,-8,-1280′);’

The code above, effectively displays the same thing as

‘$args = array(
‘post_type’=> ‘post’,
‘showposts’ => 6
);
query_posts($args);’

Also if we can’t figure out how to pass the category exclusion argument into the arg array this theme uses, it wouldn’t be productive to ask someone else for support this theme’s arg array.

Viewing 9 posts - 1 through 9 (of 9 total)
The forum ‘Newspaper’ is closed to new topics and replies.