D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
cwd
/
wp-content
/
themes
/
newsplus1
/
inc
/
widgets
/
Filename :
widget-posts-list.php
back
Copy
<?php /* Copyrights (C) Arb4Host Network */ ?> <?php function a4h_widget_posts_list() { register_widget('a4h_widget_posts_list'); } add_action('widgets_init', 'a4h_widget_posts_list'); class a4h_widget_posts_list extends WP_Widget { function __construct() { parent::__construct(false, THEME_PREFIX.' | '.'قائمة مقالات'); } function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'] , $instance, $this->id_base); echo $before_widget; if ( $title ) { echo $before_title.$title.$after_title; } //start output ?> <?php $posts_args = array(); $posts_args['ignore_sticky_posts'] = true; $posts_args['orderby'] = !empty($instance['orderby']) ? $instance['orderby'] : ''; $posts_args['meta_key'] = $posts_args['orderby'] == 'meta_value_num' ? 'views' : ''; $posts_args['post__in'] = $posts_args['orderby'] == 'sticky' ? get_option('sticky_posts') : ''; $posts_args['posts_per_page'] = !empty($instance['posts_per_page']) ? $instance['posts_per_page'] : 8; $posts_args['date_query'] = !empty($instance['daysoff']) ? array(array('column' => 'post_date_gmt', 'after' => $instance['daysoff'].' days ago')) : ''; $posts_args['offset'] = !empty($instance['offset']) ? $instance['offset'] : ''; $posts_args['tax_query'] = !empty($instance['cats']) ? a4h_post_args_taxonomies_output($instance['cats']) : ''; $custom_args = !empty($instance['custom_args']) ? $instance['custom_args'] : ''; eval("return $custom_args;"); ?> <?php a4h_posts_list($instance, $posts_args, $this); ?> <?php //end output echo $after_widget; } function update($new_instance, $old_instance) { $instance = $old_instance; //start instances $instance['title'] = strip_tags($new_instance['title']); $instance['style'] = $new_instance['style']; $instance['orderby'] = $new_instance['orderby']; $instance['posts_per_page'] = $new_instance['posts_per_page']; $instance['daysoff'] = $new_instance['daysoff']; $instance['offset'] = $new_instance['offset']; $instance['cats'] = $new_instance['cats']; $instance['cat_link'] = $new_instance['cat_link']; $instance['custom_args'] = $new_instance['custom_args']; //end instances return $instance; } function form($instance) { $defaults = array(); $instance = wp_parse_args((array) $instance, $defaults); //start form $posts_list_styles = array( '_group_start_1' => 'ستايلات قياسية', 'style1' => '(#1) صورة بجانبها عنوان', 'style2' => '(#2) صورة أسفلها عنوان', '_group_end_1' => '', '_group_start_2' => 'أحجام كبيرة', 'grid1' => '(#3) شكل مخصص', 'grid2' => '(#4) شكل مخصص', 'grid3' => '(#5) شكل مخصص', 'grid4' => '(#6) شكل مخصص', 'grid7' => '(#7) شكل مخصص', 'grid8' => '(#8) شكل مخصص', '_group_end_2' => '', '_group_start_3' => 'أحجام صغيرة', 'grid5' => '(#9) شكل مخصص', 'grid6' => '(#10) شكل مخصص', '_group_end_3' => '', '_group_start_4' => 'سلايدر', 'slider1' => '(#11) سلايدر متعدد', 'slider2' => '(#12) سلايدر بسيط', 'slider3' => '(#13) سلايدر بروابط تنقل جانبية', 'slider4' => '(#14) سلايدر بروابط تنقل سفلية', '_group_end_4' => '', ); $posts_list_styles = apply_filters('a4h_filter_posts_list_styles', $posts_list_styles); ?> <?php a4h_widgets_input_fields($this, $instance, 'text', 'title', 'العنوان'); ?> <?php a4h_widgets_input_fields($this, $instance, 'select', 'style', 'الستايل', array('options' => $posts_list_styles)); ?> <?php a4h_widgets_input_fields($this, $instance, 'select', 'orderby', 'ترتيب بواسطة', array('options' => array('date' => 'تاريخ النشر', 'modified' => 'تاريخ التحديث', 'meta_value_num' => 'الأكثر مشاهدة', 'comment_count' => 'الأكثر تعليقا', 'rand' => 'عشوائي'))); ?> <div class="txtgroup"> <?php a4h_widgets_input_fields($this, $instance, 'text', 'posts_per_page', 'عدد المقالات'); ?> <?php a4h_widgets_input_fields($this, $instance, 'text', 'daysoff', '', array('prepend' => 'المكتوبة خلال آخر', 'append' => 'يوم')); ?> <?php a4h_widgets_input_fields($this, $instance, 'text', 'offset', '', array('prepend' => 'تجاوز عدد', 'append' => 'موضوع')); ?> </div> <?php a4h_widget_options_functions($this, $instance, 'select_categories'); ?> <?php a4h_widgets_input_fields($this, $instance, 'checkbox', 'cat_link', 'إضافة رابط للتصنيف المختار'); ?> <?php a4h_widgets_input_fields($this, $instance, 'textarea', 'custom_args', 'Custom Query Arguments', array('placeholder' => '$posts_args[$property] = $value;', 'class' => 'ltr code')); ?> <?php //end form } }