WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Inserting page content in custom WordPress theme (5 posts)

  1. abitofbrit
    Member
    Posted 1 year ago #

    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!

  2. abitofbrit
    Member
    Posted 1 year ago #

    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!

  3. jmartin01
    Member
    Posted 1 year ago #

    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

  4. Andrew Nevins
    Barrel Rider, Spam Zapper & Volunteer Moderator
    Posted 1 year ago #

    Jmartin01,

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

  5. jmartin01
    Member
    Posted 1 year ago #

    I'll take that advice, thanks

Topic Closed

This topic has been closed to new replies.

About this Topic