I’m trying to set up a function that excludes from certain categories based on their ID. I just can’t seem to get it to work though.
//-----------------------------------------------------------
// Tabvanilla
//-----------------------------------------------------------
// tabvanilla
function tabvanilla () {
! in_category( array( 6,4,5 ) )
<div id="tabvanilla" class="widget">
<ul class="tabnav">
<li><a href="#popular">Recent</a></li>
<li><a href="#recent">Popular</a></li>
<li><a href="#categories">Categories</a></li>
</ul>
<div id="recent" class="tabdiv">
<?php recent_posts(); ?>
</div><!--/recent-->
<div id="popular" class="tabdiv">
<ul>
<?php $popular = new WP_Query('orderby=comment_count&posts_per_page=20'); ?>
<?php while ($popular->have_posts()) : $popular->the_post(); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?> (<?php comments_number('0','1','%'); ?>)</a></li>
<?php endwhile; ?>
</ul>
</div>
<div id="categories" class="tabdiv">
<ul>
<?php wp_list_categories( 'title_li=' ); ?>
</ul>
</div><!--Categories-->
</div><!--/widget-->
<?php
}
//wp_enqueue_script( 'jquery-ui-tabs' );
add_action( 'wp_footer', 'tabvanilla_script', 11 );
function tabvanilla_script() {
?>
<script type="text/javascript" src="<?php echo get_bloginfo('stylesheet_directory') . '/custom/jquery-ui-personalized-1.5.2.packed.js' ?>"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#tabvanilla > ul').tabs({ fx: { height: 'toggle', opacity: 'toggle'/*, duration: 60000*/ } });
});
</script>
<?php
}
/* End */
add_action('thesis_hook_after_multimedia_box','tabvanilla');
I need it excluding from categories with the ID 4, 5, 6 so I added
! in_category( array( 6,4,5 ) )
I keep getting errors though. I have the category stripped from my url so that it just gives postname, I was wondering if this would be problematic? Any advice? Thanks
Parse error: syntax error, unexpected T_STRING on this line ! in_category( array( 6,4,5 ) )
Ok, but that’s just a part of the entire if. Can you post the entire instruction, and a couple before and after?
All the code I use is displayed on my first post. Do you need anything else? Getting the error on the second line of the function
Must be me. I don’t see that little piece that’s giving you the error in the code you posted? You just posted it stand-alone. Please post the code with that piece included.
This is the full code i’m using… I have marked where i’m getting the error with //getting the error on this line
Hope that’s what you meant.
The full error is Parse error: syntax error, unexpected T_STRING in /home/leehugh2/public_html/www.the-ephemeral-project.com/wp-content/themes/thesis_18/custom/custom_functions.php on line 274
function tabvanilla () {
! in_category( array( 6,4,5 ) ) // Getting error on this line
<div id="tabvanilla" class="widget">
<ul class="tabnav">
<li><a href="#popular">Recent</a></li>
<li><a href="#recent">Popular</a></li>
<li><a href="#categories">Categories</a></li>
</ul>
<div id="recent" class="tabdiv">
<?php recent_posts(); ?>
</div><!--/recent-->
<div id="popular" class="tabdiv">
<ul>
<?php $popular = new WP_Query('orderby=comment_count&posts_per_page=20'); ?>
<?php while ($popular->have_posts()) : $popular->the_post(); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?> (<?php comments_number('0','1','%'); ?>)</a></li>
<?php endwhile; ?>
</ul>
</div>
<div id="categories" class="tabdiv">
<ul>
<?php wp_list_categories( 'title_li=' ); ?>
</ul>
</div><!--Categories-->
</div><!--/widget-->
<?php
}
//wp_enqueue_script( 'jquery-ui-tabs' );
add_action( 'wp_footer', 'tabvanilla_script', 11 );
function tabvanilla_script() {
?>
<script type="text/javascript" src="<?php echo get_bloginfo('stylesheet_directory') . '/custom/jquery-ui-personalized-1.5.2.packed.js' ?>"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#tabvanilla > ul').tabs({ fx: { height: 'toggle', opacity: 'toggle'/*, duration: 60000*/ } });
});
</script>
<?php
}
/* End */
add_action('thesis_hook_after_multimedia_box','tabvanilla');
function tabvanilla () {
! in_category( array( 6,4,5 ) ) // Getting error on this line
First of all, php code should be placed inside <?php and ?> php code tags.
And ! in_category( array( 6,4,5 ) ) is not valid php code. I think what you want is an if:
if (!in_category(array(6,4,5)) {
Don’t forget to add the if’s closing bracket at the right point in your code.
Btw, I now see you already had the line in your first post, I just didn’t expect it there 
I’m now getting a Parse error: syntax error, unexpected ‘{’ error for the same line i.e
if (!in_category(array(6,4,5)) {
many thanks for your help btw 
You are missing one ) in that if (you have 3 ( and 2 ) ).
Thanks, getting another error now but i’ll try and figure it out 