Помогите с виджетом для Wordpress

C
На сайте с 07.11.2009
Offline
64
633

Всем привет. Ребята помогите пожалуйста, скачал буржуйскую тему, в ней есть виджет "All Videos Categories one post display", вот с ним и возникли проблемы.

Подскажите как убрать категории, чтобы остались только картинки (см. фото) ?

[ATTACH]83045[/ATTACH]

Код виджета.

// =============================== All Videos Categories one post display ======================================



class video_categories_post extends WP_Widget {
function video_categories_post() {
//Constructor
$widget_ops = array('classname' => 'widget All Video Categories First Post', 'description' => 'List of Categories first video in particular category' );
$this->WP_Widget('widget_video_allcat', 'PT → All Categories First Video', $widget_ops);
}

function widget($args, $instance) {
// prints the widget

extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
$category = empty($instance['category']) ? '' : apply_filters('widget_category', $instance['category']);
$post_number = empty($instance['post_number']) ? '4' : apply_filters('widget_post_number', $instance['post_number']);
$desc_count = empty($instance['desc_count']) ? '50' : apply_filters('widget_desc_count', $instance['desc_count']);

// if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
?>
<ul class="categories_list cat_main">

<?php
if($category)
{
$catids = $category;
$sub_sql_cat = " and t.term_id in ($catids)";
}
//$catQuery = get_categories('include='.$catids);
global $wpdb;
$catQuery = $wpdb->get_results("select t.* from $wpdb->terms t join $wpdb->term_taxonomy tt on tt.term_id=t.term_id where tt.taxonomy=\"videoscategory\" $sub_sql_cat order by t.name");
$catCounter = 0;
$pcount=0;
global $post,$wpdb;
foreach ($catQuery as $category) {

$catCounter++;
$catLink = get_category_link($category->cat_id);
//$post = get_posts('numberposts=1&offset=1&category='.$category->term_id);
$categoryid = $category->term_id;
$sql = "select p.* from $wpdb->posts p where p.post_type='videos' and p.ID in (select tr.object_id from $wpdb->term_relationships tr join $wpdb->term_taxonomy t on t.term_taxonomy_id=tr.term_taxonomy_id where t.term_id=\"$categoryid\" ) order by p.post_date desc,p.ID desc limit $post_number";
$post = $wpdb->get_results($sql);
?>
<?php $post_images = bdw_get_images($post[0]->ID,'large'); ?>
<?php $pcount++;
?>
<li>
<?php if(get_post_meta($post[0]->ID,'time',true)){?>
<span class="time"> <?php echo get_post_meta($post[0]->ID,'time',true);?> </span>
<?php }?>
<h3> <a href="<?php if(is_string(get_term_link( $category->term_id, 'videoscategory' ))){echo get_term_link( $category->term_id, 'videoscategory' );}?>" ><?php echo $category->name ?></a> </h3>
<?php
if(get_the_post_thumbnail( $post->ID, array())){?>
<a class="video_thumb" href="<?php echo get_permalink($post[0]->ID) ?>" rel="bookmark" title="<?php get_the_title($post[0]->ID); ?>">
<?php echo get_the_post_thumbnail( $post->ID, array(123,102),array('class' => "",));?>



</a>
<?php }else if($post_images[0]){ global $thumb_url;
$thumb_url1 = $thumb_url.get_image_cutting_edge($args);
?>
<a class="video_thumb" href="<?php echo get_permalink($post[0]->ID) ?>" rel="bookmark" title="<?php get_the_title($post[0]->ID); ?>">
<img src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=<?php echo $post_images[0];?>&amp;w=110&amp;h=150&amp;zc=1&amp;q=80<?php echo $thumb_url1;?>" alt="<?php get_the_title($post[0]->ID); ?>" title="<?php the_title(); ?>" />




</a>
<?php
} else { ?>
<a href="<?php echo get_permalink($post[0]->ID) ?>" class="img" > <span class="img_not_available"> <?php _e('Image Not Available ');?> </span>
</a>

<?php }?>
<p class="title"><a href="<?php echo get_permalink($post[0]->ID) ?>" rel="bookmark" title="<?php get_the_title($post[0]->ID); ?>"><?php echo get_the_title($post[0]->ID); ?></a></p>
<p class="author">Добавил: <a href="<?php echo get_author_posts_url($post[0]->post_author); ?>"><?php echo $wpdb->get_var("select display_name from $wpdb->users where ID='".$post[0]->post_author."'");?></a></p>
<p><?php
$text = $post[0]->post_content;
$text = strip_tags($text);
$text = substr($text, 0, $desc_count);
$text = substr($text, 0, strrpos($text, " "));
echo $text = $text.$ellipsis;
?></p>
</li>
<?php if($pcount!=0 && ($pcount%4)==0){?>
<li class="hr clearfix"></li>
<?php }?>
<?php } ?>
</ul>
<?php
echo $after_widget;
}

function update($new_instance, $old_instance) {
//save the widget
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['category'] = strip_tags($new_instance['category']);
$instance['post_number'] = strip_tags($new_instance['post_number']);
$instance['desc_count'] = strip_tags($new_instance['desc_count']);
return $instance;

}

function form($instance) {
//widgetform in backend
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'category' => '', 'post_number' => '' ) );
$title = strip_tags($instance['title']);
$category = strip_tags($instance['category']);
$post_number = strip_tags($instance['post_number']);
$desc_count = strip_tags($instance['desc_count']);

?>
<?php /*?><p>
<label for="<?php echo $this->get_field_id('title'); ?>">Title:
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" />
</label>
</p><?php */?>
<p>
<label for="<?php echo $this->get_field_id('category'); ?>">Categories (<code>IDs</code> separated by commas):
<input class="widefat" id="<?php echo $this->get_field_id('category'); ?>" name="<?php echo $this->get_field_name('category'); ?>" type="text" value="<?php echo attribute_escape($category); ?>" />
</label>
</p>
<p>
<label for="<?php echo $this->get_field_id('desc_count'); ?>">Description charater count:
<input class="widefat" id="<?php echo $this->get_field_id('desc_count'); ?>" name="<?php echo $this->get_field_name('desc_count'); ?>" type="text" value="<?php echo attribute_escape($desc_count); ?>" />
</label>
</p>
<?php
}

}

register_widget('video_categories_post');
png 350510595.png
Меняюсь ссылками и статьями, тематика: Фильмы онлайн (http://filmcrit.ru)
orphelin
На сайте с 02.07.2006
Offline
261
#1

если был бы еще html-код того что получается, было бы проще.

а так может этот кусок удалить:

<label for="<?php echo $this->get_field_id('title'); ?>">Title:
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" />
</label>
Z
На сайте с 22.05.2008
Offline
122
#2

Кажись это лишнее

<h3> <a href="<?php if(is_string(get_term_link( $category->term_id, 'videoscategory' ))){echo get_term_link( $category->term_id, 'videoscategory' );}?>" ><?php echo $category->name ?></a> </h3>
C
На сайте с 07.11.2009
Offline
64
#3

Zamdir спасибо, помогло.

Тему можно закрыть.

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий