WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Show multiple static page content on homepage only (5 posts)

  1. mcederberg
    Member
    Posted 1 year ago #

    Hello,

    I have a static homepage on my site and am trying show the following content on this page only:

    1. The content of a static page ("About")
    2. An include in my site (running some custom code)

    Can someone help me with this? Many thanks in advance!

  2. Upeksha Wisidagama
    Member
    Posted 1 year ago #

    1. Go to WordPress Admin > Settings > Reading

    2. Select 'A static page' under 'Front Page Displays'

    3. Select 'About' page from the dropdown box next to 'Front Page:'

    4. You are done!

    5. Will you be able to explain a little bit more on the 2nd requirment. i.e. what did you mean by 'an include in my site'?

  3. mcederberg
    Member
    Posted 1 year ago #

    Thank you! So I have my static front page setup and functional, but I need to include other static pages on it - if that makes sense.

    For the include, I have some dynamic content currently in php file that I want to run only on certain pages. Can I do this? This is what I meant by "include"

    Thank you!

  4. Upeksha Wisidagama
    Member
    Posted 1 year ago #

    1. Make a new template file in theme directory.

    /wp-content/themes/your-theme-folder/

    1.1 Duplicate single.php file or relavant template file used to display the about page.

    Learn more about templates: http://codex.wordpress.org/Templates

    1.2 Add "Template Name: Custom Template" as a comment in the beginning of new file, making it a new template file.

    /**
     * Template Name: Custom Template
     */

    1.3 Add your custom php code file using require 'your-file.php' at the correct line of your new template.

    2. Edit the about page visiting WordPress Admin > Pages

    2.1 Change "About" page template from 'default' to 'Custom Template'

    2.2 About page now displays the custom code output.

  5. mcederberg
    Member
    Posted 1 year ago #

    This worked great, thanks a lot!!

Topic Closed

This topic has been closed to new replies.

About this Topic