Forums

[resolved] Code in page does not show up (5 posts)

  1. tdellaringa
    Member
    Posted 4 years ago #

    I've set up a custom template for one of my pages. This is for member pages of which I'm going to have like 50+. The template for the page is basically just a wrapper with no content.

    In wordpress, I create a page and set my custom template to use as the template.

    Then in the "code" section, I paste in code (some paragraphs and a picture) for the body of the page.

    But when I view the page, this code section does not show up on the page at all, which seems odd. When I view source, it is not there. I have saved the page - do I need to do something else?

  2. moshu
    Member
    Posted 4 years ago #

    The template for the page is basically just a wrapper with no content.

    If you meant there is no Loop in it - nothing will show up ever.

  3. tdellaringa
    Member
    Posted 4 years ago #

    Oh... no it has no loop. I thought if there was no posts, it didn't need a loop. What loop would I use? have_posts()? That doesn't quite make sense...

    Anyway I tried adding in

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    -- my content would go here --
    <?php endwhile; ?>
    <?php else : ?>
    <?php endif; ?>

    That didn't work either.

    I figured if the content was all static you didn't need anything else but content. Here is my basic template as it stands now:

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

    <?php get_header(); ?>

    <div id="wrapper-person">
    <div id="content">

    <!-- I want content to show here, entered in as "code" in wordpress interface -->

    <?php get_sidebar(); ?>

    <div class="clear"></div>
    </div><!-- /wrapper -->

    <?php get_footer(); ?>

    What am I missing?

  4. moshu
    Member
    Posted 4 years ago #

    Copy the Loop exactly from your page.php template.
    If there is no Loop how do you expect to retrieve the data that you put into the content = in the database.

    You have some misconceptions: Pages are entries as well into the database as the posts are. They just have different settings and they are not part of the chronological stream.
    A Page template needs a Loop:
    http://codex.wordpress.org/Pages#Page_Templates

  5. tdellaringa
    Member
    Posted 4 years ago #

    Thanks moshu - I get you now. I did misunderstand that, duh I should have made the connection to wordpress -> page needs to be there.

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.