Forums

Website Excerpt Integration (11 posts)

  1. olajideolaolorun
    Member
    Posted 5 years ago #

    I have looked around for support and also plugin but can't find any so if someone will please help me with this question.

    How can i place excerpts of blog posts on the main website and get the link to it to go to the blog post..

    Understand?

  2. doodlebee
    Member
    Posted 5 years ago #

    instead of <?php the_content(); ?> you need to use <?php the_excerpt(); ?>. (In your index.php file.)

    this might help you.

  3. olajideolaolorun
    Member
    Posted 5 years ago #

    no.. you see i'm trying to pull it to my main website that is not part of wordpress... thats the main problem... can you help...

    I'm trying to get the excepr tand put it ont he main website that is no part of wordpress. how can i do that.

  4. doodlebee
    Member
    Posted 5 years ago #

    You need to force the non-WordPress page to recognize the WordPress files. Is your index page a php file? (index.php, for example?) or is it HTML?

    If it's something like "index.html" it won't work. But if it's a PHP file, you just need to place:

    <?php require('SERVER PATH TO/wp-blog-header.php'); ?>

    in the top of your document, before anything else in the file. You can then use WordPress tags to your heart's desire.

  5. olajideolaolorun
    Member
    Posted 5 years ago #

    Thanks for that, ok...

    I tried this:
    <?php require('blog/wp-blog-header.php'); ?>

    <?php the_content("...continue reading " . get_the_title('', '', false)); ?>

    But it still doesn't work. It shows a blank page for some reason.

  6. olajideolaolorun
    Member
    Posted 5 years ago #

    This works:
    <?php require('blog/wp-blog-header.php'); ?>

    <!-- Start the Loop. -->
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <div class="entry">
    <?php the_excerpt(); ?>
    ">Read More: <?php the_title(); ?>
    </div>

    <?php endwhile; else: ?>
    <?php endif; ?>

    But A, i cant set the number of post i want to show.. i only want 2 but its showing about 10

    B, the excerpt is still too long... wanna make it shorter

    please help

  7. olajideolaolorun
    Member
    Posted 5 years ago #

    i got it to work the way i want it... had to tweak and look around in peoples work for codes but thanks....

    :)

  8. doodlebee
    Member
    Posted 5 years ago #

    This works:
    <?php require('blog/wp-blog-header.php'); ?>

    That works, because it's the correct path for *you*. Note, in my previous post that I said "SERVER PATH TO/wp-blog-header.php" - I said that because everyone's server path is different. Sometimes you have to tweak it to "../wp-blog-header.php" - sometimes as far as "../../../wp-blog-header.php". It all depends on where the file is located relative to the wp file.

    i got it to work the way i want it

    You *should* say *how* you got it fixed. Nothing is more frustrating than looking for an answer and when you think you've found it, the person who has it only says "I figured it out, thanks!" This is a public forum, meant to *share* your knowledge. So share.

    I'll take a guess at it though, for anyone else who may be looking. The reason he had a blank page (or the most common one) as he figured out, was either because he placed the code I provided too low in the file (it *must* come *before* anything else in the file), but it also looks like he figured out that he also needed to include the Loop on his page where he wanted the posts to show.

    You can set the number of posts you *want* to show in your Options Panel, or you can use a query to set what categories/number of posts to display. To shorten your excerpt - I'm actually not sure about that, because I've always used the_excerpt_reloaded() to handle that.

  9. magickwolf
    Member
    Posted 4 years ago #

    How would I set up a page just like this except pull two posts from say category1, one post from category2, two posts from category3. Any ideas would be greatly appreciated.

  10. Kafkaesqui
    Moderator
    Posted 4 years ago #

    magickwolf, look at the documentation on creating multiple post loops:

    http://codex.wordpress.org/The_Loop#Multiple_Loops

  11. magickwolf
    Member
    Posted 4 years ago #

    That is exactly what I needed. Thank you very much.

Topic Closed

This topic has been closed to new replies.

About this Topic