Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanjimahmmed/ddf6b768fd69905802a019fc79fe239b to your computer and use it in GitHub Desktop.
Save tanjimahmmed/ddf6b768fd69905802a019fc79fe239b to your computer and use it in GitHub Desktop.
Custom post loop with custom fields
<?php
global $post;
$args = array( 'posts_per_page' => -1, 'post_type'=> 'posttype', 'orderby' => 'menu_order', 'order' => 'ASC' );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<?php
$job_link= get_post_meta($post->ID, 'job_instructions', true);
?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<p><?php echo $job_link; ?></p>
<?php endforeach; wp_reset_query(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment