Home Forums General Issues All fields from one field group in one frontent array?


All fields from one field group in one frontent array?

  • Hi there,

    I must stres out that i’m not a developer so i might use some “unsupported” terms :).

    Ok the issue, i have created custom post type called Firm. Also i have created field group with 7 fields (text fields mainly, including website URL field and Google map field) and i have made template that displays those fields on frontend page. Once it’s saved all data is saved in database and new post under post type Firm is created. So that all works great. The main problem/question is:

    How can i display all new posts in that post type (Firm) on one page? I know i must create some loop, array for those posts, but as i said i’m not developer so i’m kind of stuck with this one.

    If someone could give me a hint or some link, or any kind of pointers so i could figure out in what direction to go. Thanks in advance for your answers.

  • <?php
                            $args = array( 'post_type' => 'company', 'posts_per_page' => 15 );
                            $loop = new WP_Query( $args );
                            while ( $loop->have_posts() ) : $loop->the_post(); ?>
                            <div class="boxy">
                            <div class="acf_company_name">
                            <h5>Company Name: </h5>
                            <p><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_field('company_name'); ?></a></p>
                            <div class="acf_full_name">
                            <h5>Full Name: </h5>
                            <?php the_field('full_name'); ?>
                            <div class="acf_vat">
                            <h5>VAT: </h5>
                            <?php the_field('vat'); ?>
                            <div class="acf_email">
                            <h5>E-mail: </h5>
                            <a href="mailto:<?php the_field('email'); ?>"><?php the_field('email'); ?></a>
                            <div class="acf_website">
                            <h5>Official website: </h5>
                            <?php the_field('website'); ?>
                            <?php if ( get_field('logo_company') ) : ?>
                            <div class="acf_logo_company"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php $image = get_field(logo_company); ?>
                            <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /></a></div>
                            <?php endif; ?>
                            <div class="acf_company_location"><?php $location = get_field('company_location');?>
                            <div class="acf-map">
    	                        <div class="marker" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>" data-lng="<?php echo $location['address']; ?>"></div>
                            <div class="acf_company_location">
                            <h5>Company location: </h5>
                            <?php the_field('company_location'); ?>
                            <?php endwhile; ?>
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘All fields from one field group in one frontent array?’ is closed to new replies.