• Is it possible to have certain sections of the front page on other pages (or possible to make another page with the front page template, but have different content).

    My website is ihiqueens.com

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi @fvirga,

    Unfortunately we don’t support display certain sections on extra page. They are displayed on Frontpage only.

    Let me know if you need anything else!

    Hi there!

    Edit: Sorry! I found this topic via Google search and didn’t realize it’s about the OnePress theme.
    I had the same problem with the Twenty Seventeen theme and used the following workaround:

    1.)

    Create a child theme and copy the parent’s “front-page.php” to a single page template, that is: “The template file used to render a static page (page post-type).”
    with the name: page-{slug}.php

    Let’s say: Create a static page with the slug “section”, WordPress will try to use single page template “page-section.php” to display that static page.

    If you use the parent’s “front-page.php” for the single page template “page-section.php”, your static page with the slug “section” will be displayed through the front page template and thus have the front page layout.

    So when you enable and set page sections for the front page within the theme customizer, then those sections will appear on your front page and on your static page with slug “section”.

    2.)

    Disable display of page sections for your front page:

    a) Copy the parent theme’s “front-page.php” into your child theme directory.
    b) Don’t change the name
    c) Edit the file “front-page.php” as follows:

    find the line:
    $num_sections = apply_filters( 'twentyseventeen_front_page_sections', 4 );

    set $num_sections to 0:
    $num_sections = 0; // apply_filters( 'twentyseventeen_front_page_sections', 4 );

    So you can move the display of page sections from your front page to another static page. But you still have only one single configuration of sections to be shown within the theme customizer. To have more than one sectioning setup, you have to completely re-design the Twenty Seventeen theme.

    Maybe I could help anyway,
    Martin

    • This reply was modified 7 years, 2 months ago by mmue.
    • This reply was modified 7 years, 2 months ago by mmue.
    Thread Starter queensihi

    (@fvirga)

    Thanks! I’ll try it out

    tapcrobert

    (@aprobert)

    Hi @mmue

    Apologies but I’m finding your steps a little hard to follow but I know this is what I need in order to edit my website, is there any way you could type this in a more amateur-friendly manner?

    Regards
    Rob

    I also find it a bit hard to follow.

    Create a child theme and copy the parent’s “front-page.php” to a single page template, that is: “The template file used to render a static page (page post-type).”
    with the name: page-{slug}.php

    Does that mean: Copy “front-page.php” from folder “twentyseventeen” to folder “twentyseventeen-child” and then rename the copied file to “page-{slug}.php”?

    Hallo @aprobert,

    your question was a bit too inaccurate, so I didn’t know where to start “amateur-friendly”.

    That’s why I hope you know how to create a child theme (https://codex.wordpress.org/Child_Themes) and I answer @krlklm’s question:

    From scratch, your child theme has 3 items:
    the child theme DIRECTORY, I called it “twentyseventeen-child”, therein:
    style.css
    functions.php

    Wordpress uses different template php files (stubs) to display the site. All those template php stubs are in the theme directory \wp-content\themes\twentyseventeen\

    There are:
    front-page.php – to display the front page
    page.php – for displaying ALL static pages
    single.php – for displaying all single posts
    and so on

    When you create a static page “Imprint” for your imprint, your “About us” page or something like that, you have several fields to fill in the wordpress editor.
    If you set the page name “Imprint” and save that change then two other fields are automatically filled with “imprint” but can be changed:
    – the permalink
    – the “slug”, (in German wordpress backends its called “Titelform”), way down to the bottom of the page

    This slug field is maybe NOT shown, until you check-mark it in the “Ansicht anpassen” (edit view) dropdown at the top of the page.

    And here’s the trick:
    If you create a template php stub and give it the name “page-imprint.php”, your Static page with slug “imprint” is beeing rendered using this stub.

    In general: a static page with slug “Hallo123” is rendered by the stub file “page-Hallo123.php”, if that stub file exists. If it doesn’t exist, wordpress uses the “page.php”

    So, if:

    (1) If you take the page.php from the original twentyseventeen theme directory, copy it to your child theme directory and edit minor changes/adjustments in it, then ALL your pages will show those edits.

    (2) If you take the page.php from the original twentyseventeen theme directory, copy it to your child theme directory and change the name to “page-imprint.php” then only your imprint will show your edits.

    (3) If you take the “front-page.php” from the original twentyseventeen theme directory, copy it to your child theme directory and change the name from “front-page.php” to “page-section.php” then only a static wordpress page with the slug field set to “section” will be displayed in the frontpage style.

    So I did the following:

    First I took the file “front-page.php” from the original twentyseventeen theme directory, copied it to my child theme directory and changed the name from “front-page.php” to “page-section.php”. Then I created a static wordpress page with the name “Hallo!” and the the slug field set to “section”.

    So this page “Hallo!” showed other pages as sections. Unfortunately you set those sections under design -> customizer -> theme options for your whole wordpress site.

    So you have to disable the sectioning for your frontpage as I show at topic 2 of my post:

    Once again I took the file “front-page.php” from the original twentyseventeen theme directory, copied it to my child theme directory but did NOT rename it.

    And in this child theme version of the “front-page.php” I disabled the sectioning by setting the $num_sections to 0:
    $num_sections = 0; // apply_filters( ‘twentyseventeen_front_page_sections’, 4 );

    Ahm, I’m not sure if it’s really much clearer now… 😉

    CU Martin

    Hello Martin,

    thanks a lot for taking the time to explain your approach in such a great detail! I will try this out tomorrow and will give feedback asap.

    Best,
    Karl

    So i gave it a try. Everything worked like you explained. But i found out, that it doesn’t do what i need. This is what i want to accomplish:

    Lets say i have two main menu items, e.g. Animals and Cars. Each of these have three menu sub-items:

    Animals
    – Apes
    – Cats
    – Dogs

    Cars
    – Mercedes
    – Tesla
    – Volkswagen

    If a user clicks on “Apes”, it should show the page “Apes”, and scrolling down it should also show the pagees “Cats” and “Dogs”, as it does with the frontpage sections in the default Twenty Seventeen theme. If the user clicks on “Tesla” he should land on the page “Tesla”, but be able to scroll upwards towards “Mercedes” or downwards towards “Volkswagen”.

    In other words, i would need the frontpage section functionality for each of my main menu items. It seems like i have to dig deeper into the customizer and see if i can duplicate the theme options menu, so i could choose the sections for each of my main menu items.

    Any ideas are appreciated.

    Thanks again Martin for your exact tutorial.

    • This reply was modified 6 years, 11 months ago by krlklm.
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Front page section on other pages’ is closed to new replies.