WordPress.org

Ready to get started?Download WordPress

Forums

Display category specific posts on homepage displaying only the content (10 posts)

  1. YoUnGLinKiE
    Member
    Posted 6 years ago #

    On the frontpage of my site I would like to display an overview of twenty of the latest posts just by showing the content of the post. The title, postdata, author info, etc can't be displayed. Clicking through via a read more shouldn't be possible either.

    I want to do this because I want to place category and tag specific links to other sites, so the permalink, title, number of comments etc shouldn't be displayed.

    But I still want to be able to display a normal blogoverview under my content-only linkoverview.

    This is my theme: http://gameshoppers.net/

  2. krembo99
    Member
    Posted 6 years ago #

    I am using the same technique on one of my sites :
    http://www.krembo99.com
    Only that in my theme I chose to show only THE FIRST thumb.

    it is very simple :
    You just have to remove the template tags from your Index.php (or home.php) , depends on how your theme is configured.
    For example ..

    If you do not want the author to appear, just comment the relative template tag :

    <?php the_author(); ?>

    if you do not want the category remove :

    <?php the_category(' '); ?>

    and so on.....

    do not forget to comment also the href link with the relative closing /a tag...

  3. YoUnGLinKiE
    Member
    Posted 6 years ago #

    Thanks for the info krembo99, but when I do that all of my frontpage posts will look like that and I actually want to display posts on my index.php that still have all the bloginfo.

  4. krembo99
    Member
    Posted 6 years ago #

    there are several way to do that ,easiest are :
    1. with a multi-loop (search )
    2. with custom fields (also search)

  5. YoUnGLinKiE
    Member
    Posted 6 years ago #

    you also want to show othe /n regular post with the meta data ?

    Yep that's right, it's a little hard to explain so I made a sketch to visualize it:

    http://img78.imageshack.us/img78/8615/blogmainkw8.png

  6. krembo99
    Member
    Posted 6 years ago #

    what you showed in the sketch, will be a bit tricky, becasue first you want 20 post from a category, and then you want OTHER posts , taht some share the same category, but will not repeat the same post ....

    If you want DIFFERENT category to show above, it's faitly easy.
    If you want the post to repeat themselves, it's also possiable.
    You will have at any rate, to my understanding, to use multiply loops.

  7. YoUnGLinKiE
    Member
    Posted 6 years ago #

    Actually I don't want the posts shown in the 20 links overview to be repeated in the normal blogoverview as well... It will be one separate category not displayed in the classic blogoverview.

    What I'll do is do a first category specific overview with the 20 links overview category and a general news category that displays blogposts with all the postinfo.

    Edit 2: It kind of works, I assigned a category but it still displays content of other category posts as well... http://gameshoppers.net

  8. krembo99
    Member
    Posted 6 years ago #

    <?php if ( in_category(5) ) {
    echo ' <a href="<?php the_permalink() ?>"><?php the_title() ?></a> ';
    } else {
    echo 'WHATEVER_YOU_WANT';
    }
    ?>
  9. YoUnGLinKiE
    Member
    Posted 6 years ago #

    This is how my index.php looks like atm:

    <?php get_header(); ?>
    
    <div id="wp_content">
    
    <div id="post_entry">
    
    <h3>20 Links</h3>
    <ul>
    <div class="post_content"><?php $recent = new WP_Query("category_name=Video Game Deals&showposts=20"); while($recent->have_posts()) : $recent->the_post();?>
                <?php the_content(__('Read the story &raquo;'));?><div style="clear:both;"></div>
    <?php endwhile; ?></div>
    </ul>
    
    <b><?php if ( in_category('8') ): ?><?php while (have_posts()) : the_post(); ?> <!-- init post page --></b>
    
    <div class="post_meta" id="post-<?php the_ID(); ?>">

    After the link overview come the normal blogposts in category 8, but they don't get displayed...

  10. YoUnGLinKiE
    Member
    Posted 6 years ago #

    Alright it kind of works how I wanted now, just the archive pages now.

    Thanks for all the help krembo99!

Topic Closed

This topic has been closed to new replies.

About this Topic