Support Forums

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Custom fields not displaying

Viewing 10 posts - 1 through 10 (of 13 total)
  • Yvonne
    #45533

    I am trying to create a listing of resource documents using a custom post type and custom fields. However, my custom fields are not displaying properly when using Search & Filter.

    My set-up is this:
    – using custom Genesis child theme
    – custom post type registered in functions.php (if I get the search working I will move the code to a plugin)
    – custom fields created using Advanced Custom Fields
    – custom posts created and published using the custom fields only (no native WP edit field)
    – new page “Resources” published with a custom template coded to display custom fields and S&F search form; tested and displaying fine
    – S&F Pro installed and configured (with Relevanssi enabled for custom field indexing).
    – search form is just a basic keyword search field while testing
    – Ajax disabled
    – force is_search enabled

    My goal is to display all available documents on initial page load. Then the user would enter a search term and the form would return relevant results on the same page and in the same container as before. (This is pretty much the same set-up as in the “Movie” demo used on the S&F demo page.)

    Before enabling Relevanssi, the search was returning relevant results (when configured as a Post Type Archive – ) but only with the native WP post title, not any of the custom fields. When I switch configuration to Custom or Using Shortcode, I get a “hasn’t been configured to use shortcodes” message. My shortcodes (both when necessary) are definitely in the template used to display the page.

    After enabling Relevanssi, I get another error message “attempt to assign property of non-object…” when configured as Post Type Archive or Using Shortcodes.

    I suspect the problem lies in the custom loop I am using on the template file. Problem is, I have no idea how to modify this custom loop to make it work AND still query my custom post type. All Google searches lead me to how to customize the loop with WP_Query (which it already is using) or other versions that apparently S&F doesn’t like.

    So my question is… could this be my issue and, if so, how do I modify the basic WP loop to query a custom post type in a manner that S&F can work with?

    Or put another way…. how can I make this: http://demo.designsandcode.com/sfpro-movie-reviews/

    ANy help and suggestions would be most appreciated. I have hit a brick wall and exhausted my limited PHP knowledge.

    This is the code in my template file that is used for the “Resources” page:

    <?php
    
    function lol_resources_custom_fields() {
    
    ?>
    	<div class="two-thirds first">
    	 <div id="resource-results">
    
    <?php
    
      $args = array(
        'post_type' => 'resources',
        'post_status' => 'publish',
        'posts_per_page' => '10'
      );
    
      $resources_loop = new WP_Query( $args );
      if ( $resources_loop->have_posts() ) :
        while ( $resources_loop->have_posts() ) : $resources_loop->the_post();
          
      	echo '<h4>' . get_field('resource_title') . '</h4>';
    		echo '<p>' . get_field('resource_description') . '</p>';
    		echo '<p>' . get_field('resource_type') . '</p>';
          	
        endwhile;
        wp_reset_postdata();
       endif;
    
      		echo do_shortcode('[searchandfilter id="456" show="results"]');
        ?>		
      		</div>  <!-- end #resource-results -->
    		</div>  <!-- end .two-thirds -->
    
    		<div class="one-third">
    		  <div id="resource-form">
    		    <?php echo do_shortcode('[searchandfilter id="456"]'); ?>
    		  </div>  <!-- end #resource-form -->
    		</div>  <!-- end .one-third -->
    
    	<?php
    }
    
    Yvonne
    #45534

    oh, and this is still in local development so I don’t have a live link.

    Trevor Moderator
    #45547

    Hi (is it Yvonne? or …)

    This looks a little complex to answer. It would be easier if we could video conference. Do you have skype and a mic (or webcam)?

    Are you in Canada? I am in the UK.

    Yvonne
    #45564
    This reply has been marked as private.
    Trevor Moderator
    #45565

    Hi Yvonne

    I sent you a contact request on Skype. In the meantime, is it possible for you to make screenshots of any tabs in the search form setup that you have made settings in (some tabs you may have made no changes, these I do not need to see)? I need at least the General and Display results tabs.

    Also, I need screenshots of the setup for the form fields.

    Trevor Moderator
    #45566

    BTW, the suggested timing is OK for me.

    Yvonne
    #45567

    Good grief, you’re blazing fast at responding!

    I accepted your contact request so I guess we’re all set for Monday morning. I will be around all morning if you’re not able to make it at 9:30 my time.

    And for sure I will get you those screenshots over the weekend.

    Have a good weekend.

    Cheers,
    yvonne

    Yvonne
    #45619

    Hi Trevor,

    I have the screenshots ready to go. How do you prefer to receive them?

    Cheers,
    yvonne

    Yvonne
    #45629
    This reply has been marked as private.
    Trevor Moderator
    #45648

    Hi Yvonne

    To confirm our conversation, I will get from Ross how to add this to the args.

Viewing 10 posts - 1 through 10 (of 13 total)

The topic ‘Custom fields not displaying’ is closed to new replies.