WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Problems with parent pages and templates (16 posts)

  1. canutedechou
    Member
    Posted 3 years ago #

    im creating a site
    wicth have a section and subsections inside
    each part has a diferent template, and thats easy
    for example, the main page is

    /services

    and a subpage is

    /services/service1

    but, when i create the subpage (service1) and apply service as a parent
    it doesnt show the template im choosing to use
    but, if i apply that subpage (service1) without services as a parent page, its working fine, and the template is working great

    the template of the subpage starts with:

    <?php
    /*
    Template Name: Service1
    */
    ?>

    any idea of whats happening?

    EDIT:

    u just fint out something really weird
    the problem is not in the template is in the url that wordpress is creating.
    for example i just go to the parmalinks options an set the links at the default option like ?p=123 but i want to use a special structure, just like "services/service1" so i go to "custom structure" and apply "/%postname%/". when i do that, the template stop working, but if i set the permalinks on defaults, its working fine

    any idea? i suppose that is something on the custom structure

  2. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    Don't use /%postname%/ as your PrettyPermalink structure.

    Use one of the date-based options. You'll save yourself some headaches.

  3. canutedechou
    Member
    Posted 3 years ago #

    yeah, i just realize that reading on codex
    but, how can i create friendly url without dates and without /%postname%/?
    like:

    /services
    /services/service1
    /services/service2

  4. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    All of the available options will append /%postname%/. The issue is with using /%postname%/ alone.

    If you use, e.g. "Year, Month, and Name", your permalink structure will be:

    /%year%/%monthnum%/%postname%/
  5. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    Edit: I guess that option is called "Month and Name".

  6. canutedechou
    Member
    Posted 3 years ago #

    yes, i was cheking that on permalinks options at wordpress panel, but the problem is that i cant use those kind of url, i need a more friendly name at the url bar on the explorer

    for example

    domain.com/service/service1
    and no:
    domian.com/2011/service

    but i was thinking
    i can apply the default permalink ?p=7 and use a plugin to create url for each page? or something like that?

  7. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    The Pretty Permalink structure indicated does not add year/month/etc. to Pages, but rather only to Posts.

    Pages are by definition static, and not date-based. WordPress is "smart" enough to differentiate between Posts and Pages in this manner (in fact, it is this very differentiation that allows the entire MOD_REWRITE rules to work in the first place - and why it causes such a performance hit not to append dates to the Post permalinks).

  8. canutedechou
    Member
    Posted 3 years ago #

    i get that
    and i just apply /%year%/%monthnum%/%postname%/ to the permalinks
    the problem is that
    when i create a page inside services, for example
    services/service1
    that page that has a parent is not using the template wich i declare, but, if i say that service1 is NOT a parent of service, the template is working
    how can i make that the subpage use the template?

  9. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    What Page Template have you assigned to the Page in question?

  10. canutedechou
    Member
    Posted 3 years ago #

    i have two pages, one is services, and another (lets call it "service1") is a subpage of service, for example

    /service
    /service/service1

    so, service has a template, and its working great
    then, i create service1 and apply another template and i declare that service1 has a parent wich is service

    when i apply that parent
    the template stop working, in fact, i thought it was a template problem, so i just apply the default template, and its happening the same, the template is not being showed

    (sorry, my english is not ver good)

  11. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    If you apply the default Template (i.e. "page.php"), does the Page render using that default Template?

    What is the name of the PHP file in which you have defined your custom Template (i.e. "page-foobar.php")?

  12. canutedechou
    Member
    Posted 3 years ago #

    no, if i apply to service1 the default template with service as a parent it doesnt render with the default template

    the template name is
    page-inner-services.php and starts with

    <?php
    /*
    Template Name: Services Inner
    */
    ?>

  13. canutedechou
    Member
    Posted 3 years ago #

    something weird just happend
    i just apply another name to service1, and the template is working fine
    i dont get it

  14. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    I suspect that the problem might be related to the template hierarchy.

    (Although it should respect a custom-applied template file, as the custom-applied template should take precedence) a Page called "Foobar", with slug "foobar", will attempt to use a template file called "page-foobar.php".

    I would always name your Page template files according to layout (e.g. "page-one-column.php", so as not to cause potential collision with the Page name/slug that you use for your Pages.

  15. canutedechou
    Member
    Posted 3 years ago #

    well chip
    thanks a lot for the patience
    really

  16. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    Not a problem. Glad you got it sorted out!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.