It’s just that you got it a bit wrong – it’s actually
if(is_single())
(not singular). If you want to address pages in general (not posts I assume), you would use
if(is_page())
. If you need to address a specific page you could use its ID like so
if(is_page(13))
where 13 would be the ID of the page. But you have a lot of options – see http://codex.wordpress.org/Conditional_Tags .
However, of course you can use conditional tags in both header and footer (i.e. outside the loop) to tailor your template better ;).
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
- Trying to use Ternary operators with WP Conditionals
- When is is_admin() available?
- Check if current page is wp-admin
- Second Navigation inside header
- Using is_page() in functions.php not working at all
- Output 2 items within the Loop
- conditional statement for custom taxonomy
- How to enqueue CSS and JS only on specific template?
- how could I load a different template part by page
- WordPress, AJAX and pre_get_posts using conditional tags
- If tag equals then show else show
- 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?
- If ‘editor’ is empty, then
- Add class to DIV depending on page loaded
- 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
- “if parent category is” conditional?
- Conditional for Post Format
- conditional: if is page, and all subpages
- Woocommerce getting top level category parent and make all sub categories have the same template and menu
- page 1 is not paged
- How to add Text before my Custom Term and hide it when empty
- How can i create a function tag in my plugin
- Add code to the header of posts by particular author
- Display specific page if user signed in
- How to get Post sidebar & footer including html like get_the_content() which only gets content section?
- Widget Logic – display on page and all child
- Need to adjust condition to say if I’m pulling categories from a post, to pull only the first one
- if user is admin display admin link and logout link else display logout only
- How to define Og Meta Tags in header using conditions [duplicate]
- If Month=Particular month display content [closed]
- How to echo a different field if another field is empty?
- Adding else if conditional statement to purchased theme
- 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]
- WordPress Block Editor Gutenberg running code inside ! is_admin()
- How to change upload directory in wp_handle_upload
- Calculate percentage of post by category
- the_title() & the_content() are retrieving Post details inside a Page, after calling a shortcode
- register_rest_route regex option for base64 or alternate
- Customized title tag for each page in pagination?
- Can is_page() be combined with a switch control structure?
- is it possible to force wordpress to always save thumbnails as ‘jpg’ not ‘png’
- WordPress (3.9.1) MultiSite Permissions. Is chown the answer?
- have_posts() execution failure
- WordPress with php 5.5 and zend opcache
- Woocommerce add to cart quantity buttons with AJAX
- my posts are saved as drafts
- Create a range slider to change font-size with different screens sizes in wordpress customizer api
- Ajax load more posts with multiple tax query
- Are there security or other issues with changing PHP time limit and max input vars?
- How can I pass a custom/dynamic product to the Woocommerce cart?
- Irregular TTFB and server wait time response
- WP_Query fails despite having 1 post
- Download PDF after CF7 form submission
- 3 different times on my WordPress website
- Flexslider won’t work on WordPress
- Unable to Find Space in Custom Function
- Is it possible to create new user from external form using REST API?
- WP_Query: getting posts where custom field exists
- Show the section only if custom taxonomy was chosen
- How to separate categories with commas?
- How do I make this Metabox show current DB value?
- Limit posts when visited with mobile devices
- Unable to Call More than One Meta Box Output
- Make a page (url) not cacheable [closed]
- Is there a (offical) way for a theme to deactivate itself and show a message in admin?
- Trying to load category thumbnails on wordpress page
- Insert PHP code in Text
- Retrieve alt text by referencing the img src
- var_dump() and print_r() display null in php
- Delete post meta by serialized meta value
- Create a temporal post
- add custom link to gallery images
- How can I copy an ACF field to AIOSEO field? [closed]
- How to find php variable of wordpress theme settings
- Date of last blog update for specific authors only?
- I was wondering if it’s possible to implement card.js on WordPress
- Ajax call URL 404’ing when pushed to staging server
- Modify arguments for parent theme’s `wp_register_style` via child theme
- WordPress Rewrite Issue
- Replace content in WordPress Page after GET from php page
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- When I use rewind_post() it shows menu items in my loop
- How to create categories out of a list of words?
- Difference between php memory limit and wp memory limit?
- Custom Filtering date with newsletter
- WordPress critical error after trying to update to 6.2 – Fatal error: Allowed memory size of 268435456 bytes exhausted