Skip to main content
added 370 characters in body
Source Link
tfrommen
  • 9.2k
  • 7
  • 39
  • 59

Suppose you have set up an array of page IDs where you don't want the breadcrumbs to be displayed.

$ids = array( 4, 8, 15, 16, 23, 42 );

Now you just have to check if the currently displayed page (or post) has one of these IDs, and if not, display the breadcrumbs.

if ( ! in_array( get_the_ID(), $ids ) ) {
    bcn_display();
}

// EDIT
And if you want to exclude pages only—no other (custom) posts—you could speed up the check a bit.

if (
    ! is_page()
    || ! in_array( get_the_ID(), $ids )
) {
    bcn_display();
}

// EDIT (as per your comment)
To exclude the front page as well as specific pages, try this:

$ids = array( 4, 8, 15, 16, 23, 42 );
// Automagically add the ID of your front page
$ids[ ] = (int) get_option( 'page_on_front' );

if (
    ! is_page()
    || ! in_array( get_the_ID(), $ids )
) {
    bcn_display();
}

Suppose you have set up an array of page IDs where you don't want the breadcrumbs to be displayed.

$ids = array( 4, 8, 15, 16, 23, 42 );

Now you just have to check if the currently displayed page (or post) has one of these IDs, and if not, display the breadcrumbs.

if ( ! in_array( get_the_ID(), $ids ) ) {
    bcn_display();
}

// EDIT
And if you want to exclude pages only—no other (custom) posts—you could speed up the check a bit.

if (
    ! is_page()
    || ! in_array( get_the_ID(), $ids )
) {
    bcn_display();
}

Suppose you have set up an array of page IDs where you don't want the breadcrumbs to be displayed.

$ids = array( 4, 8, 15, 16, 23, 42 );

Now you just have to check if the currently displayed page (or post) has one of these IDs, and if not, display the breadcrumbs.

if ( ! in_array( get_the_ID(), $ids ) ) {
    bcn_display();
}

// EDIT
And if you want to exclude pages only—no other (custom) posts—you could speed up the check a bit.

if (
    ! is_page()
    || ! in_array( get_the_ID(), $ids )
) {
    bcn_display();
}

// EDIT (as per your comment)
To exclude the front page as well as specific pages, try this:

$ids = array( 4, 8, 15, 16, 23, 42 );
// Automagically add the ID of your front page
$ids[ ] = (int) get_option( 'page_on_front' );

if (
    ! is_page()
    || ! in_array( get_the_ID(), $ids )
) {
    bcn_display();
}
added 14 characters in body
Source Link
tfrommen
  • 9.2k
  • 7
  • 39
  • 59

Suppose you have set up an array of page IDs where you don't want the breadcrumbs to be displayed.

$ids = array( 4, 8, 15, 16, 23, 42 );

Now you just have to check if the currently displayed page (or post) has one of these IDs, and if not, display the breadcrumbs.

if ( ! in_array( get_the_ID(), $ids ) ) {
    bcn_display();
}

// EDIT
And if you want to exclude pages onlyonly—no other (no other templatescustom), you posts—you could speed up the check a bit.

if (
    ! is_page()
    || ! in_array( get_the_ID(), $ids )
) {
    bcn_display();
}

Suppose you have set up an array of page IDs where you don't want the breadcrumbs to be displayed.

$ids = array( 4, 8, 15, 16, 23, 42 );

Now you just have to check if the currently displayed page (or post) has one of these IDs, and if not, display the breadcrumbs.

if ( ! in_array( get_the_ID(), $ids ) ) {
    bcn_display();
}

// EDIT
And if you want to exclude pages only (no other templates), you could speed up the check a bit.

if (
    ! is_page()
    || ! in_array( get_the_ID(), $ids )
) {
    bcn_display();
}

Suppose you have set up an array of page IDs where you don't want the breadcrumbs to be displayed.

$ids = array( 4, 8, 15, 16, 23, 42 );

Now you just have to check if the currently displayed page (or post) has one of these IDs, and if not, display the breadcrumbs.

if ( ! in_array( get_the_ID(), $ids ) ) {
    bcn_display();
}

// EDIT
And if you want to exclude pages only—no other (custom) posts—you could speed up the check a bit.

if (
    ! is_page()
    || ! in_array( get_the_ID(), $ids )
) {
    bcn_display();
}
Source Link
tfrommen
  • 9.2k
  • 7
  • 39
  • 59

Suppose you have set up an array of page IDs where you don't want the breadcrumbs to be displayed.

$ids = array( 4, 8, 15, 16, 23, 42 );

Now you just have to check if the currently displayed page (or post) has one of these IDs, and if not, display the breadcrumbs.

if ( ! in_array( get_the_ID(), $ids ) ) {
    bcn_display();
}

// EDIT
And if you want to exclude pages only (no other templates), you could speed up the check a bit.

if (
    ! is_page()
    || ! in_array( get_the_ID(), $ids )
) {
    bcn_display();
}