How can I edit the content in index.php?

I want the start page to be editable from a template. At the moment I can only edit the content by directly editing the HTML.

Setup:

Read More
  • Settings » Read » “Front page displays Your latest posts”
  • The template that shows in the startpage is index.php

I want to be able to create a page edited from the Pages list that will show as the start page.

I’ve tried to create a new page called MyStartPage. Set its template to Startpage (index.php).

I’ve tried setting Settings » Read » Front Page displays Static page MyStartPage

I’ve made sure the index.php has The Loop that makes the calls to get Title and Content as is working in other templates.

Related posts

2 comments

  1. If you are editing a theme or you are having a child theme, You can make your own custom template, give it a name Include header and footer in it using

    <?php
     /**
      * Template Name: Home Page
      * 
      * Home page Layout
     */
     get_header(); ?>
     <!-- Do whateveer you want here -->
     get_footer(); ?>
    

    When you create a page in backend you’ll get an option to select the template for the page i.e Home Page, assign the template you just created
    Home Page Template

    and set this page as home page from settings.

  2. Rename it to front-page.php. That one is loaded on the home page before attempting to load home.php, regardless of your “Read” settings.

Comments are closed.