__( 'Display posts with Titlles only for consequential posts', 'postmag' ) ) ); } private function defaults() { $defaults = array( 'NoofListings' => 1, 'categoryListings' => '', 'categryorformat' => 3, 'postformat' => '', 'shadow' => 0, ); 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' ]; $shadow = $instance[ 'shadow' ]; // validating the user input for number of post to show if ( $NoofListings == 0 || strlen( $NoofListings ) > 2 ) { $NoofListings = 1 ; } ?> id = "get_field_id( 'shadow' ) ); ?>" name = "get_field_name( 'shadow' ) ); ?>" />

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); ?>
defaults() ); $NoofListings = $instance[ 'NoofListings' ]; $categoryListings = $instance[ 'categoryListings' ]; $categryorformat = $instance[ 'categryorformat' ]; $postformat = $instance[ 'postformat' ]; $shadow = $instance[ 'shadow' ]; echo $args['before_widget']; $this->getRealtyListings( $NoofListings, $categoryListings,$categryorformat,$postformat,$shadow ); echo $args['after_widget']; } private function getRealtyListings( $NoofListings,$categoryListings,$categryorformat,$postformat,$shadow ) { if ( absint( $categryorformat == 2 ) ) { ?>
'post', 'posts_per_page' => absint( $NoofListings ), ); if ( absint( $categryorformat ) == 1 ) { $args = array( 'post_format' => 'post-format-'.esc_html( $postformat ), 'posts_per_page' => absint( $NoofListings ), ); } if ( absint( $categryorformat ) == 2 ) { $args = array( 'category_name' => esc_html( $categoryListings ), 'posts_per_page' => absint( $NoofListings ), ); } if ( absint( $categryorformat ) == 3 ) { $args = array( 'post_type' => 'post', 'posts_per_page' => absint( $NoofListings ), ); } $ii = 1; $listings = new WP_Query( $args ); if ( $listings->have_posts() ) { while ( $listings-> have_posts() ) { $listings->the_post(); ?>
1) { ?>