Hello, I'd like to remove the list of categories running down the sidebar on the front page of my site here - but keep them throughout the rest of my site. Any clues on how to do this or a simple nudge in the right direction greatly appreciated!
Hello, I'd like to remove the list of categories running down the sidebar on the front page of my site here - but keep them throughout the rest of my site. Any clues on how to do this or a simple nudge in the right direction greatly appreciated!
Here's an example of using a Conditional Tag for something like:
<?php
if ( ! is_front_page() ) {
wp_list_categories();
}
?>Many thanks - that looks like just the ticket. The theme I'm using has a specific 'sidebar.php' - so would it make sense to put the conditional tag in there?
<div id="sidebar">
<?php
$showSpoilers = get_settings ( "cp_catSpoilers" );
if ( $showSpoilers != "no" ) {
$cp_categories = get_categories('hide_empty=0');
$postcat = get_settings( "ar_spoilers" );
if( ! is_array( $postcat ) ) {
foreach ( $cp_categories as $b ) {
$postcat[] = $b->cat_ID;
}
}
I'm guessing this is the right region, and I've experimented with inserting/replacing the conditional tag, however, I'm inexperienced with .php and I keep getting parse errors - any idea where I'm going wrong? Many thanks once again!
Well at a minimum you would need these two things at the end of that
} // if ( $showSpoilers != "no" )
?>Please forgive me, I'm so much of a novice! - Where would I need to place this text? Would I need to replace something else with it? It would be a godsend if you (or anybody else) could suggest how the whole text above should look with the new edition implemented. Thank you SO much!
Likely will go in your theme's index.php. The article, The Loop, has some info.
Related:
Stepping Into Template Tags
Stepping Into Templates
Template Hierarchy
This topic has been closed to new replies.