0
votes

I am trying to customize the post and installed Advanced Custom Field plugin. The custom field is showing in the editor but when I add all the_field('fieldname') to the single post page, it shows in the post but they are all in one line.

The theme that I am using is Twenty Fourteen. Below is the loop were I placed the fields

<?php
            // Start the Loop.
            while ( have_posts() ) : the_post();


            get_template_part( 'content', get_post_format() );
            the_field('make');
            the_field('type');
            the_field('year');
            the_field('hours');
            the_field('location');
            the_field('specifications');

            // Previous/next post navigation.
            twentyfourteen_post_nav();

            // If comments are open or we have at least one comment, load up the comment template.
            if ( comments_open() || get_comments_number() ) {
                            comments_template();
                        }
            endwhile;
    ?>

It comes out like this on the post: http://www.hamburgheros.com/2014/02/12/klemm-kr-909-1/

I want it to come out like this:

Make: KLEMM KR 909-1 Type: Drills Year: 2012 Hours: 100 Location: Germany Specifications: Multi-Purpose / Anchor Drill Rig

Deutz Engine TCD 2013 L4 2V – 129 KW / 175 HP (EPA / TIERIII)
Crawler type B1 / 400 mm 3-grouser pads
Drill mast type 305
Hammer KD1624
Different options for double head drilling units and rotary heads
Different options for clamping and breaking devices
Remote controlled drilling functions
Second articulation cylinder
Winch
Flushing 1” / 1 ½ “
Oiler 8 l, 20 bar
Weight:  13 t

I tried the_field('field name') \n; but it does not work. And how do you make it the field name appear also?

Please help, I will appreciate it very much.

Al Sev

1

1 Answers

0
votes

the_field only returns the data associated with the entry - you have to add the labels yourself along with some HTML to style the output, for instance;

<?php
        // Start the Loop.
        while ( have_posts() ) : the_post();


        get_template_part( 'content', get_post_format() );

        ?>
        <ul>
            <li>MAKE: <?php the_field('make'); ?></li>
            <li>TYPE: <?php the_field('type'); ?></li>
            <li>YEAR: <?php the_field('year'); ?></li>
            <li>HOURS: <?php the_field('hours'); ?></li>
            <li>LOCATION: <?php the_field('location'); ?></li>
            <li>SPEC: <?php the_field('specifications'); ?></li>
        </ul>

        // Previous/next post navigation.
        twentyfourteen_post_nav();

        // If comments are open or we have at least one comment, load up the comment template.
        if ( comments_open() || get_comments_number() ) {
                        comments_template();
                    }
        endwhile;
?>