RexTheRunt
RexTheRunt

Reputation: 181

CSS styling - ignore hidden elements?

I'm using some code to hide breadcrumbs on certain page IDs in Wordpress. I've styled the "breadcrumbs" div with a background colour and some padding. My problem is that the still appears on the pages where the breadcrumb trail is hidden. Is there a way to style the CSS differently to solve this? If I use a class rather than an ID,

<div id="breadcrumbs">
    <?php 
        $ids = array( 2366, 40, 16, 7 );
        if ( ! is_page() || ! in_array( get_the_ID(), $ids ) ) {
            bcn_display();
        } 
    ?>
</div>

Upvotes: 0

Views: 80

Answers (1)

rnevius
rnevius

Reputation: 27092

Just add your breadcrumb div within your if statement...

<?php 
    $ids = array( 2366, 40, 16, 7 );

    if ( ! is_page() || ! in_array( get_the_ID(), $ids ) ) {
        echo '<div id="breadcrumbs">';
        bcn_display();
        echo '</div>';
    } 
?>

Upvotes: 1

Related Questions