WordPress.org

Ready to get started?Download WordPress

Forums

Pages included in themes without having to create them (3 posts)

  1. kwbock
    Member
    Posted 1 year ago #

    I'm working on a project that involves creating a custom child theme. There are a handful of pages that I want to have included automatically and not in the database (similar to front-page.php). Is there a way to do this in WordPress?

  2. ChristiNi
    Member
    Posted 1 year ago #

    Hi kwbock,

    front-page.php is a template file used for your latest posts or a static page (as set in the Front page displays section of Settings -> Reading in your dashboard). It doesn't actually contain any content, it has the hooks to pull the content into the template file. In WordPress, all content is stored in the database, not in the template files. The template files simply provide the structure for your content.

    Hope this helps to clarify pages and content.

  3. kwbock
    Member
    Posted 1 year ago #

    I understand the nuance of the front-page.php and that content is stored in the database. What i'm wondering is if there's a way for theme to register a url and a template that goes with it so that any time the theme is installed (even on a fresh install) that that page is accessible via the registered url.

    For instance I have a custom page that is listing some posts in a specific format it's accessible right now via /list-page/. Currently it is a Page, that i have told to use my list-page.php template. And inside of that template i pull Pages based on specific criteria through query_posts function.

    As it is right now, any time i add a Page that i do not want to appear in that list, i have to go in and add the id to the array that excludes the Pages from the query_posts function. I would rather not have a bunch of empty posts in the database (no content) whose only purpose is to render a template.

    If this is possible please let me know.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.