• 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

Custom Template to display Advanced Custom Fields

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 › Custom Template to display Advanced Custom Fields

This topic is: not resolved

Tagged: advanced custom fields, custom loop, Custom Post Type, page template

  • This topic has 2 replies, 2 voices, and was last updated 10 years, 4 months ago by klorimier.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • August 19, 2015 at 12:24 am #162811
    klorimier
    Member

    Hello all,
    I have been successfully working my way through the basics of Genesis but now I am stumped. I have created a CPT, created archive.php and single.php pages but now I am trying to get my Advanced Custom Fields to display on a new template that uses a custom loop and removes the standard loop.

    Hope someone can help find my php or structural error. I have been at this for hours. Here is my code so far:

    <?php

    /**
    * Template Name: Resource Template
    * Description: Used as a page template to show Resources by taxonomy
    * through the "Resource" post type
    */

    // remove default loop
    remove_action( 'genesis_loop', 'genesis_do_loop' );

    // custom loop
    add_action( 'genesis_loop', 'kl_custom_loop');

    function kl_custom_loop() {
    global $paged;

    $args = array(
    'post_type' => 'resource',
    'order' => 'ASC',
    );

    $loop = new WP_Query( $args );

    <?php if ( $loop->have_posts() ) :

    while( $loop->have_posts() ) : the_post(); ?>

    <div class="resource-info">

    • <?php _e('Name of Resource', 'resource'); ?>: <?php the_field('resource_name'); ?>
    • <?php _e('Resource Image', 'resource'); ?>: <?php the_field('resource_image'); ?>
    • " target="_blank"><?php _e('Resource Link', 'resource'); ?>
    • <?php _e('Resource Description', 'resource'); ?>: <?php the_field('resource_description'); ?>/10
    • <?php _e('Contact Information', 'resource'); ?>: <?php the_field('contact_information'); ?>/10

    </div>

    <?php endwhile; ?>
    <?php endif; ?>
    }

    genesis();

    http://klorimierdesign.com/septa
    August 19, 2015 at 11:31 am #162862
    Christoph
    Member

    Hi,

    wrap the ACF fields in a function and use an add_action to place it where you want.

    Here are some examples
    https://wpbeaches.com/coding-a-slider-with-slick-and-acf-pro-in-wordpress/
    http://thestizmedia.com/front-end-posting-with-acf-pro/


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    August 19, 2015 at 11:40 am #162867
    klorimier
    Member

    Thanks. I am going to work on this tonight. I feel like I "almost" get it.

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 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

© 2025 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