Support » Fixing WordPress » php loop with custom fields

  • Resolved Adam


    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.


    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)
Viewing 1 replies (of 1 total)
  • The topic ‘php loop with custom fields’ is closed to new replies.