Conditional menu display
Is your home page blog index or static page? is_home() is meant to check if we are on blog index (latest posts), while is_front_page() checks if home is static page set in Settings > Reading.
Is your home page blog index or static page? is_home() is meant to check if we are on blog index (latest posts), while is_front_page() checks if home is static page set in Settings > Reading.
When a theme has the front-page.php template, it will take over regardless of what you set in the admin pages to be your front page. 1 This means you have a couple of options: Create a page template with your loop and styles that are currently part of front-page.php, apply that template to a new page … Read more
Switching the actual template file could work in the same way as above using get_template_part(). For example… <?php if ( wp_is_mobile() ) { // If it is a mobile device get_template_part( ‘mobile-front’, ‘page’ ); } else { // If it is not a mobile device get_template_part( ‘desktop-front’, ‘page’ ); } // end wp_is_mobile() To take … Read more
You can use following: update_option( ‘show_on_front’, ‘page’ ); update_option( ‘page_on_front’, ‘0’ ); I hope this helps.
In WP, you first need to understand the template hierarchy https://developer.wordpress.org/themes/basics/template-hierarchy/ So as per hierarchy, — front-page.php — home.php / custom page template. If you have front-page.php , then please check which header file it is enqueuing. If there is no front-page.php then check home.php exist in your theme file. If yes check which header … Read more
In Settings -> Reading -> Front page displays select Your latest posts. Go to Appearance -> Menus. You’ll see as the first item Home, which points to the physical page ‘Home’. Remove Home item from the menu. Expand Custom Links. Enter / ( right slash ) into URL field. Enter Home into Link Text field. … Read more
To make sure that the index.php will be loaded first add the following line to your .htaccess: DirectoryIndex index.php index.html This tells Apache to ignore an index.html if an index.php exists.
Don’t use query_posts. Use a filter on pre_get_posts. function no_front_sticky_wpse_98680($qry) { if (is_front_page()) { $qry->set(‘post__not_in’,get_option( ‘sticky_posts’ )); } } add_action(‘pre_get_posts’,’no_front_sticky_wpse_98680′); By running query_posts you clobber the main query, over-writing it with another query. That is why you break pagination. The new query gets out of sync with what should be the main query.
you have to use the WP Loop to get page content. Try this <?php /* Template Name: home */ get_header(); ?> <div id=”theme-main-banner” class=”banner-three gradient-banner-three”> <?php while(have_posts()): the_post(); ?> <?php the_content(); ?> <?php endwhile; ?> </div> <?php get_footer(); ?> UPDATE The issue was that front-page.php was already present in the theme. So as per the … Read more
You can use the wordpress template hierarchy to do just that. Specifically, you can put the code you want in front-page.php and then use index.php for the rest of them, though that’s a rather bland way of doing design with what you have on your hands. Alternately, there are the wordpress conditional tags which can … Read more