dsh2016
Forum Replies Created
-
Forum: Themes and Templates
In reply to: [JustWrite] How to create a category post widget?Ok I figured out I had to edit the php file in C-Panel..
..and put ‘cat’ =>3 below the line mentioned above. 3 being the number of the category name as far as I can tell.
class AC_Recent_Posts_Widget extends WP_Widget {
function AC_Recent_Posts_Widget() {
// Settings
$widget_ops = array( ‘classname’ => ‘ac_recent_posts_widget’, ‘description’ => ‘Displays your most recent articles. With or without thumbnails’ );// Create the widget
$this->WP_Widget( ‘ac_recent_posts_widget’, __(‘ACOSMIN: Recent Posts’, ‘acosmin’), $widget_ops );
}function widget( $args, $instance ) {
extract( $args );// Widget Settings
$title = apply_filters(‘widget_title’, $instance[‘title’] );
$recent_posts_number = $instance[‘recent_posts_number’];
$hide_recent_thumbs = isset( $instance[‘hide_recent_thumbs’] ) ? $instance[‘hide_recent_thumbs’] : false;echo $before_widget;
// Widget Front End Output
if ( $title ) {
echo $before_title . $title . $after_title;
}$args = array(
‘posts_per_page’ => $recent_posts_number,
‘cat’ => 3,
‘ignore_sticky_posts’ => 1But after loading the widget and saving, all i get is a sentence under the recent posts widget that says “No popular posts available!”
Any ideas?
thanks