I don’t think there is need to mess up with index.php or any other file for creating a static home page.
You can create a static home page by following these steps:
first publish the page from wp-admin, then go to settings >> reading >> front page displays >> a static page >> select your page from the list.
That said, if you have some special requirements for your home page and need to write custom code then you should create a new file as front-page.php
in your theme. The content of this file could be like:
<?php get_header(); ?>
<!-- all your custom code can go here -->
<?php get_sidebar();
<?php get_footer(); ?>
Related Posts:
- How to place HTML tags in content from the_content()?
- WordPress page/blog incorporated into static website
- Add a dropdown to theme customizer
- Editing the custom background CSS
- What is the problem if I use CDN in my WordPress parent theme(built using bootstrap)?
- What, specifically, should be included in theme_name_setup()?
- Is it possible to use line break in theme description?
- Grab the first paragraph of each post
- Symlink a directory to wp-content/themes
- How to check if post has any tag?
- What are WooCommerce starter themes? [closed]
- How do I “unhook” / de-register jQuery so that it’s not called as part of wp_footer();?
- How to disable the gradient and font size internal CSS added by WordPress when using theme.json
- Which is the simplest theme for WordPress to use it as your base?
- “Cheatin’ uh?” error message on multple theme directories
- Adding WordPress colorpicker in widget settings
- A theme that follows all the best practices to learn from?
- How do I display the “Archives” widget layout (sidebar) in WordPress by ‘year’ then by ‘months’?
- get_post() function returns post even if it is trashed
- How to highlight the current page in the nav menu?
- How do you protect a premium theme from being copied?
- “Display Site Title and Tagline” checkbox not working?
- Add social icons in a theme through custom admin menu
- file_get_contents Not allowed in Themes?
- Can wordpress run in root of existing php site with no theme on index.php but all other WP posts/pages?
- How can one update a theme on a live site without interruption?
- Sub folder CSS that’s read by Admin panel
- How do I remove twentyten without ruining what I did?
- Custom theme not visible in Appearance
- Some doubts about how to show posts in a custom theme?
- Dequeue a style file which is making website load slow!
- Developing WordPress Theme using CSS framework like Bootstrap
- WP_Customize_Color_Control omitting # symbol
- Theme translation not applying
- How to add filter the post thumbnail before save in database?
- Storefront child theme not applying parent theme [closed]
- How to add Space between sidebar and footer widget in WordPress theme [closed]
- Theme Inspector “X-Ray”
- Acivate all themes multisite wide automatically
- Call to undefined function add_menu_page() on theme activation
- WordPress Theme Creation [closed]
- What is the meaning of WordPress’s recommended css classes and where are they applied?
- The Content is not Wraping in tag
- Integrate WooCommerce theme with a WordPress theme [closed]
- Automated Footer information
- How do you use WordPress for a website that’s not in a blog format?
- Is it acceptable for a WordPress theme to not accept widgets?
- Should all references to a text domain be to my current theme?
- Managing WordPress Theme
- Simple child theme modification but links are broken
- Making a WordPress theme based on twentyten
- Want to add cart and a search bar in the right of logo line
- How to track a users last visited page?
- In a Gallery with limited image posts, how do I not limit images on single post?
- LESS not working in WordPress [closed]
- How to add custom page elements to the WYSIWYG editor?
- best practices for updating wordpress theme
- Why I obtain different visualization when I run the website on my local machine and on remote server?
- How to use the _S framework
- Open portfolio image in light box
- Let visitors show/hide a type of content
- Best practice for implementing a blog page / section in wp_menu_nav()
- How to modify theme content in Thematic?
- how to add a badge on product based on filter?
- Host Private Custom Theme
- how to create/register menu items that can be added to menus later
- Why nav_menu_css_class doesn’t work with apply_filters?
- WordPress and Semantic UI
- Copying a modified theme from one wordpress site to another wordpress site [closed]
- How can I change this SVG shape that’s generated?
- Theme does not allow shortcodes
- Text widget is placing everything side by side. I want to post it above
- What is an alternative to not using child theme to customize a WordPress theme?
- How to show some of category in wordpress
- using themename_the_custom_logo() in template-tags?
- Menu names not getting translated
- How to generate a rtl.css file for themes?
- Get property of non-object on theme activation
- change wordpress website logo url [duplicate]
- Custom page template not showing on page creation
- wp_editor some functionality not working on custom theme
- Update modified Shopify third-party theme [closed]
- hide/show a div in wordpress
- Providing updates to your WordPress theme
- One-Page WordPress Template
- How one category can have different fields?
- How do child themes work?
- Strip HTML tags on custom code from the_content
- Fail to install theme on development copy of WordPress on Webmatrix
- How to prevent XSS attack in wordpress theme?
- Featured Image Module Randomly Disappears
- adding navigation to genesis themes
- Add Dynamic Sidebar to Exisiting WordPress Theme [closed]
- How can I install my custom-made theme on a wordpress.com blog? [closed]
- Turning WordPress Into full-featured website?
- Why am I getting posts back when I shouldnt
- .submenu class missing in output from wp_nav_menu
- How to automatically set a Template Page Name next to a page in menu screen such as WooCommerce pages, front page, or posts page in wordpress?
- Return the_content() with custom div class for a subset of posts
- How do I send out an update for my custom wordpress theme?