Get Custom Fields with Multiple Loops

Community Forums Forums Design Tips and Tricks Get Custom Fields with Multiple Loops

This topic is: resolved

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Susan 1 year, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #42812

    creative.patience
    Participant
    Post count: 9

    I’m creating a home page template that has three custom loops pulling from different categories. The multiple loops correctly pull the first post of each category.

    I’d like to also display the permalink and a custom field in addition to the standard photo/excerpt that’s being displayed, however it appears that this will only pull the link/field for just one post and use the same info for all three loops.

    Does anyone know how to pull the permalink & custom fields for each post when you have multiple loops?

    Below is the code I’m currently using:

    <code>

    function show_cats() {

    echo ‘<div class=”list-categories”>';

    echo ‘<div class=”list-cat-1″>';
    $loop_args = array( ‘cat’ => 2, ‘posts_per_page’ => 1);
    genesis_custom_loop( $loop_args );
    echo genesis_get_custom_field(‘price’);
    echo ‘</div>';
    echo ‘<div class=”list-cat-2>';
    global $query_args;
    $loop_args = array( ‘cat’ => 5, ‘posts_per_page’ => 1);
    genesis_custom_loop( $loop_args );
    echo genesis_get_custom_field(‘price’);

    echo ‘</div>';
    echo ‘<div class=”list-cat-3″>';
    global $query_args;
    $loop_args = array( ‘cat’ => 3, ‘posts_per_page’ => 1, ‘gdsr_sort’ => ‘rating’, ‘gdsr_order’ => ‘desc’ );
    genesis_custom_loop( $loop_args );
    echo genesis_get_custom_field(‘price’);

    echo ‘</div>';

    echo ‘</div>';
    }

    </code>

    #57701

    Susan
    Moderator
    Post count: 9597

    Hi – I’m working through the list of posts with no replies. As you posted a while ago, I hope your issue was resolved. If not, can you please check in here, and I will escalate for you.


    Susan @ Graphically Designing I offer theme customizations I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.