WP Manifestindependent plugin directory
manifest / content / wp-swift-location-cpt

WP Swift: Location CPT

WP Swift: Location CPT

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/wp-swift-wordpress-plugins/wp-swift-location-cpt/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Usage

Example php output of location CPTs.


<?php 

$posts = get_posts(array(
    'posts_per_page'    => -1,
    'post_type'         => 'location', 
));

if( $posts ): ?>

    <div class="grid-x" id="locations-grid">

    <?php foreach( $posts as $post ): 

        setup_postdata( $post );

        ?>
        <div class="cell auto">
            <h5><?php the_title(); ?></h5>

            <?php if ( get_field('address') ) : ?>
                <div class="address">
                    <?php echo get_field('address'); ?>
                </div>
            <?php endif; ?>

            <?php if ( have_rows('contact_numbers') ) : ?>

                <div class="phone-number-groups">

                    <?php while( have_rows('contact_numbers') ) : the_row();

                        $label = get_sub_field('label'); 
                        $number = get_sub_field('number');
                        ?>
                        <div class="phone-number-group">
                            <span class="phone-label"><?php echo $label; ?>: </span>
                            <span class="phone-number"><?php echo wp_swift_format_number_link($number); ?></span>
                        </div>

                    <?php endwhile; ?>
                    <div class="appoint">(By Appointment Only)</div>

                </div>

            <?php endif; ?>
        </div>

    <?php endforeach; ?>

    </div>

    <?php wp_reset_postdata(); ?>

<?php endif; ?>