1

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:

  • 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.

7
  • See also this post I recently wrote, explaining the differences Commented Oct 21, 2013 at 12:30
  • Im reading your links but im not getting what i should do.
    – Daarwin
    Commented Oct 21, 2013 at 12:45
  • 1
    See also: WordPress Template Hierarchy Commented Oct 21, 2013 at 12:49
  • Thats quite a lot altogether. Although i will read it all to understand better, is it possible you could guide me on how to fix it for now?
    – Daarwin
    Commented Oct 21, 2013 at 13:15
  • "is it possible you could guide me on how to fix it for now?" That is what I attempted to do, with the linked blog post. StackExchange sites are not really designed to handle such queries. Commented Oct 21, 2013 at 13:16

2 Answers 2

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
  • THANKS! It works. BUT the page i created shows in the menu as well as being the startpage. This is not ok. Can i make it unvisible from the menu except being the home?
    – Daarwin
    Commented Oct 22, 2013 at 11:45
  • Sorry. The page has to show ofcourse. There was already a homeapg link at the start menu but it was hardcoded so i removed it.
    – Daarwin
    Commented Oct 22, 2013 at 12:01
-1

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.

3
  • 1
    Of course index.php is a valid template. It's the default fallback template file for all contexts. Also, home.php is only used to display the blog posts index, regardless of whether the blog posts index is set to display on the site front page or on another page. Commented Oct 21, 2013 at 12:28
  • I think someone hijacked the one trick pony account.
    – kaiser
    Commented Oct 21, 2013 at 12:52
  • 3
    Well thank you, that's flattering :) But I do make mistakes sometimes, just like everybody else Commented Oct 21, 2013 at 12:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.