Exemple #1
0
 /** @see WP_Widget::widget */
 function widget($args, $instance)
 {
     extract($args);
     //ninja_annc_update_all();
     $annc_id = $instance['annc_id'];
     $meta = get_post_meta($annc_id, '_ninja_annc_meta', true);
     $show_title = $meta['show_title'];
     $location = $meta['location'];
     $annc_post = get_post($annc_id, ARRAY_A);
     $post_status = $annc_post['post_status'];
     if ($location == 'widget' && $post_status == 'publish') {
         echo $before_widget;
         echo ninja_annc_check($annc_id, true, false, $before_title, $after_title);
         echo $after_widget;
     }
 }
Exemple #2
0
function ninja_annc_display_annc_location($location, $widget = false)
{
    $args = array('offset' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'ninja_annc', 'post_status' => 'publish');
    $posts_array = get_posts($args);
    foreach ($posts_array as $post) {
        $meta = get_post_meta($post->ID, '_ninja_annc_meta', true);
        $annc_location = $meta['location'];
        if ($location == $annc_location) {
            echo ninja_annc_check($post->ID);
        }
    }
}