WordPress.org

Ready to get started?Download WordPress

Forums

Loading date and title in a different zone than the content (3 posts)

  1. karlotta
    Member
    Posted 5 years ago #

    Hello!

    This is awfully complicated, so I don't know that anyone can help me, but just in case:

    I only show 1 post on my index page. That page is made outside of WP, and the content from WP is loaded into the page through a php include (I removed header and footer).

    The css div that contains the php include must only show the post (usually, a photo). But I would like to show the date and title of the post on the page too, just NOT IN THAT PHP INCLUDE (in the css div that's right below it.)

    Is that possible?

    Here is my html right now:

    <body>
    <div id="frame1">
    blablabla
    </div>
    <div id="include">
    ###########This is where the WP content loads through the index.php template which looks like this:#########
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="storycontent">
    		<?php the_content(__('(more...)')); ?>
    	</div>
    
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>
    #######end of the php include######
    </div>
    <div if="frame2">
    This is where I'd like the title and date to show.
    </div>

    See what I mean?

    Is that doable?

    Many thanks for any help you can give me!

    PS: if you want to see my website, it's at http://www.karlotta.com

  2. scribu
    Member
    Posted 5 years ago #

    It's not so complicated. :)

    I assume that this is the index.php from your theme directory.

    If you can write <?php the_content ?>, you can also write <?php the_date(); the_title(); ?> etc.

  3. karlotta
    Member
    Posted 5 years ago #

    Thanks - that wasn't working, though, since the div in which I was trying to have the date show wasn't part of the WP template. It was breaking the loop. I re-coded the whole entire site so that it would work - now the whole site is in WP!

    Thank you for replying!

Topic Closed

This topic has been closed to new replies.

About this Topic