__( 'Displays posts in Grid', 'postmag' ) )
);
}
private function defaults(){
$defaults = array(
'NoofListings' => 6,
'categoryListings' => '',
'categryorformat' => 3,
'postformat' => '',
);
return $defaults;
}
public function form( $instance) {
$instance = wp_parse_args( (array) $instance, $this->defaults() );
$NoofListings = $instance[ 'NoofListings' ];
$categoryListings = $instance[ 'categoryListings' ];
$categryorformat = $instance[ 'categryorformat' ];
$postformat = $instance[ 'postformat' ];
// validating the user input for number of post to show
if ( $NoofListings == 0 || strlen( $NoofListings ) > 2 ) {
$NoofListings = 1;
}
?>
size = "1" />
__('Select post by format','postmag'),
'orderby' => 'name',
'order' => 'asc',
'show_count' => 1,
'hide_empty' => 1,
'echo' => 1,
'selected' => $postformat,
'hierarchical' => 1,
'name' => esc_html( $this->get_field_name('postformat') ),
'id' => absint( $this->get_field_id('postformat') ),
'class' => 'widefat',
'taxonomy' => 'post_format',
'value_field' => 'name',
);
wp_dropdown_categories($postmag_postformat);
?>
size = "1" />
size = "1" />
__( 'Select post by category','postmag' ),
'option_none_value' => __( 'none', 'postmag' ),
'orderby' => 'name',
'order' => 'asc',
'show_count' => 1,
'hide_empty' => 1,
'echo' => 1,
'selected' => $categoryListings,
'hierarchical' => 1,
'name' => esc_html( $this->get_field_name('categoryListings') ),
'id' => absint( $this->get_field_id('categoryListings') ),
'class' => 'widefat',
'taxonomy' => 'category',
'value_field' => 'name',
);
wp_dropdown_categories($postmag_categoryListings);
?>
size = "1" />
size = "1" />
defaults() );
$NoofListings = ! empty( $instance[ 'NoofListings' ] ) ? $instance[ 'NoofListings' ] : 6;
$categoryListings = $instance[ 'categoryListings' ];
$categryorformat = $instance[ 'categryorformat' ];
$postformat = $instance[ 'postformat' ];
echo $args['before_widget'];
$this->getRealtyListings( $NoofListings, $categoryListings,$categryorformat,$postformat);
echo $args['after_widget'];
}
private function getRealtyListings( $NoofListings,$categoryListings,$categryorformat,$postformat) {
if ( absint( $categryorformat ) == 2 ) {
?>