WPFTS Pro Main Site WPFTS Community Forum
    • Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. Dornfeld
    Get WPFTS Pro today with 25% discount!
    D
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Groups 0

    Dornfeld

    @Dornfeld

    1
    Reputation
    1
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    Dornfeld Unfollow Follow

    Best posts made by Dornfeld

    • RE: Problem with ACF generated fields

      @epsilonadmin

      Thanks!

      It does!!! It works.

      Thanks for your hard work!!!

      posted in Frequently Asked Questions
      D
      Dornfeld

    Latest posts made by Dornfeld

    • RE: Problem with ACF generated fields

      @epsilonadmin

      Thanks!

      It does!!! It works.

      Thanks for your hard work!!!

      posted in Frequently Asked Questions
      D
      Dornfeld
    • Problem with ACF generated fields

      Hi,

      I work on a design, I build from the ground up for a special project. (This means, the theme won't be available anywhere else...)

      In this theme I work with a lot of custom post types and custom fields (generated by ACF)

      Since acf fields aren't using post_meta but are only available via get_field('<fieldname>'), and I don't want to write new lines of code for every field into the functions.php I changed the routine you suggest in your Documentation like this:

      add_filter('wpfts_index_post', function($index, $post) {
      	
      	global $wpdb;
      	
      	$index[get_post_type()] = implode(' ',get_fields($post->ID));
      	
      	return $index;
      	
      }, 3, 2);
      

      It seems to work. In the SandBox at least. When I type in there a searchterm which can only be found in one of those custom fields, I get the correct results in the TestSearch Area.
      But I do get a "nothing can be found" non-result when I try to find the term using the search.php. The title of one of the custom posts creates the right result, but not the the entry from the custom field.

      Here is my search.php (it isn't really designed yet, it's just for proof of concept...)

      	$s=get_search_query();
      	$args = array(
                      's' =>$s
                  );
          // The Query
      $the_query = new WP_Query( $args );
      if ( $the_query->have_posts() ) {
              _e("<h2 style='color:#1c1c1c'>Search Results for: ".get_query_var('s')."</h2>");
              while ( $the_query->have_posts() ) {
                 $the_query->the_post();
                       ?>
                          <li>
                              <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                          </li>
                       <?php
              }
          }else{
      ?>
              <h2 style='color:#1c1c1c'>Nothing Found</h2>
              <div class="alert alert-info">
                <p>Sorry, but nothing matched your search criteria. Please try again with some different keywords.</p>
      	</div></main>
      <?php } 
       
      
      

      What can I do?

      Best
      Martin

      posted in Frequently Asked Questions
      D
      Dornfeld