• Resolved parlenk

    (@parlenk)


    I want to insert it as div content, and i want to make all category list..
    (let say may categories are:news,money,game)

    so in the main body become like this:

    News:
    title post 1 (0nclick-link to title page post 1 of news category)
    title post 2 (onclick-link to title page post 2 of news category)
    title post 3 (onclick-link to title page post 3 of news category)

    read more(link to news category page)

    Money:
    title post 1
    title post 2
    title post 3

    read more(link to money category page)

    Game:
    title post 1
    title post 2
    title post 3

    read more(link to game category page)

    Pls some advise..the main are (div content) is the only thing that unfinished on my theme.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter parlenk

    (@parlenk)

    heloo…??

    no body?

    I try to install a plugin, and i t work well on static page, but i dont know how to insert it to the main page.the plugin “list-category-posts”.Any idea how to put this to the main or home or index.php area? pls..any suggestion will be taken into consideration.cheers

    <?php
    //for each category, show 3 posts
    $cat_args=array(
      'orderby' => 'name',
      'order' => 'ASC'
       );
    $categories=get_categories($cat_args);
      foreach($categories as $category) {
        $args=array(
          'showposts' => 3,
          'category__in' => array($category->term_id),
          'caller_get_posts'=>1
        );
        $posts=get_posts($args);
          if ($posts) {
            echo '<p>Category: <a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </p> ';
            foreach($posts as $post) {
              setup_postdata($post); ?>
              <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
              <?php
            } // foreach($posts
          } // if ($posts
        } // foreach($categories
    ?>

    Related:
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

    Thread Starter parlenk

    (@parlenk)

    hi, thx for the reply..it’s work ?? with a lil tweak to make it look nicer and all will be good.although with this way, all the category will be called… i did find a way to list the category that u want, so if you want to display just some of your categories on the main page, you have to enter each category id/name.i.e:the category that i want to display are FOrex and Entertaiment.

    `<div class=”block” id=”forex”>
    <h2 class=”block-title”>Forex</h2>

      <?php get_latest_posts(“Forex”, 5); ?>

    </div>

    <div class=”block” id=”entertainment”>
    <h2 class=”block-title”>Entertainment</h2>
    <ul id=”entertainment”>`
    but first u have to install the plugin “List Latest Posts Titles” and then insert that code above to your index.php , well, just an option :),

    thx again MichaelH.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to display 5 latest post title on the main content’ is closed to new replies.