Advertisement
shakil97bd

Global query post

Oct 2nd, 2014
509
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. ***************************************Global query post**************************************
  2. //This code is for query post in index.php file.
  3.  
  4.  
  5.         <?php
  6.             global $post;
  7.             $args = array( 'posts_per_page' => -1, 'post_type'=> 'page', 'orderby' => 'menu_order', 'order' => 'asc' );
  8.             $myposts = get_posts( $args );
  9.             foreach( $myposts as $post ) : setup_postdata($post); ?>
  10.            
  11.                 <!--This is for custom-feilds in the post or page-->
  12.                 <?php
  13.                
  14.                     $page_type = get_post_meta($post->ID, 'page_type', true);
  15.  
  16.                 ?>
  17.                
  18.                 <!-- query content here -->
  19.                
  20.                
  21.                
  22.             <?php endforeach; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement