1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | <? $call_args = array ( 'post_type' => $post_type , 'p' => $post_id , 'page_id' => $page_id , 'pagename' => $pagename , 'name' => $post_name , 'year' => $year , 'meta_key' => $meta_key , 'meta_value' => $meta_value , 'posts_per_page' => $posts_per_page , 'author' => $author_id , 'author_name' => $author_name , 'author__in' => array ( 37, 47 ), 'author__not_in' => array ( 37, 47 ), 'category_name' => $category_slug , 'cat' => $category_id , 'category__and' => array ( 37, 47 ), 'category__in' => array ( 37, 47 ), 'category__not_in' => array ( 37, 47 ), 'tag' => $tag_slug , 'tag_id' => $tag_id , 'tag__and' => array ( 37, 47 ), 'tag__in' => array ( 37, 47 ), 'tag__not_in' => array ( 37, 47 ), 'tag_slug__and' => array ( 37, 47 ), 'tag_slug__in' => array ( 37, 47 ), 'post_parent' => $parent_id , 'offset' => 1, 'orderby' => '$meta_value' , 'order' => 'DESC' ); $args [ 'tax_query' ] = array ( array ( 'taxonomy' => 'project_categories' , 'field' => 'term_taxonomy_id' , 'terms' => $this_cat , ), ); $call_args [ 'paged' ] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; $custom_query = new WP_Query( $call_args ); $count = 0; $temp_query = $wp_query ; $wp_query = NULL; $wp_query = $custom_query ; function string_limit_words( $string , $word_limit ) { //607AM $words = explode ( ' ' , $string , ( $word_limit + 1)); if ( count ( $words ) > $word_limit ) array_pop ( $words ); return implode( ' ' , $words ); } //607AM function is_local_link( $the_link ) { if ( strpos ( " $the_link " , site_url())) { return true; } else { return false; } } if ( $custom_query ->have_posts() ) { while ( $custom_query ->have_posts() ) { $custom_query ->the_post(); $this_post_id = $post ->ID; $this_post_title = get_the_title(); $this_post_excerpt = get_the_excerpt(); $this_post_excerpt = string_limit_words( $this_post_excerpt ,25); $this_post_excerpt .= 'more ->' ; $this_post_content = get_the_content(); $this_post_link = get_permalink( $this_post_id ); $featured_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post ->ID), 'full' ); //$meta_values = get_post_meta( $post->ID, $key, true ); if (is_local_link( $this_post_link )) { $target = '_self' ; } else { $target = '_blank' ; } ?> <? $count ++; ?> <a target=<? echo $target ; ?> href= "<? echo $this_post_link; ?>" > <div class = "single_post_wrap" id= "single_post_<? echo $count; ?>" > <? if (! empty ( $featured_image [0])) { ?> <div class = "featured_wrap" > <img class = "featured_image" id= "featured_image_<? echo $count; ?>" src= "<? echo $featured_image[0]; ?>" /> </div><!--featured_wrap--> <? } ?> <h1 class = "post_title" ><? the_title(); ?></h1> <div class = "post_content" ><? the_content(); ?></div> </div><!--single_post_wrap--> </a> <?php } } ?> <?php the_posts_pagination( array ( 'mid_size' => 2, 'prev_text' => __( 'Back' , 'textdomain' ), 'next_text' => __( 'Forward' , 'textdomain' ), ) ); $wp_query = NULL; $wp_query = $temp_query ; wp_reset_query(); ?> |