• Hi,

    I’m using a static page as my website’s front page. I’d like to have the same structure as page.php:

    <?php get_header(); ?>
    <?– code to display text read from the attaching static page –>
    <div>
    …………
    </div>

    <?php get_sidebar(); ?>
    <?php get_footer()); ?>

    I tried php include to get the text. Problems are:

    1. I don’t know where to get the text of the attaching page so I added a text file to provide the text;
    2. no formatting on the text; The theme defines the page setting I guess, I need to learn how to get them.

    Can experienced users help? I’ve seen a lot of you in actions helping newbies. Give me a hint, I don’t mind digging into the code. Many thanks in advance,

    Warren

Viewing 8 replies - 1 through 8 (of 8 total)
  • Wait, what? Can you give us a link to your blog?

    Thread Starter jaguarx

    (@jaguarx)

    do77,

    I’m still have everything running on my computer. So far I have two pages of articles. The first one called ‘home’ and assigned to the template cover_page.php which is just bare bone right now. The template will invoke a plugin for top menu bar in the future. In other words, I don’t really have much my own code for you to look at yet.

    Warren

    Thread Starter jaguarx

    (@jaguarx)

    do77,

    The code I ran to read a text file is:

    <?php
    if (is_page(‘home’))
    {
    include (TEMPLATEPAT, ‘/text.txt’);
    }
    ?>

    Warren

    no formatting on the text

    Since you are ‘including’ this file, you’ll need to add all of the necessary markup within the included file.

    Thread Starter jaguarx

    (@jaguarx)

    The included file is a page. Would it be better to keep only text in it and handle the markup as part of the template’s task?

    Warren

    The content of an included file isn’t parsed by the template.

    Thread Starter jaguarx

    (@jaguarx)

    Please bear with me a little. I understand the template doesn’t parse the included. I have to do whatever extra in the template to make formatting to happen. I simply want to keep a page content only for maintenance reason. Is the markup defined by the theme already at this point so the template can retrieve and implement it? Is it a better way than php include to do this?

    Warren

    All of the post content formatting is carried out by the_content() or get_the_content() functions. so, my best guess is that you’d need to write a function that parsed your file and then add that to the_content() using add_filter.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Please Help Me with Page Template’ is closed to new replies.