Title: php loop with custom fields
Last modified: August 20, 2016

---

# php loop with custom fields

 *  Resolved [Adam](https://wordpress.org/support/users/adamgoldman47yahoocom/)
 * (@adamgoldman47yahoocom)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/php-loop-with-custom-fields/)
 * Sup fellow awesome WP contributers!
 * Got me a clients wants to manually choose for each page, which OTHER pages’ excerpts
   to display.
 * I know how to manually make the code for excerpts one by one …
    (see the ‘bottom_article_1’
   thingie below, it calls information from custom field) … question is how do i
   dynamically create these in a loop according to what client fills in custom field.
   So if client fills one page id in custom field, only that excerpt show.
 * If client fills three pages id’s, three excerpts show.
 * Ideas?
 *     ```
       global $post;
       global $wp_query;
       		$active_page = $wp_query->post->ID;
       		$post_id = get_post_meta($active_page, 'bottom_article_1', true);
       		$queried_post = get_post($post_id);
       		$title = $queried_post->post_title;
       		$author = $queried_post->post_author;
       		$user_info = get_userdata($author);
   
               $first_name = $user_info->first_name;
               $last_name = $user_info->last_name;
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [Adam](https://wordpress.org/support/users/adamgoldman47yahoocom/)
 * (@adamgoldman47yahoocom)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/php-loop-with-custom-fields/#post-2838393)
 * Found the solution here:
    [http://www.graphicbeacon.com/web-design-development/how-to-split-and-categorize-wordpress-custom-field-values/](http://www.graphicbeacon.com/web-design-development/how-to-split-and-categorize-wordpress-custom-field-values/)
 * Marked as closed.

Viewing 1 replies (of 1 total)

The topic ‘php loop with custom fields’ is closed to new replies.

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)
 * [php loop](https://wordpress.org/support/topic-tag/php-loop/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [Adam](https://wordpress.org/support/users/adamgoldman47yahoocom/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/php-loop-with-custom-fields/#post-2838393)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
