I might not be fully awake, but it seems to me the operator should be “and”, not “or”:
if ( ! is_single() && ! is_page( 'about' ) ) {
get_sidebar();
}
The is_single()
checks if the main query is for a single post, and is_page()
checks if the main query is for a specified page.
Because you don’t want the sidebar to show on single posts, exclude that by ! is_single()
, which leaves you with all other content types except posts. From there, we also want to prevent display on the about
page, so add ! is_page( 'about' )
to allow other pages but not the about
page.
Related Posts:
- Show content if parent page has children
- Current post’s author name in the author meta tag
- Conditional statement for parent, child and grandchild pages
- display most popular tags in two columns
- Trying to use Ternary operators with WP Conditionals
- When is is_admin() available?
- dynamic sidebar not showing anything
- Check if current page is wp-admin
- Second Navigation inside header
- Using is_page() in functions.php not working at all
- Styling images coming from another blog
- sidebar isn’t showing, what’s wrong w/ this code?
- Output 2 items within the Loop
- conditional statement for custom taxonomy
- WordPress widget/sidebar dividers?
- How to enqueue CSS and JS only on specific template?
- Inject PHP code into “sidebar-content” – code before my WooCommerce sidebar widget?
- How to show a dynamic_sidebar if main content content’s height is > a set amount?
- Where do posts get the sidebar from?
- How to create a linked tag list in my sidebar
- Missing sidebar parameter “fix” – before_content
- how could I load a different template part by page
- Dynamic Sidebars & Echo
- WordPress, AJAX and pre_get_posts using conditional tags
- Child page menu in sidebar
- Theme developement – incative sidebars
- Generate sidebar depending on height of post
- If tag equals then show else show
- if statement with is_active_sidebar()
- How to determine if the sidebar is empty? Or not active?
- Sidebar not appearing in footer, but it appears everywhere else!
- Conditional statement for dates
- How can I display a div ONLY if it is not a certain term page
- Don’t show certain div on front page?
- Styling the second sidebar
- If ‘editor’ is empty, then
- Add class to DIV depending on page loaded
- Creating a blog on my companies new website using WordPress but I have sidebar issues
- How to remove sidebar primary widget on Mobile on category page [closed]
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- Undefined index for default custom theme option
- Remove conditional tag from header
- Display an image based on field value
- Multidimensional Array
- Removing sidebar on category pages
- Why the dynamic_sidebar() call is putted into an ul tag?
- “if parent category is” conditional?
- Conditional for Post Format
- conditional: if is page, and all subpages
- Add a select-option to the default widgets
- Woocommerce getting top level category parent and make all sub categories have the same template and menu
- Display Custom Field in Sidebar if Value is Present
- Stuck with sidebar registering
- page 1 is not paged
- Don’t display a sidebar widget when on a specific page
- Retrieve the whole widget sidebar and pass it inside an html
- Loading Widgets Via Child Theme
- How to add Text before my Custom Term and hide it when empty
- How can i create a function tag in my plugin
- Force Sidebar on Full Width page
- Add code to the header of posts by particular author
- Display specific page if user signed in
- Display child-page links in sidebar on both Parent Pages AND Child Pages
- How to get Post sidebar & footer including html like get_the_content() which only gets content section?
- Blog Image and Title in Right Sidebar
- What image is this pulling?
- Widget Logic – display on page and all child
- How can the searchform.php know if it’s used on a registered sidebar id ‘sidebar-1’ or ‘sidebar-2’?
- How to list categories by page id in wordpress
- Adding a sidebar to wp-login.php
- Need to adjust condition to say if I’m pulling categories from a post, to pull only the first one
- how to run a php code in widget?
- if user is admin display admin link and logout link else display logout only
- Add code only for blog posts
- How to define Og Meta Tags in header using conditions [duplicate]
- If Month=Particular month display content [closed]
- if conditional in sidebar plugin Password content shortcode
- My custom widget won’t stay in the widget area after I refresh the widget page
- how to remove sidebar from particular one page
- Listing current pages subp page in list items in the sidebar
- How to echo a different field if another field is empty?
- Adding else if conditional statement to purchased theme
- How to display different widgets on specific pages, hide from other pages
- Sidebar doesnt get updated?
- Conditional in foreach loop is outputting content twice
- Advanced custom fields Repeater conditional statement not working [closed]
- Load slideshow.css file only if Slideshow is checked / on
- Issues trying to add a href statment with PHP into a PHP Echo Statement [closed]
- if is specific custom post in cpt
- advanced custom fields: repeater field within conditional statement [closed]
- Need Help With Making Full-Width Template for Blog Posts (common methods aren’t working)
- Sidebars panel in customizer
- WordPress Block Editor Gutenberg running code inside ! is_admin()
- How to make my scroll bar show under condition
- Add post class to the TinyMCE iframe?
- Allow specific user to edit a specific page
- Passed variable gets undefined variable error on insert on next page
- How do I run the following script from my articles page?
- Filtering image class at output
- Import WordPress header / footer into an external page(s)