WordPress.org

Support

Support » Themes and Templates » [Resolved] Inserting page content in custom WordPress theme

[Resolved] Inserting page content in custom WordPress theme

  • Let me start by saying: I’m in the process of trying to build my first custom theme from PSD to WordPress, so all of this fun php coding is really new to me.

    I’ve already built the index.php page, separated off the header, sidebar, and footer, and now I’m trying to figure out how to display content. I’ve found a lot of tutorials and info on how to display post content, but I’d prefer to display page content instead. What codex would I have to insert into my content div to display my pages?

    The test website can be found here: http://abitofbrit.com/w/index.php – I want to display the page content in the large box at the top. Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • I figured it out. 🙂

    PS,
    For anyone wondering the answer to this, I inserted the loop into the content div. Then, I had to change my homepage to a static page by going to Settings>Reading and then assigning my homepage to a “page” I created. I also assigned my blog (“posts”) to a different “page.”

    Problem solved!

    So, I have the same question as you – how to insert specifically page content onto a page (I’m also working with one of my first custom templates), instead of displaying a post on a page. I have successfully displayed different posts on different static pages with the loop and a query that included category info, but can’t seem to figure out how to display page content on a page…

    my code:
    <div id=’main-content’>
    <?php if (have_posts()) : while (have_posts()) : the_post();?>
    <?php the_content(); ?>
    <?php endwhile; endif; ?>
    </div>
    I’m sure I’m missing something…also, I know for posts one must call the header and ‘the_post’, is there a similar thing with ‘the_page’?
    I tried futzing with that but I really don’t know what I’m doing.

    If this is a problem you solved, could you share how exactly you did it?

    Many Thanks!
    jmar

    Jmartin01,

    You may receive greater help if posted in your own thread.

    I’ll take that advice, thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Inserting page content in custom WordPress theme’ is closed to new replies.
Skip to toolbar