That may be normal behavior, depending on how exactly you’re using is_front_page
in your functions file.
If you use it inside the global scope of functions.php
, it will not work.
Why? Because WordPress loads functions.php
before the $wp_query object
has been set up with the current page. is_front_page
is a wrapper around around $wp_query->is_front_page()
, and if the query hasn’t been set up, it’s always going to return false (or throw a warning, if you have wp_debug
on.
From the codex:
Warning: You can only use conditional query tags after the init action
hook in WordPress. For themes, this means the conditional tag will
never work properly if you are using it in the body of functions.php,
i.e. outside of a function.
Related Posts:
- Setting a static home page and blog page without using the settings
- Edit a template while still keeping a Landing Page on the main address
- Where can I decide the number of posts to display on the blog index page?
- how to add version of style.css in wordpress
- What is the role and history of the $content_width global variable?
- Removing Shortcodes from Child Theme
- A minimalistic admin theme for a WP 3 install
- How to avoid loading style.css twice in child-theme?
- Change Default Image HTML
- why does bones theme call the_excerpt function with parameters?
- How can I develop a new theme in WordPress without disrupting the current site
- Move custom code out of theme’s functions.php file
- Error message “The page you are looking for is temporarily unavailable.” after editing a file [closed]
- A hook that runs only when the theme is previewed
- WordPress theme with multiple color schemes
- How can I have case-sensitive theme directory names when installed with Composer?
- Theme information in style.css being corrupted
- Toolbar/topbar missing on homepage only?
- Two Navigation Menus – secondary nav is including main nav
- Themes—Child Themes
- Protect changes made to the theme when updating
- When can changing a theme damage a website?
- how to add custom fields in page
- My scripts-bundle.js file is getting sent to the browser as a stylesheet css file. Help!
- What is the major difference between child theme and normal theme
- variables in translatable text
- Load a different theme for IE less than 9
- Theme Check reporting an incorrect theme slug and text domain
- Understanding Theme specific Code
- Style the archives/category sidebar widget via theme
- I get the following message The uploaded file could not be moved to /home/reascom/public_html/wp-content/uploads/2012/07 [closed]
- Custom CSS doesn’t work in edit mode
- Remove transparancy in Sydney theme’s headerimage
- Twenty fifteen theme – change responsive menu condition
- Getting 503 on various files
- Port existing Bootstrap site to WordPress?
- stylesheet is not readable error after installation
- GPL and intellectual or exclusive ownership
- Updating / Transferring site
- Putting two themes together to create a complete site
- WordPress root directory change + Theme directory change
- How to dynamically change theme’s slogan from admin?
- Icons not showing [closed]
- How do I understand which page of my theme is being loaded?
- What Generated Classes and IDs That Is Always Used On All Themes?
- Adding Sidebars in WordPress Theme
- Error 404 for JQuery import “jquery-1.10.2.min.map”
- Passing dynamic options from backend to frontend
- simplified explanation on child themes?
- Calling external Libraries in WordPress
- Using the same database on another Subdomain
- WP HTML Templates – Any way to get bloginfo() or the path to the theme folder?
- How to add more default colors?
- On a Https site, Css and Js Url are back to http after redirect the site
- Theme folder doesnt exist
- WordPress activate theme error $pagenow
- Increase content area width in TwentyFourteen [closed]
- Undefined variable error in theme option after updating theme [closed]
- Comments not displaying after changing theme
- Theme Translation?
- Two column layout in WordPress?
- List of categories instead of dropdown menu selector in admin options
- WordPress doesn’t recognise created theme
- Query for all themes?
- How can I show some standard html code across any theme I install?
- Losing theme customization when switching from a theme to a child
- Problem of not changing the front and bottom of the Woodmart template by activating the really simple ssl pro plugin in WordPress
- Please help me clear my confusions about WordPress
- Why does an ad page open when I browse my websites’s wp-admin page?
- What is the correct way to set up a staging server and use github for version control?
- How do I use the default style for widget?
- WordPress fails to embed video URL on specific theme
- Unable to set social icons using Advance Portfolio Theme
- How can I theme or style the lost password page without a plugin?
- Dynamic image for Jumbotron on WordPress Custom Theme
- How to implement theme option to change bootstrap 4 container from .container to .container-fluid
- how make wp include urls as https?
- how to costume title single page
- use a Thumbnail size in post
- Why does WordPress Editor Only Use Half the Box?
- 500 Internal Errors
- Installing Theme from uploaded file. Not uploaded theme?
- Where can I find a theme that has a big banner
- Strange Theme Error – parent style occasionally showing though child theme
- WordPress theme not updating in Other browsers
- WP-CLI wp theme install url PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature
- Site broken after deleting inactive themes [closed]
- Can i add wordpress editor to my custom theme option? [closed]
- Where do URI files come from?
- Converting HTML5 to XHTML
- Best way to include pagination in a theme [closed]
- What happens to bespoke page template references on theme change?
- Stylesheet not being loaded? [closed]
- How to change the standard width of a page
- I need to disable responsive feature of a theme called Meet GavernWP [closed]
- how to add dynamic footer credit in Greatmag theme [closed]
- Absolute and relative paths
- Get header/footer list for a theme
- Fatal error Class-wp-hook, again, but not sure what’s triggering it
- How to remove pop up on website (css changes not visible)?