WordPress.org

Ready to get started?Download WordPress

Forums

Questions About The Loop (2 posts)

  1. RunningSpirit
    Member
    Posted 9 years ago #

    Start from the begining.

    I want my entrys to show up on my site [www.running-spirit.net]. My blog is on its own sub-domain [www.running-spirit.net/b2]. I found a reply to another post with a way to do it. I posted what they said to do at the bottom. Now when ever I click on the comments it brings my blog up in the iframe. How can I get it so it'll just bring the comment page up?

    ---> How I got my entrys to show up in my ifame.
    OK, here is a quick and "dirty" solution for your website. Maybe I'll write up a full tutorial on this later, but for now the essential steps for you.
    1. Delete the index.php what you have now at the root of your site (the one showing the errors)
    2. Open your index.html (the main page) and the index.php from the classic theme (wp-content/themes/classic/index.php)
    3. A little bit of code reading:
    - you have "contentcontent" div with manually updated news
    - you want to replace it with the 'content' part of the WP, basically with The Loop
    - even if you are reluctant, you have to take a look at it; it starts here:
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    ...
    and this is the end of it:
    <?php endif; ?>
    - in between, even if you are like me, i.e. not knowing anything about PHP, you can see a lot of template tags with pretty much intuitive names, like: the_date; the_permalink; the_title; the_content; the_category etc.

    4. Save your index.html as index.php (do I need to say backup everything?)
    5. Now we'll edit this new index.php file:
    - in the "content" div you have 3 elements:
    <div id="contenttop">
    <span class="updateinfo">
    <p class="updatecontent">
    - clean it up, leave only ONE instance of these elements, and delete the text from them
    - WP is going to put p tags around the posts, so let's change the last element into div class="updatecontent">
    important! at the very top of the file, before anything put these lines:
    <?php
    require('./blog/wp-blog-header.php');
    ?>
    /blog/ is necessary because your WP installation is in that directory under the root, right?
    6. "Importing" stuff from WP's classic index:

    - Copy/paste the beginning of the Loop right under your "contenttop" div, like this:
    <div id="contenttop">News and Updates</div>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    - Next in WP is the_date tag, copy/paste into your span for time:
    <span class="updateinfo"><?php the_date('','<h2>','</h2>'); ?></span>
    (or use the_time, whichever fits you, more reading in Codex > Template tags)

    - Copy the remaning part of the Loop starting from:
    <div class="post">.....
    down till
    <?php endif; ?>
    into your <div class="updatecontent">

  2. moshu
    Member
    Posted 9 years ago #

    I don't really understand what are you doing here...
    You copied my post from here into your post above, without making any sense of it. That reply was about the OP's own site and a solution for his special situation, using the markup from his index page.
    Why did you copied it here... it's beyond my understanding.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags