diff -r 000000000000 -r d970ebf37754 wp/wp-content/themes/IN-MOTION-package-u1/in-motion/functions/widget-posts.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wp/wp-content/themes/IN-MOTION-package-u1/in-motion/functions/widget-posts.php Wed Nov 06 03:21:17 2013 +0000 @@ -0,0 +1,123 @@ + 'post_widget', + 'description' => 'Custom post widget.'); + + $control_options = array( //dodama svoje incializirane mere + 'width' => 200, + 'height' => 400, + 'id_base' => 'post_widget' + ); + + $this->WP_Widget( 'post_widget', 'Post Widget', $widget_options, $control_options ); + +} + + + +function widget( $args, $instance ) { + + extract( $args ); + $title = apply_filters('widget_title', $instance['title'] ); + $username = $instance['username']; + $posts_number = $instance['posts_number']; + + echo $before_widget; + + if ( $title ) + { + echo $before_title; + echo $title; + echo $after_title; + } + + $args = array('posts_per_page' => $posts_number, 'order'=> 'DESC', 'orderby' => 'post_date' ); + + $port_query = new WP_Query( $args ); + + if( $port_query->have_posts() ) : while( $port_query->have_posts() ) : $port_query->the_post(); + + ?> +
+
+ ID ), 'single-post-thumbnail' ); ?> + + + +
+
+ ID); ?> +
+
+
+ + + + +
+ 'Post Widget', + 'posts_number' => '3', + ); + $instance = wp_parse_args( (array) $instance, $defaults ); + + ?> + + + + + + + \ No newline at end of file