Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • renofizaldy

    (@renofizaldy)

    same with my problem i use the popularity contest on wordpress 3.0.5 and show the fatal error like that

    renofizaldy

    (@renofizaldy)

    same with my problem i use the popularity contest on wordpress 3.0.5 and show the fatal error like that

    renofizaldy

    (@renofizaldy)

    @peshawa

    just put that code inside index.php

    @alchymyth

    Woooww…. GREAT….SPECTACULAR

    Your code is full working….

    Thank you very much alchymyth

    Now I will not bother again with that code ??

    and this is the conclusion of the code :

    <?php
    wp_reset_query();
    
    $cats = get_categories('');
    foreach ($cats as $cat) :
    
    if($cat->category_parent)  continue; //this line avoids to show posts of sub categories
    
    $args = array(
    'posts_per_page' => 5,
    'category_name' => $cat->slug,);
    
    query_posts($args); // reset to original
    
    if (have_posts()) :
    echo '<h2>Latest Posts in '.$cat->name.' Category</h2>';
    ?>
    
    <?php while (have_posts()) : the_post(); ?>		
    
    <div>
     <h2>
      <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
     </h2>
    </div>
    
    <?php
      if ( is_category($vidcat) ) {  the_content();  }
      else { echo strip_tags(get_the_excerpt(), '<a><strong>'); }
    ?>
    
    <!-- this area is for the display of your posts the way you want it -->
    <!-- i.e. title, exerpt(), etc. -->
    
    <?php endwhile; ?>
    <?php else : echo '<h2>No Posts for '.$cat->name.' Category</h2>';?>
    <?php endif; wp_reset_query; ?>
    <?php endforeach; ?>

    Once again thank you very much alchymyth , you are so GREAT … ??

    Not like that…

    This definition is just example :

    i tried to display the post from category -> BERITA (is category parent) on front page

    i just wants to display only post from this 3 Category Parent :
    1st -> ARTIKEL
    2nd -> BERITA
    3rd -> DOWNLOAD

    When I tried it, all the title and the post from each sub categories, appears too on the front page

    i’m not sure too with that my means ?? because i’m very confused how to tell about my problem, sorry ??

    My website that is still not online, I still build it on localhost

    Firstly, here is example about my category on my localhost website -> https://bit.ly/htBacb

    i tried to display the post from category -> BERITA (is category parent) on front page, but look like this : https://www.multiupload.com/M535TRREM4 (sorry if i has upload there)

    and this the code of index.php : https://wordpress.pastebin.com/kEKxn1f7

    @alchymyth :

    Wow, thank you… ??

    I has tried it, and it’s work for me, very good trick

    But I still have a problem anymore.

    On the front page showing all category titles, and postings which I have selected also appear in each category title that appears on the front page

    Sorry if my question make you confused, i will tried to manipulate that code again. But if you can do it, maybe you can give me a one example again ??

    Thanks ??

    @alchymyth :

    This is a spectacular trick

    i has tried your code but i found a problem, the post can’t display on each category title, and I tried adding a code on the code that you created, and look like this :

    <?php
    wp_reset_query();
    
    $cats = get_categories('');
    foreach ($cats as $cat) :
    
    $args = array(
    'posts_per_page' => 5,
    'cat' => $cat->term_id,);
    
    query_posts($args);
    
    if (have_posts()) :
    echo '<h2>Latest Posts in '.$cat->name.' Category</h2>';
    ?>
    
    <?php while (have_posts()) : the_post(); ?>
    <div>
    <h2>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    </h2>
    </div>
    
    <?php
    if ( is_category($vidcat) ) {  the_content();  }
    else { echo strip_tags(get_the_excerpt(), '<a><strong>'); }
    ?>
    
    <!-- this area is for the display of your posts the way you want it -->
    <!-- i.e. title, exerpt(), etc. -->
    
    <?php endwhile; ?>
    <?php else : echo '<h2>No Posts for '.$cat->name.' Category</h2>';?>
    <?php endif; wp_reset_query; ?>
    <?php endforeach; ?>

    But i’m still confused, how to display post just in category parent, not a sub category?

Viewing 8 replies - 1 through 8 (of 8 total)