Skip to main content
added 381 characters in body
Source Link
nikibrown
  • 71
  • 1
  • 3
  • 10

3/17/2015 update

So it appears that this is a known issue with ACF and multisite using switch_to_blog.

http://support.advancedcustomfields.com/forums/topic/multisite-switch_to_blog-options-issue/

Exporting the fields to my sub-sites within the plugin worked. Hardcoding the custom fields into the functions.php file does not seem to work for multisite.


I have a multisite install with 3 site. Site #1 is the 'main' site running on the main theme. Sites #2 and #3 run on a slightly different theme.

So I have a multisite install with 3 site. Site #1 is the 'main' site running on the main theme. Sites #2 and #3 run on a slightly different theme.

3/17/2015 update

So it appears that this is a known issue with ACF and multisite using switch_to_blog.

http://support.advancedcustomfields.com/forums/topic/multisite-switch_to_blog-options-issue/

Exporting the fields to my sub-sites within the plugin worked. Hardcoding the custom fields into the functions.php file does not seem to work for multisite.


I have a multisite install with 3 site. Site #1 is the 'main' site running on the main theme. Sites #2 and #3 run on a slightly different theme.

added 110 characters in body
Source Link
nikibrown
  • 71
  • 1
  • 3
  • 10
<?php switch_to_blog(2); //boston offices ?>
'office','pagination' => false,'posts_per_page' => '-1','order' => 'ASC','orderby' => 'title',);// The Query$office2 = new WP_Query( $args);?>have_posts()):?>have_posts()): $office2->the_post();?>
<?php
// WP_Query arguments
$args = array (
        'post_type'              => 'office',
        'pagination'             => false,
        'posts_per_page'         => '-1',
        'order'                  => 'ASC',
        'orderby'                  => 'title',
);
// The Query
$office2 = new WP_Query( $args ); ?>
<?php if ($office2->have_posts()): ?>
<?php while ($office2->have_posts()) : $office2->the_post(); ?>
        <li class="text--center grid__item one-quarter s-one-whole xs-one- whole space all-cities all-neighborhoods all-types
            <?php $getslugid = wp_get_post_terms( $post->ID, 'space-type' );
                    foreach( $getslugid as $thisslug ) {
                            echo ' ' . $thisslug->slug . ' ';
                    }
            ?>

            <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                    <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                            <?php echo get_the_slug( $p->ID ); ?>
                    <?php endforeach; ?>
            <?php endif; ?>

            <?php print strtolower(get_bloginfo('name')); ?>
    ">
            <?php
                    $count = 0;
                    if( have_rows('space_images') ): ?>
                <?php while( have_rows('space_images') ): the_row();
                    $count++;
                    $image = get_sub_field('space_image');
                ?>
                    <?php if ($count == 1) { // grab the first image?>
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <img src="<?php echo $image; ?>">
                            </a>
                        <?php } else { // nothing -- we only want the first image to display?>
                        <?php }  ?>
                    <?php endwhile; ?>
            <?php endif; ?>
            <hgroup>
                    <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                            <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                                    <h6 class="hN"><?php echo get_the_title( $p->ID ); ?></h6>
                            <?php endforeach; ?>
                    <?php endif; ?>
                    <h5 class="hN">
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <?php the_title(); ?>
                            </a>
                    </h5>
                    <p class="hN"><?php the_field('office_address'); ?></p>
                    <p class="hN">
                            <?php if( has_term( 'coworking-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg coworking-space"></i> Coworking Space
                             <?php } ?>
                             <?php if( has_term( 'shared-office-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg shared-office-space"></i> Shared Office Space
                             <?php } ?>
                    </p>
            </hgroup>      
    </li><!--/.room-->
'office','pagination' => false,'posts_per_page' => '-1','order' => 'ASC','orderby' => 'title',);// The Query$office3 = new WP_Query( $args);?>have_posts()):?>have_posts()): $office3->the_post();?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php endif;  // end loop?>
<?php restore_current_blog(); ?>
 
 
 
<?php switch_to_blog(3); //beyond boston offices?>

<?php
// WP_Query arguments
$args = array (
        'post_type'              => 'office',
        'pagination'             => false,
        'posts_per_page'         => '-1',
        'order'                  => 'ASC',
        'orderby'                  => 'title',
);
// The Query
$office3 = new WP_Query( $args ); ?>
<?php if ($office3->have_posts()): ?>
<?php while ($office3->have_posts()) : $office3->the_post(); ?>
    <li class="text--center grid__item one-quarter s-one-whole xs-one-whole space all-cities all-neighborhoods all-types
            <?php $getslugid = wp_get_post_terms( $post->ID, 'space-type' );
                    foreach( $getslugid as $thisslug ) {
                            echo ' ' . $thisslug->slug . ' ';
                    }
            ?>
            <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                    <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                            <?php echo get_the_slug( $p->ID ); ?>
                    <?php endforeach; ?>
            <?php endif; ?>

            <?php print strtolower(get_bloginfo('name')); ?>
    ">
            <?php
                    $count = 0;
                    if( have_rows('space_images') ): ?>
                <?php while( have_rows('space_images') ): the_row();
                    $count++;
                    $image = get_sub_field('space_image');
                ?>
                    <?php if ($count == 1) { // grab the first image?>
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <img src="<?php echo $image; ?>">
                            </a>
                        <?php } else { // nothing -- we only want the first image to display?>
                        <?php }  ?>
                    <?php endwhile; ?>
            <?php endif; ?>
            <hgroup>
                    <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                            <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                                    <h6 class="hN"><?php echo get_the_title( $p->ID ); ?></h6>
                            <?php endforeach; ?>
                    <?php endif; ?>
                    <h5 class="hN">
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <?php the_title(); ?>
                            </a>
                    </h5>
                    <p class="hN"><?php the_field('office_address'); ?></p>
                    <p class="hN">
                            <?php if( has_term( 'coworking-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg coworking-space"></i> Coworking Space
                             <?php } ?>
                             <?php if( has_term( 'shared-office-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg shared-office-space"></i> Shared Office Space
                             <?php } ?>
                    </p>
            </hgroup>      
    </li><!--/.room-->
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php endif;  // end loop?>
<?php restore_current_blog(); ?>
<?php switch_to_blog(2); //boston offices ?>
'office','pagination' => false,'posts_per_page' => '-1','order' => 'ASC','orderby' => 'title',);// The Query$office2 = new WP_Query( $args);?>have_posts()):?>have_posts()): $office2->the_post();?>
    <li class="text--center grid__item one-quarter s-one-whole xs-one-whole space all-cities all-neighborhoods all-types
            <?php $getslugid = wp_get_post_terms( $post->ID, 'space-type' );
                    foreach( $getslugid as $thisslug ) {
                            echo ' ' . $thisslug->slug . ' ';
                    }
            ?>

            <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                    <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                            <?php echo get_the_slug( $p->ID ); ?>
                    <?php endforeach; ?>
            <?php endif; ?>

            <?php print strtolower(get_bloginfo('name')); ?>
    ">
            <?php
                    $count = 0;
                    if( have_rows('space_images') ): ?>
                <?php while( have_rows('space_images') ): the_row();
                    $count++;
                    $image = get_sub_field('space_image');
                ?>
                    <?php if ($count == 1) { // grab the first image?>
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <img src="<?php echo $image; ?>">
                            </a>
                        <?php } else { // nothing -- we only want the first image to display?>
                        <?php }  ?>
                    <?php endwhile; ?>
            <?php endif; ?>
            <hgroup>
                    <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                            <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                                    <h6 class="hN"><?php echo get_the_title( $p->ID ); ?></h6>
                            <?php endforeach; ?>
                    <?php endif; ?>
                    <h5 class="hN">
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <?php the_title(); ?>
                            </a>
                    </h5>
                    <p class="hN"><?php the_field('office_address'); ?></p>
                    <p class="hN">
                            <?php if( has_term( 'coworking-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg coworking-space"></i> Coworking Space
                             <?php } ?>
                             <?php if( has_term( 'shared-office-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg shared-office-space"></i> Shared Office Space
                             <?php } ?>
                    </p>
            </hgroup>      
    </li><!--/.room-->
'office','pagination' => false,'posts_per_page' => '-1','order' => 'ASC','orderby' => 'title',);// The Query$office3 = new WP_Query( $args);?>have_posts()):?>have_posts()): $office3->the_post();?>
    <li class="text--center grid__item one-quarter s-one-whole xs-one-whole space all-cities all-neighborhoods all-types
            <?php $getslugid = wp_get_post_terms( $post->ID, 'space-type' );
                    foreach( $getslugid as $thisslug ) {
                            echo ' ' . $thisslug->slug . ' ';
                    }
            ?>
            <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                    <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                            <?php echo get_the_slug( $p->ID ); ?>
                    <?php endforeach; ?>
            <?php endif; ?>

            <?php print strtolower(get_bloginfo('name')); ?>
    ">
            <?php
                    $count = 0;
                    if( have_rows('space_images') ): ?>
                <?php while( have_rows('space_images') ): the_row();
                    $count++;
                    $image = get_sub_field('space_image');
                ?>
                    <?php if ($count == 1) { // grab the first image?>
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <img src="<?php echo $image; ?>">
                            </a>
                        <?php } else { // nothing -- we only want the first image to display?>
                        <?php }  ?>
                    <?php endwhile; ?>
            <?php endif; ?>
            <hgroup>
                    <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                            <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                                    <h6 class="hN"><?php echo get_the_title( $p->ID ); ?></h6>
                            <?php endforeach; ?>
                    <?php endif; ?>
                    <h5 class="hN">
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <?php the_title(); ?>
                            </a>
                    </h5>
                    <p class="hN"><?php the_field('office_address'); ?></p>
                    <p class="hN">
                            <?php if( has_term( 'coworking-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg coworking-space"></i> Coworking Space
                             <?php } ?>
                             <?php if( has_term( 'shared-office-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg shared-office-space"></i> Shared Office Space
                             <?php } ?>
                    </p>
            </hgroup>      
    </li><!--/.room-->
<?php switch_to_blog(2); //boston offices ?>
<?php
// WP_Query arguments
$args = array (
        'post_type'              => 'office',
        'pagination'             => false,
        'posts_per_page'         => '-1',
        'order'                  => 'ASC',
        'orderby'                  => 'title',
);
// The Query
$office2 = new WP_Query( $args ); ?>
<?php if ($office2->have_posts()): ?>
<?php while ($office2->have_posts()) : $office2->the_post(); ?>
        <li class="text--center grid__item one-quarter s-one-whole xs-one whole space all-cities all-neighborhoods all-types
            <?php $getslugid = wp_get_post_terms( $post->ID, 'space-type' );
                    foreach( $getslugid as $thisslug ) {
                            echo ' ' . $thisslug->slug . ' ';
                    }
            ?>

            <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                    <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                            <?php echo get_the_slug( $p->ID ); ?>
                    <?php endforeach; ?>
            <?php endif; ?>

            <?php print strtolower(get_bloginfo('name')); ?>
    ">
            <?php
                    $count = 0;
                    if( have_rows('space_images') ): ?>
                <?php while( have_rows('space_images') ): the_row();
                    $count++;
                    $image = get_sub_field('space_image');
                ?>
                    <?php if ($count == 1) { // grab the first image?>
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <img src="<?php echo $image; ?>">
                            </a>
                        <?php } else { // nothing -- we only want the first image to display?>
                        <?php }  ?>
                    <?php endwhile; ?>
            <?php endif; ?>
            <hgroup>
                    <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                            <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                                    <h6 class="hN"><?php echo get_the_title( $p->ID ); ?></h6>
                            <?php endforeach; ?>
                    <?php endif; ?>
                    <h5 class="hN">
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <?php the_title(); ?>
                            </a>
                    </h5>
                    <p class="hN"><?php the_field('office_address'); ?></p>
                    <p class="hN">
                            <?php if( has_term( 'coworking-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg coworking-space"></i> Coworking Space
                             <?php } ?>
                             <?php if( has_term( 'shared-office-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg shared-office-space"></i> Shared Office Space
                             <?php } ?>
                    </p>
            </hgroup>      
    </li><!--/.room-->
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php endif;  // end loop?>
<?php restore_current_blog(); ?>
 
 
 
<?php switch_to_blog(3); //beyond boston offices?>

<?php
// WP_Query arguments
$args = array (
        'post_type'              => 'office',
        'pagination'             => false,
        'posts_per_page'         => '-1',
        'order'                  => 'ASC',
        'orderby'                  => 'title',
);
// The Query
$office3 = new WP_Query( $args ); ?>
<?php if ($office3->have_posts()): ?>
<?php while ($office3->have_posts()) : $office3->the_post(); ?>
    <li class="text--center grid__item one-quarter s-one-whole xs-one-whole space all-cities all-neighborhoods all-types
            <?php $getslugid = wp_get_post_terms( $post->ID, 'space-type' );
                    foreach( $getslugid as $thisslug ) {
                            echo ' ' . $thisslug->slug . ' ';
                    }
            ?>
            <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                    <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                            <?php echo get_the_slug( $p->ID ); ?>
                    <?php endforeach; ?>
            <?php endif; ?>

            <?php print strtolower(get_bloginfo('name')); ?>
    ">
            <?php
                    $count = 0;
                    if( have_rows('space_images') ): ?>
                <?php while( have_rows('space_images') ): the_row();
                    $count++;
                    $image = get_sub_field('space_image');
                ?>
                    <?php if ($count == 1) { // grab the first image?>
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <img src="<?php echo $image; ?>">
                            </a>
                        <?php } else { // nothing -- we only want the first image to display?>
                        <?php }  ?>
                    <?php endwhile; ?>
            <?php endif; ?>
            <hgroup>
                    <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                            <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                                    <h6 class="hN"><?php echo get_the_title( $p->ID ); ?></h6>
                            <?php endforeach; ?>
                    <?php endif; ?>
                    <h5 class="hN">
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <?php the_title(); ?>
                            </a>
                    </h5>
                    <p class="hN"><?php the_field('office_address'); ?></p>
                    <p class="hN">
                            <?php if( has_term( 'coworking-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg coworking-space"></i> Coworking Space
                             <?php } ?>
                             <?php if( has_term( 'shared-office-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg shared-office-space"></i> Shared Office Space
                             <?php } ?>
                    </p>
            </hgroup>      
    </li><!--/.room-->
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php endif;  // end loop?>
<?php restore_current_blog(); ?>
added 7572 characters in body
Source Link
nikibrown
  • 71
  • 1
  • 3
  • 10
<?php switch_to_blog(2); //boston offices ?>
'office','pagination' => false,'posts_per_page' => '-1','order' => 'ASC','orderby' => 'title',);// The Query$office2 = new WP_Query( $args);?>have_posts()):?>have_posts()): $office2->the_post();?>
    <li class="text--center grid__item one-quarter s-one-whole xs-one-whole space all-cities all-neighborhoods all-types
            <?php $getslugid = wp_get_post_terms( $post->ID, 'space-type' );
                    foreach( $getslugid as $thisslug ) {
                            echo ' ' . $thisslug->slug . ' ';
                    }
            ?>

            <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                    <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                            <?php echo get_the_slug( $p->ID ); ?>
                    <?php endforeach; ?>
            <?php endif; ?>

            <?php print strtolower(get_bloginfo('name')); ?>
    ">
            <?php
                    $count = 0;
                    if( have_rows('space_images') ): ?>
                <?php while( have_rows('space_images') ): the_row();
                    $count++;
                    $image = get_sub_field('space_image');
                ?>
                    <?php if ($count == 1) { // grab the first image?>
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <img src="<?php echo $image; ?>">
                            </a>
                        <?php } else { // nothing -- we only want the first image to display?>
                        <?php }  ?>
                    <?php endwhile; ?>
            <?php endif; ?>
            <hgroup>
                    <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                            <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                                    <h6 class="hN"><?php echo get_the_title( $p->ID ); ?></h6>
                            <?php endforeach; ?>
                    <?php endif; ?>
                    <h5 class="hN">
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <?php the_title(); ?>
                            </a>
                    </h5>
                    <p class="hN"><?php the_field('office_address'); ?></p>
                    <p class="hN">
                            <?php if( has_term( 'coworking-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg coworking-space"></i> Coworking Space
                             <?php } ?>
                             <?php if( has_term( 'shared-office-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg shared-office-space"></i> Shared Office Space
                             <?php } ?>
                    </p>
            </hgroup>      
    </li><!--/.room-->
'office','pagination' => false,'posts_per_page' => '-1','order' => 'ASC','orderby' => 'title',);// The Query$office3 = new WP_Query( $args);?>have_posts()):?>have_posts()): $office3->the_post();?>
    <li class="text--center grid__item one-quarter s-one-whole xs-one-whole space all-cities all-neighborhoods all-types
            <?php $getslugid = wp_get_post_terms( $post->ID, 'space-type' );
                    foreach( $getslugid as $thisslug ) {
                            echo ' ' . $thisslug->slug . ' ';
                    }
            ?>
            <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                    <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                            <?php echo get_the_slug( $p->ID ); ?>
                    <?php endforeach; ?>
            <?php endif; ?>

            <?php print strtolower(get_bloginfo('name')); ?>
    ">
            <?php
                    $count = 0;
                    if( have_rows('space_images') ): ?>
                <?php while( have_rows('space_images') ): the_row();
                    $count++;
                    $image = get_sub_field('space_image');
                ?>
                    <?php if ($count == 1) { // grab the first image?>
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <img src="<?php echo $image; ?>">
                            </a>
                        <?php } else { // nothing -- we only want the first image to display?>
                        <?php }  ?>
                    <?php endwhile; ?>
            <?php endif; ?>
            <hgroup>
                    <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                            <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                                    <h6 class="hN"><?php echo get_the_title( $p->ID ); ?></h6>
                            <?php endforeach; ?>
                    <?php endif; ?>
                    <h5 class="hN">
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <?php the_title(); ?>
                            </a>
                    </h5>
                    <p class="hN"><?php the_field('office_address'); ?></p>
                    <p class="hN">
                            <?php if( has_term( 'coworking-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg coworking-space"></i> Coworking Space
                             <?php } ?>
                             <?php if( has_term( 'shared-office-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg shared-office-space"></i> Shared Office Space
                             <?php } ?>
                    </p>
            </hgroup>      
    </li><!--/.room-->

Screenshot of how wp_query displays info for site #2 listing: http://glui.me/?i=td352h9crydphu3/2015-03-06_at_5.31_PM.png/ Site 2 working example

Screenshot of wp_query errors for site #3 listing http://glui.me/?i=m2jmwy871harhnh/2015-03-06_at_5.32_PM.png/ Site 3 not working

Screenshot of how wp_query displays info for site #2 listing: http://glui.me/?i=td352h9crydphu3/2015-03-06_at_5.31_PM.png/

Screenshot of wp_query errors for site #3 listing http://glui.me/?i=m2jmwy871harhnh/2015-03-06_at_5.32_PM.png/

<?php switch_to_blog(2); //boston offices ?>
'office','pagination' => false,'posts_per_page' => '-1','order' => 'ASC','orderby' => 'title',);// The Query$office2 = new WP_Query( $args);?>have_posts()):?>have_posts()): $office2->the_post();?>
    <li class="text--center grid__item one-quarter s-one-whole xs-one-whole space all-cities all-neighborhoods all-types
            <?php $getslugid = wp_get_post_terms( $post->ID, 'space-type' );
                    foreach( $getslugid as $thisslug ) {
                            echo ' ' . $thisslug->slug . ' ';
                    }
            ?>

            <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                    <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                            <?php echo get_the_slug( $p->ID ); ?>
                    <?php endforeach; ?>
            <?php endif; ?>

            <?php print strtolower(get_bloginfo('name')); ?>
    ">
            <?php
                    $count = 0;
                    if( have_rows('space_images') ): ?>
                <?php while( have_rows('space_images') ): the_row();
                    $count++;
                    $image = get_sub_field('space_image');
                ?>
                    <?php if ($count == 1) { // grab the first image?>
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <img src="<?php echo $image; ?>">
                            </a>
                        <?php } else { // nothing -- we only want the first image to display?>
                        <?php }  ?>
                    <?php endwhile; ?>
            <?php endif; ?>
            <hgroup>
                    <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                            <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                                    <h6 class="hN"><?php echo get_the_title( $p->ID ); ?></h6>
                            <?php endforeach; ?>
                    <?php endif; ?>
                    <h5 class="hN">
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <?php the_title(); ?>
                            </a>
                    </h5>
                    <p class="hN"><?php the_field('office_address'); ?></p>
                    <p class="hN">
                            <?php if( has_term( 'coworking-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg coworking-space"></i> Coworking Space
                             <?php } ?>
                             <?php if( has_term( 'shared-office-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg shared-office-space"></i> Shared Office Space
                             <?php } ?>
                    </p>
            </hgroup>      
    </li><!--/.room-->
'office','pagination' => false,'posts_per_page' => '-1','order' => 'ASC','orderby' => 'title',);// The Query$office3 = new WP_Query( $args);?>have_posts()):?>have_posts()): $office3->the_post();?>
    <li class="text--center grid__item one-quarter s-one-whole xs-one-whole space all-cities all-neighborhoods all-types
            <?php $getslugid = wp_get_post_terms( $post->ID, 'space-type' );
                    foreach( $getslugid as $thisslug ) {
                            echo ' ' . $thisslug->slug . ' ';
                    }
            ?>
            <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                    <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                            <?php echo get_the_slug( $p->ID ); ?>
                    <?php endforeach; ?>
            <?php endif; ?>

            <?php print strtolower(get_bloginfo('name')); ?>
    ">
            <?php
                    $count = 0;
                    if( have_rows('space_images') ): ?>
                <?php while( have_rows('space_images') ): the_row();
                    $count++;
                    $image = get_sub_field('space_image');
                ?>
                    <?php if ($count == 1) { // grab the first image?>
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <img src="<?php echo $image; ?>">
                            </a>
                        <?php } else { // nothing -- we only want the first image to display?>
                        <?php }  ?>
                    <?php endwhile; ?>
            <?php endif; ?>
            <hgroup>
                    <?php $posts = get_field('neighborhood_name'); if( $posts ): ?>
                            <?php foreach( $posts as $p): // variable must be called $post (IMPORTANT) ?>
                                    <h6 class="hN"><?php echo get_the_title( $p->ID ); ?></h6>
                            <?php endforeach; ?>
                    <?php endif; ?>
                    <h5 class="hN">
                            <a href="<?php the_field('space_neighborhood_parent'); ?>#<?php the_field('office_url_hash'); ?>">
                                    <?php the_title(); ?>
                            </a>
                    </h5>
                    <p class="hN"><?php the_field('office_address'); ?></p>
                    <p class="hN">
                            <?php if( has_term( 'coworking-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg coworking-space"></i> Coworking Space
                             <?php } ?>
                             <?php if( has_term( 'shared-office-space', 'space-type', $post->ID ) ) { ?>
                                    <i class="fa fa-lg shared-office-space"></i> Shared Office Space
                             <?php } ?>
                    </p>
            </hgroup>      
    </li><!--/.room-->

Screenshot of how wp_query displays info for site #2 listing: http://glui.me/?i=td352h9crydphu3/2015-03-06_at_5.31_PM.png/ Site 2 working example

Screenshot of wp_query errors for site #3 listing http://glui.me/?i=m2jmwy871harhnh/2015-03-06_at_5.32_PM.png/ Site 3 not working

Source Link
nikibrown
  • 71
  • 1
  • 3
  • 10
Loading