WordPress.org

Ready to get started?Download WordPress

Forums

Simple Fields
[resolved] Fields not being called after custom loop query (3 posts)

  1. phantomdentist
    Member
    Posted 3 years ago #

    Hi, awesome plugin. When call simple fields fields after a custom loop query the do not work, not called I assume. With the custom loops removed from above they work fine.

    Below are the custom loops (which are in the header) follow by the custom field calls which are in a custom page template)

    <div class="panes-banner">
                        <?php
    							$query = 'post_type=banner-slider&showposts='.$theme_options_banner_number_of_sliders.'&orderby=menu_order&order=ASC';
    							$queryObject = new WP_Query($query);
    							// The Loop...
    							if ($queryObject->have_posts()) {
    								while ($queryObject->have_posts()) {
    									$queryObject->the_post();
    							?> 
    
            					<div>
    								<h2><a class="banner-link" href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a></h2>
                                    <?php the_content(); ?>
    							</div>
    							<?php
    								}
    							}
    							?>
                    </div>
    
                                      <!-- the tabs -->
                    <ul class="tabs-banner">
                       <?php
    							$query = 'post_type=banner-slider&showposts='.$theme_options_banner_number_of_sliders.'&orderby=menu_order&order=ASC';
    							$queryObject = new WP_Query($query);
    							// The Loop...
    							if ($queryObject->have_posts()) {
    								while ($queryObject->have_posts()) {
    									$queryObject->the_post();
    							?>
    
    								<li><a class="banner-link" href="#"> </a></li>
    
    							<?php
    								}
    							}
    							?>
                    </ul>
    <div class="home-website-design-section margin-right-80">
            <h2>Website Design</h2>
            <?php $website_design_blurb = simple_fields_get_post_value(get_the_id(), array(1, 1), true);
                echo "<span class='meta-value_website_design_blurb'>$website_design_blurb</span>";?>
            </div><!-- end home-website-design-section -->
    
            <div class="home-graphic-design-section">
            <h2>Graphic Design</h2>
            <?php $graphic_design_blurb = simple_fields_get_post_value(get_the_id(), array(1, 2), true);
                echo "<span class='meta-value_graphic_design_blurb'>$graphic_design_blurb</span>";?>
            </div><!-- end home-graphic-design-section -->
    
            <div class="home-multimedia-section margin-right-80">
            <h2>Multimedia</h2>
            <?php $multimedia_blurb = simple_fields_get_post_value(get_the_id(), array(1, 3), true);
                echo "<span class='meta-value_multimedia_blurb'>$multimedia_blurb</span>";?>
            </div><!-- end home-multimedia-section -->
    
            <div class="home-internet-marketing-section">
            <h2>Internet Marketing</h2>
            <?php $internet_marketing_blurb = simple_fields_get_post_value(get_the_id(), array(1, 4), true);
                echo "<span class='meta-value_internet_marketing_blurb'>$internet_marketing_blurb</span>";?>
            </div> <!-- end home-internet-marketing-section -->

    http://wordpress.org/extend/plugins/simple-fields/

  2. Pär Thernström
    Member
    Plugin Author

    Posted 3 years ago #

    Hi, can you try this:
    Before your custom loop, add this:

    ----

    $post_org = $post;

    ---

    And then after the custom loops, before the first call to simple fields add this:

    ---

    $post = $post_org;
    setup_postdata($post);

    ---

  3. phantomdentist
    Member
    Posted 3 years ago #

    Did the trick nicely mr P, thank you very much for your help.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic