• Resolved andy3000

    (@andy3000)


    I am modifying the index.php file of an existing blog.
    The blog is set to display latest post on the front page.

    I had started to copy the index.php file into a custom template with the thought that I could make a draft page using that template and check how things would look as I modify the template. Of course the draft page doesn’t display any posts as it is not set up as the blog page.

    Is there an easy way around this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The page template to modify is not index.php but one of the page templates included with your theme such as single.php. category.php, page.php, depends what your Home Page setting is, and what you have setup on the blog..If you want a custom Home Page, you set a (already created) page as your home page, create a new page template based on page.php (of default theme, templates vary by theme), and assign that template to the assigned home page in the page editor.

    All this work is best done in a Child Theme (to not lose your edits on theme update)

    Note: PHP cannot be included in the page editor directly.

    Of course the draft page doesn’t display any posts as it is not set up as the blog page.

    Is there an easy way around this?

    for testing, add a line with query_posts() before the start of the loop (strictly for testing only; for real loops in page templates, the query needs to be a bit more sophisticated);

    something like:

    <?php query_posts('posts_per_page=5&cat=0'); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Build copy of index.php on draft post’ is closed to new replies.