Forums

[resolved] Using a Loop Need Variation from Post Preview Page to Post Full View Page (7 posts)

  1. optikinescant
    Member
    Posted 5 years ago #

    OK, I've set up wordpress, and for once I've decided on not using a template, and just using a basic loop to call 5 posts to my index page. Now, I'm using the 'more' tag so I can just have breif excerpts show up on the page, and the viewers will be able to click for more. I'd like to include some copy that will always be the same on the index page, but I don't want that copy to be there when the visitor is viewing the full blog/news article from one of the 5 posts. I'm pretty much a PHP newb so, I'm not sure what the best approach to do this is? Any incite on the problem? TIA!

  2. moshu
    Member
    Posted 5 years ago #

    1. You meant you don't use the theme system?
    2. What do you mean by "include some copy"?
    3. It seems you want 2 things in the same time: not using the theme system AND using its features (like single post view via a single.php template file) when seeing only one post.

    Well, there is no good approach to this...

  3. optikinescant
    Member
    Posted 5 years ago #

    1. correct
    2. I want on my main index page, a mission statement (just a few paragraphs of text), followed up by my 5 posts, but only in a excerpt form - but when you would click on the link to view the full post, you see only the full post, not the mission statement that exists on that page. Is that possible with some kind of simple conditional statement or have i dug myself into a hole I can't get out of?
    3. I didn't realize this was a feature specific to the theming system, that's why I'm hear asking this. I'd rather not have to get into themes just to get this working - but if I have no choice, I have no choice.

    Here's the loop that I have on my index page, if it's any help in getting me closer to my solution:


    <?php
    /* Short and sweet */
    define('WP_USE_THEMES', false);
    require('./wp-blog-header.php');
    ?>

    <?php if (have_posts()) : ?>
    <h3><span style="color:#9eb1c4;">Home »</span> <span style="color:#22517e;">News</span></h3><br>
    <?php while(have_posts()) : the_post(); ?>
    <div class="newsposts" id="post-<?php the_ID(); ?>"><p>
    <?php the_content('Click here for more »'); ?><br>
    </div>
    <?php endwhile; ?>
    <?php next_posts_link('« Previous Entries') ?>
    <?php previous_posts_link('Next Entires »') ?>
    <?php else : ?>
    <h2>Not Found</h2>
    <p>Sorry, but you are looking for something that isn't here.</p>
    <?php include (TEMPLATEPATH . "/searchform.php"); ?>

    <?php endif; ?>

  4. moshu
    Member
    Posted 5 years ago #

    Basically, it can be solved with a conditional, of course. I just don't have a clear picture about the whole setup. Is WP in the root directory or in a subdir?
    Are you editing the so-called "sweet and short" index? - hmmm.

    See the is_home tag:
    http://codex.wordpress.org/Conditional_Tags

  5. optikinescant
    Member
    Posted 5 years ago #

    It's in a subdir called /new/ I started with the sweer and short yes. Thanks for the link I'll look at it and see if I can get myself on the right track... Anymore advice on this is more than welcomed. Thank you.

  6. optikinescant
    Member
    Posted 5 years ago #

    WOOT. That helped a bunch all I had to add was:


    <?php if (is_home()) :?>
    <?php include("home/content/mission.php");?>
    <?php endif; ?>

    And that did the trick I owe you one moshu.

  7. moshu
    Member
    Posted 5 years ago #

    Glad it worked. Happy blogging.
    Could you mark this as resolved?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags