[ milanzemunac @ 18.10.2011. 11:44 ] @
Pozdrav prijatelji, Ne razumem se skoro pa uopste u PHP, i pitanje koje postavljam je mozda glupo, ali bih bio izuzetno zahvalan ako bi mi neko pomogao. Dakle, rec je o Wordpressu i opciji Related posts. Opcija super funkcionise, ali problem je sto mi prikazuje samo thumbnails posta, a ja bih zeleo da mi pored thumbnails objavi i naslov posta. Sta treba dodati u kodu da bih imao i sliku i naslov posta? Code (php): <?php /* include theme options */ include( TEMPLATEPATH . '/functions/get-options.php' ); ?> <!-- BEGIN #related-posts --> <div id="related-posts" class="clearfix"> <?php $backup = $post; // backup the current object $tz_categories = get_the_category($post->ID); if ($tz_categories) { $tz_category_ids = array(); foreach($tz_categories as $tz_individual_category) $tz_category_ids[] = $tz_individual_category->term_id; $args=array( 'category__in' => $tz_category_ids, 'post__not_in' => array($post->ID), 'showposts'=>$tz_related_number, // Number of related posts that will be shown. 'caller_get_posts'=>1 ); $tz_related_posts = new wp_query($args); if( $tz_related_posts->have_posts() ) { ?> <h3 class="widget-title">Sorodne objave <?php if ($tz_related_message) { ?><span><?php echo ($tz_related_message); ?></span><?php } ?></h3> <?php while ($tz_related_posts->have_posts()) { $tz_related_posts->the_post();?> <!-- BEGIN .post-container --> <div class="post-container"> <?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) { /* if post has post thumbnail */ ?> <div class="post-thumb"> <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'framework'), get_the_title()); ?>"><?php the_post_thumbnail('thumbnail-related'); /* post thumbnail settings configured in functions.php */ ?></a> </div> <?php } ?> <!-- END .post-container --> </div> <?php } } } $post = $backup; // copy it back wp_reset_query(); // to use the original query again ?> <!-- END #related-posts --> </div> Hvala! [Ovu poruku je menjao Goran Rakić dana 18.10.2011. u 13:11 GMT+1] |