Skip to main content
added 352 characters in body
Source Link
Chip Bennett
  • 55.1k
  • 8
  • 90
  • 170

This seems like an easy thing to do but I am missing something here. I have a custom post type called "recipient" and a meta check box called "yes_current" - (we help children with cancer and run events for them so we need to know who is a current recipient and who is a past recipient.) We want to display two sections on our RECIPIENT page: CURRENT RECIPIENTS and PAST RECIPIENTS.

My thought is to query the loop to get all of the custom_post_types that equal recipient, then display the featured image for all CURRENT recipients (if yes_current is ON) in the Current section, then do the same for PAST recipients in the Past section.

Thank you guys!

CODE:

<h1>CURRENT Recipients</h1>

<?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'on'));

if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop-the_post(); 

<?php get_the_post_thumbnail($page->ID, 'thumbnail'); ?>

<?php endwhile; endif; wp_reset_postdata(); ?>

<h1>PAST Recipients</h1>

<?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'off'));

if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop->the_post(); 

<?php get_the_post_thumbnail($page->ID, 'thumbnail'); ?>

<?php endwhile; endif; wp_reset_postdata(); ?>

Edit

Custom post meta code:

$meta_boxes[] = array( 'id' => 'yes_current', 'title' => 'Current Recipient', 'pages' => array( 'recipient' ), 'context' => 'side', 'priority' => 'low', 'fields' => array( array( 'name' => 'Current Recipient', 'id' => "{$prefix}yes_current", 'type' => 'checkbox', // Value can be 0 or 1 'std' => 1, ), ),

This seems like an easy thing to do but I am missing something here. I have a custom post type called "recipient" and a meta check box called "yes_current" - (we help children with cancer and run events for them so we need to know who is a current recipient and who is a past recipient.) We want to display two sections on our RECIPIENT page: CURRENT RECIPIENTS and PAST RECIPIENTS.

My thought is to query the loop to get all of the custom_post_types that equal recipient, then display the featured image for all CURRENT recipients (if yes_current is ON) in the Current section, then do the same for PAST recipients in the Past section.

Thank you guys!

CODE:

<h1>CURRENT Recipients</h1>

<?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'on'));

if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop-the_post(); 

<?php get_the_post_thumbnail($page->ID, 'thumbnail'); ?>

<?php endwhile; endif; wp_reset_postdata(); ?>

<h1>PAST Recipients</h1>

<?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'off'));

if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop->the_post(); 

<?php get_the_post_thumbnail($page->ID, 'thumbnail'); ?>

<?php endwhile; endif; wp_reset_postdata(); ?>

This seems like an easy thing to do but I am missing something here. I have a custom post type called "recipient" and a meta check box called "yes_current" - (we help children with cancer and run events for them so we need to know who is a current recipient and who is a past recipient.) We want to display two sections on our RECIPIENT page: CURRENT RECIPIENTS and PAST RECIPIENTS.

My thought is to query the loop to get all of the custom_post_types that equal recipient, then display the featured image for all CURRENT recipients (if yes_current is ON) in the Current section, then do the same for PAST recipients in the Past section.

Thank you guys!

CODE:

<h1>CURRENT Recipients</h1>

<?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'on'));

if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop-the_post(); 

<?php get_the_post_thumbnail($page->ID, 'thumbnail'); ?>

<?php endwhile; endif; wp_reset_postdata(); ?>

<h1>PAST Recipients</h1>

<?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'off'));

if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop->the_post(); 

<?php get_the_post_thumbnail($page->ID, 'thumbnail'); ?>

<?php endwhile; endif; wp_reset_postdata(); ?>

Edit

Custom post meta code:

$meta_boxes[] = array( 'id' => 'yes_current', 'title' => 'Current Recipient', 'pages' => array( 'recipient' ), 'context' => 'side', 'priority' => 'low', 'fields' => array( array( 'name' => 'Current Recipient', 'id' => "{$prefix}yes_current", 'type' => 'checkbox', // Value can be 0 or 1 'std' => 1, ), ),
deleted 4 characters in body
Source Link

This seems like an easy thing to do but I am missing something here. I have a custom post type called "recipient" and a meta check box called "yes_current" - (we help children with cancer and run events for them so we need to know who is a current recipient and who is a past recipient.) We want to display two sections on our RECIPIENT page: CURRENT RECIPIENTS and PAST RECIPIENTS.

My thought is to query the loop to get all of the custom_post_types that equal recipient, then display the featured image for all CURRENT recipients (if yes_current is ON) in the Current section, then do the same for PAST recipients in the Past section.

Thank you guys!

CODE:

<h1>CURRENT Recipients</h1>

<?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'on'));

if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop-the_post(); 

<?php get_the_post_thumbnail($linkvalue$page->ID, 'thumbnail'); ?>

<?php endwhile; endif; wp_reset_postdata(); ?>

<h1>PAST Recipients</h1>

<?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'off'));

if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop->the_post(); 

<?php get_the_post_thumbnail($linkvalue$page->ID, 'thumbnail'); ?>

