Best way to insert post attributes into array?
-
I’m trying to loop through all the posts but I’m only getting 12 posts.
$args = array('post_type' => 'post'); $loop = new WP_Query($args); if($loop->have_posts() ) : while ( $loop->have_posts() ) : $loop->the_post(); $title = get_the_title(); $post_category=get_the_category(); $post_category_name=$post_category[0]->cat_name; $permalink=get_the_permalink(); $lng=get_post_meta( get_the_ID(), 'lng', TRUE ); $lat=get_post_meta( get_the_ID(), 'lat', TRUE ); $beer = get_post_meta( get_the_ID(), 'price_beer', TRUE ); $wine = get_post_meta( get_the_ID(), 'price_wine', TRUE ); $lnglat=$lng.", ".$lat; $arrlatlng[]=array( "lnglat"=>$lnglat, "beer" =>$beer, "wine" =>$wine, "post_title"=>$title, 'post_category'=>$post_category_name, 'post_url'=>$permalink); $longitude[]=array('lng'=>$lng); $latitude[]=array('lat'=>$lat); endwhile; endif;
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Best way to insert post attributes into array?’ is closed to new replies.