Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Widget_Category extends WP_Widget
- {
- private $wp_query;
- private $test = 'hello world';
- function __construct()
- {
- $arg = array('category_name' => 'songs');
- $wp_query = new WP_Query($arg);
- $widget_options = array('classname' => 'widget-cateogry', 'description' => 'Get specific category');
- $widget_controls = array('height' => 300, 'width', 250);
- parent::__construct('widget_category', 'MY FIRST CATEGORY Widget', $widget_options, $widget_control);
- }
- function widget($arg, $instance)
- {
- extract($arg, EXTR_SKIP);
- echo $before_widget;
- echo $before_title;
- echo "Category Widget";
- echo test;
- echo $after_title;
- while($wp_query->have_posts()):
- $wp_query->the_post();
- ?>
- <li> <?php the_title();?> </li>
- <?
- endwhile;
- //work
- echo $after_widget;
- }
- }
Add Comment
Please, Sign In to add comment