WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Advanced Custom Fields not showing (Custom Post Type UI + ACF) (4 posts)

  1. pmitchum
    Member
    Posted 1 year ago #

    Hi,

    I have successfully installed Custom Post Type UI and Advanced Custom Fields, made a new custom post type and created custom field groups and applied it to my custom post type.

    The problem is that the content is not showing up in twenty eleven template. And I can't figure out why?!

    Here is what I did:

    #1) In CPT I created:
    Post Type name = 'testimonials' (no taxonomy)

    #2) In ACF I created a group = 'Testimonials'
    fields = 'Name (my_name text)' , 'Testimonial (my_testimonial text area)'
    Location = Post type is equal to 'testimonials'

    #3) Next I created a template called testimonials.php in twenty eleven theme and placed the following code:
    `
    <?php
    /**
    * Template Name: Testimonials Template
    *
    * @package WordPress
    * @subpackage Twenty_Eleven
    * @since Twenty Eleven 1.0
    */
    get_header();

    ?>

    <div id="primary">
    <div id="content" role="main">

    <?php while ( have_posts() ) : the_post(); ?>

    <h1><?php the_field('my_name'); ?></h1>
    <p><?php the_field('my_testimonial'); ?></p>

    <p><?php the_content(); ?></p>

    <?php endwhile; // end of the loop. ?>

    </div><!-- #content -->
    </div><!-- #primary -->

    <?php get_footer(); ?>
    '

    #4) I created a new page with the title Testimonials and assigned it the template 'Testimonials'

    And... nothing. The testimonials page displays nothing and the individual testimonial also does not display the single entry.

    Any help would be greatly appreciated.

  2. Pickleburp
    Member
    Posted 1 year ago #

    Are you using default values for the fields in your testing? In other words, did you hand-type in values or just leave them with the default values?

    I was having a very similar issue but I managed to get it working by copying my value out (on the "Edit Page" view in the Dashboard), pasting it back in the same box, and hitting "update." For some reason, that fixed all of the fields.

  3. pmitchum
    Member
    Posted 1 year ago #

    I solved it by adding <?php query_posts('post_type=testimonials'); ?> before the loop.

  4. pmitchum
    Member
    Posted 1 year ago #

    Hope this helps someone.

Topic Closed

This topic has been closed to new replies.

About this Topic