• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Get Custom Fields with Multiple Loops

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

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

This topic is: resolved

Tagged: loop

  • This topic has 1 reply, 2 voices, and was last updated 10 years, 3 months ago by Susan.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • May 27, 2013 at 12:11 pm #42812
    creative.patience
    Member

    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>

    August 20, 2013 at 2:45 pm #57701
    Susan
    Moderator

    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.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble