Творец | Уважаемые форумчане, простой вопрос, но что-то голова не соображает. В сайдбаре chelnytown DOT ru блок - "Темы дня". Хочу заменить этот вывод на аналогичный ленты.ру "Главное за сутки". Подсобите, пожалуйста. Насколько я понимаю, выводится это вот здесь:
PHP код: <?php
add_action('widgets_init', create_function('', 'return register_widget("OT_latest_posts2");'));
class OT_latest_posts2 extends WP_Widget {
function OT_latest_posts2() {
parent::WP_Widget(false, $name = THEME_FULL_NAME.' Latest Posts With One Large Image');
}
function form($instance) {
$title = esc_attr($instance['title']);
$count = esc_attr($instance['count']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php printf ( __( 'Title:' , THEME_NAME )); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('count'); ?>"><?php printf ( __( 'Post count:' , THEME_NAME ));?> <input class="widefat" id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" type="text" value="<?php echo $count; ?>" /></label></p>
<?php
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['count'] = strip_tags($new_instance['count']);
return $instance;
}
function widget($args, $instance) {
extract( $args );
$title = apply_filters('widget_title', $instance['title']);
$count = $instance['count'];
$args=array(
'posts_per_page'=> $count
);
$the_query = new WP_Query($args);
$counter = 1;
$totalCount = $the_query->found_posts;
$blogID = get_option('page_for_posts');
$counter=1;
?>
<?php echo $before_widget; ?>
<?php if($title) echo $before_title.$title.$after_title; ?>
<div>
<?php if($blogID && get_page_link($blogID)) { ?>
<div class="top-right">
<a href="<?php echo get_permalink($blogID);?>"><?php _e("More Articles", THEME_NAME);?></a>
</div>
<?php } ?>
<?php if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post(); ?>
<?php
$rating = get_post_meta($the_query->ID, THEME_NAME."_ratings", true );
$image = get_post_thumb($the_query->post->ID,310,150);
$imageL = get_post_thumb($the_query->post->ID,0,0);
?>
<?php if ($counter==1) { ?>
<!-- BEGIN .article-middle-block -->
<div class="article-side-block">
<?php if($image['show']==true) { ?>
<div class="article-photo">
<span class="image-hover">
<span class="drop-icons">
<span class="icon-block"><a href="<?php echo $imageL["src"];?>" title="<?php _e("Show Image",THEME_NAME);?>" class="icon-loupe legatus-tooltip lightbox-photo"> </a></span>
<span class="icon-block"><a href="<?php the_permalink();?>" title="<?php _e("Read Article",THEME_NAME);?>" class="icon-link legatus-tooltip"> </a></span>
</span>
<img src="<?php echo $image['src'];?>" class="setborder" alt="<?php the_title();?>" title="<?php the_title();?>" />
</span>
</div>
<?php } ?>
<div class="article-header">
<h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
<?php if($rating) { ?>
<div class="article-rating">
<?php for($i=1;$i<=5;$i++) { ?>
<?php if($i<=ot_avarage_rating($the_query->post->ID)) { ?>
<span class="icon-text active">★</span>
<?php } else { ?>
<span class="icon-text">☆</span>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
</div>
<!-- END .article-middle-block -->
</div>
<?php } else { ?>
<?php if ($counter=="2") { ?>
<!-- BEGIN .article-array -->
<ul class="article-array content-category">
<?php } ?>
<li>
<a href="<?php the_permalink();?>"><?php the_title();?></a>
</li>
<?php if ($counter==$totalCount) { ?>
<!-- END .article-array -->
</ul>
<?php } ?>
<?php } ?>
<?php $counter++; ?>
<?php endwhile; else: ?>
<p><?php _e( 'No posts where found' , THEME_NAME);?></p>
<?php endif; ?>
</div>
<?php echo $after_widget; ?>
<?php
}
}
?>
Что на что заменить? Большое спасибо! |