Try
<?php
$catid = get_cat_ID('events');
query_posts($query_string . '&cat=-'$catid);
?>
Related:
How do I determine a Post, Page, Category, Tag, Link, Link Category, or User ID?
Thread Starter
jo6891
(@jo6891)
Hi Thanks for your response.
Unfortunately that didn’t work. It actually just gave me a parse error.
Thanks again
At a guess i’d say that’s because the $query_string is empty, which results in the parameter line starting with a &
.
Drop the query string part, and see if that helps, i can provide an alternative to $query_string
if you need one.
Example without qs:
query_posts('cat=-'$catid);
Thread Starter
jo6891
(@jo6891)
Hi t31os_, thanks for your reply.
Unfortunately your method is also throwing me a parse error.
I am dropping in the query before my loop. That is correct, right?
Thanks again
Can i see the block of code where you’re placing this, 3-4 lines above and below the code you’re adding, plus your additions, please..
And remember to use backticks for posting code..
code
It’s usually the key to the left of 1, at the top left of your keyboard.
Thread Starter
jo6891
(@jo6891)
Sure,
Please see below
<div id="blog_content">
<h1>Title Here</h1>
<?php
$catid = get_cat_ID('Events');
query_posts('&cat=-'$catid);
?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<p><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></p>
<?php the_content('Read the rest of this entry »'); ?>
Remove the &
like i did in the example further up.. 😉
Thread Starter
jo6891
(@jo6891)
My bad! Sorry!
However that still gives me a parse error.
There’s a second error.
query_posts('&cat=-'$catid);
Should be.
query_posts( 'cat=-' . $catid);
The spaces are not the fix, just for readability… (the missing dot is the second error).
Thread Starter
jo6891
(@jo6891)
That works perfectly. Thank you so much!
If you’re using that in your index.php i’ll wait here patiently for the follow up question.. 🙂
And, you’re welcome.. 😉