<?php endwhile; endif; wp_reset_postdata(); ?>

This seems like an easy thing to do but I am missing something here. I have a custom post type called "recipient" and a meta check box called "yes_current" - (we help children with cancer and run events for them so we need to know who is a current recipient and who is a past recipient.) We want to display two sections on our RECIPIENT page: CURRENT RECIPIENTS and PAST RECIPIENTS.

My thought is to query the loop to get all of the custom_post_types that equal recipient, then display the featured image for all CURRENT recipients (if yes_current is ON) in the Current section, then do the same for PAST recipients in the Past section.

Thank you guys!

CODE:

<h1>CURRENT Recipients</h1>

<?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'on'));

if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop-the_post(); 

<?php get_the_post_thumbnail($linkvalue, 'thumbnail'); ?>

<?php endwhile; endif; wp_reset_postdata(); ?>

<h1>PAST Recipients</h1>

<?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'off'));

if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop->the_post(); 

<?php get_the_post_thumbnail($linkvalue, 'thumbnail'); ?>

<?php endwhile; endif; wp_reset_postdata(); ?>

This seems like an easy thing to do but I am missing something here. I have a custom post type called "recipient" and a meta check box called "yes_current" - (we help children with cancer and run events for them so we need to know who is a current recipient and who is a past recipient.) We want to display two sections on our RECIPIENT page: CURRENT RECIPIENTS and PAST RECIPIENTS.

My thought is to query the loop to get all of the custom_post_types that equal recipient, then display the featured image for all CURRENT recipients (if yes_current is ON) in the Current section, then do the same for PAST recipients in the Past section.

Thank you guys!

CODE:

<h1>CURRENT Recipients</h1>

<?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'on'));

if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop-the_post(); 

<?php get_the_post_thumbnail($page->ID, 'thumbnail'); ?>

<?php endwhile; endif; wp_reset_postdata(); ?>

<h1>PAST Recipients</h1>

<?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'off'));

if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop->the_post(); 

<?php get_the_post_thumbnail($page->ID, 'thumbnail'); ?>

<?php endwhile; endif; wp_reset_postdata(); ?>
added 786 characters in body
Source Link

This seems like an easy thing to do but I am missing something here. I have a custom post type called "recipient" and a meta check box called "yes_current" - (we help children with cancer and run events for them so we need to know who is a current recipient and who is a past recipient.) We want to display two sections on our RECIPIENT page: CURRENT RECIPIENTS and PAST RECIPIENTS.

My thought is to query the loop to get all of the custom_post_types that equal recipient, then display the featured image for all CURRENT recipients (if yes_current is ON) in the Current section, then do the same for PAST recipients in the Past section.

Thank you guys!

CODE:

<h1>CURRENT Recipients</h1>

<?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'on'));

if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop-the_post(); 

<?php get_the_post_thumbnail($linkvalue, 'thumbnail'); ?>

<?php endwhile; endif; wp_reset_postdata(); ?>

<h1>PAST Recipients</h1>

<?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'off'));

if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop->the_post(); 

<?php get_the_post_thumbnail($linkvalue, 'thumbnail'); ?>

<?php endwhile; endif; wp_reset_postdata(); ?>

This seems like an easy thing to do but I am missing something here. I have a custom post type called "recipient" and a meta check box called "yes_current" - (we help children with cancer and run events for them so we need to know who is a current recipient and who is a past recipient.) We want to display two sections on our RECIPIENT page: CURRENT RECIPIENTS and PAST RECIPIENTS.

My thought is to query the loop to get all of the custom_post_types that equal recipient, then display the featured image for all CURRENT recipients (if yes_current is ON) in the Current section, then do the same for PAST recipients in the Past section.

Thank you guys!

This seems like an easy thing to do but I am missing something here. I have a custom post type called "recipient" and a meta check box called "yes_current" - (we help children with cancer and run events for them so we need to know who is a current recipient and who is a past recipient.) We want to display two sections on our RECIPIENT page: CURRENT RECIPIENTS and PAST RECIPIENTS.

My thought is to query the loop to get all of the custom_post_types that equal recipient, then display the featured image for all CURRENT recipients (if yes_current is ON) in the Current section, then do the same for PAST recipients in the Past section.

Thank you guys!

CODE:

<h1>CURRENT Recipients</h1>

<?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'on'));

if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop-the_post(); 

<?php get_the_post_thumbnail($linkvalue, 'thumbnail'); ?>

<?php endwhile; endif; wp_reset_postdata(); ?>

<h1>PAST Recipients</h1>

<?php $current_loop = new WP_Query(array('post_type' => 'recipient', 'posts_per_page' => '-1', 'yes_current' => 'off'));

if( $current_loop->have_posts() ): while( $current_loop->have_posts() ): $current_loop->the_post(); 

<?php get_the_post_thumbnail($linkvalue, 'thumbnail'); ?>

<?php endwhile; endif; wp_reset_postdata(); ?>
added 4 characters in body
Source Link
kaiser
  • 50.8k
  • 27
  • 150
  • 244
Loading
Source Link
Loading