Forum Replies Created

Viewing 5 replies - 106 through 110 (of 110 total)
  • Thread Starter v123shine

    (@v123shine)

    Previously, I would like to say many thank to you “Alchymyth” for your help.

    I add below code to my single.php

    <div class="postpercategory">
    <h1>News</h1>
    
    <?php $cats = array(); foreach( get_the_category() as $cat ) { $cats[] = $cat->term_is; };
    $recent = new WP_Query( array('category__in' => $cats, 'posts_per_page' => 6 )); while($recent->have_posts()) : $recent->the_post();?>
    
    <div class="posts">
    <div class="postimage">
    <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">
    <?php the_post_thumbnail('img90'); ?>
    </a>
    </div>
    <div class="postinfo">
    <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">
    <h4><?php $tit = the_title('','',FALSE); echo substr($tit, 0, 45); if (strlen($tit) > 45) echo " ..."; ?></h4>
    </a>
    </div>
    </div>
    <?php endwhile; ?>
    <?php wp_reset_postdata(); ?>
    </div>

    But I do not see any results. The “6 recent post” does not appear.
    Is there anything wrong with the above code?

    Thread Starter v123shine

    (@v123shine)

    Great idea, you solve my problem ??

    Others question, i think i need using the ‘featured image’ for first post, can you give to me the full code please!

    Thank you so much Alchymyth for help me ??

    Thread Starter v123shine

    (@v123shine)

    Thank you so much Alchymyth for help me.

    This is my site url: https://linkopen.net/3njy

    I create manual the template.

    This is the code of my category

    <!--Bola-->
    <div class="ks_category_left">
    <h1 class="ks_h1_title_item1">Bola</h1>
    <?php $recent = new WP_Query("cat=4&showposts=3"); while($recent->have_posts()) : $recent->the_post();?>
    <div class="ks_posts_item1">
    <div class="ks_postimage">
    <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">
    <?php get_the_image( array( 'size' => 'thumbnail', 'default_image' => 'https://kabarsore.com/noimages.jpg') ); ?>
    </a>
    </div>
    <div class="ks_title_desc">
    <div class="ks_postinfo">
    <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">
    <h4><?php $tit = the_title('','',FALSE); echo substr($tit, 0, 60); if (strlen($tit) > 60) echo " ..."; ?></h4>
    </a>
    </div>
    <div class="ks_desc">
    <?php echo get_excerpt(145); ?>
    </div>
    </div>
    </div>
    <?php endwhile; ?>
    </div>
    <!--end Bola-->

    # where is the image coming from? are you using the ‘featured image’ for this, or just the first image from the post?

    Image come from first thumb image on post and i using plugin “Get the Image” to display the image.

    Please help me.

    Thread Starter v123shine

    (@v123shine)

    Thank you so much JungleSpace.net for help me.

    Can you give to me the php code to display the first post with image and short description and other post only title, please!

    Thread Starter v123shine

    (@v123shine)

    help me, please!

Viewing 5 replies - 106 through 110 (of 110 total)