WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] php loop with custom fields (2 posts)

  1. Adam
    Member
    Posted 2 years ago #

    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;
  2. Adam
    Member
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic