Matthew Vaccaro

Guns, God, Country, and Code
  • Index
  • Blog
  • Snippets
  • Show Item by Blog/Page – WP MultiSite

    The code snippet below allows you to display a certain element or item, whatever, on a specific blog or page. This example allows you to specifcy either the page ID, the blog ID, or both using your PHP operators. You can else switch the item with the do nothing statement, or vice versa.

     

    <?php
    
    $blogID = get_current_blog_id();
    $pageID = get_the_ID();
    
    if ( 1 == $blogID && $pageID == 17 ) {
        // Do nothing.
    } else {
        echo ''.get_template_part('includes/toolBar').'';
    }
    
    ?>
    Go Back