Support

Account

Forum Replies Created

  • I’m looking for something quick and easy also – it seems like WP All Import Pro would do the job but I haven’t tried yet.

  • Hey Guys,

    I figured out the issue. Basically, in my previous post I had the greater than & less than comparison switched AND also my filter was not properly string replacing both sql where statements. Here’s the code I have working now, hopefully it helps someone out there:

    WP_Query args:

    //Serial# Meta Query
    	$args = array(
    		'post_type'        => 'manual',
    		'numberposts'      => - 1,
    		'suppress_filters' => false,
    		'meta_query'       => array(
    			'relation' => 'AND',
    			array(
    				'key'     => 'files_%_start_range_num',
    				'value'   => intval( $_GET['s'] ),
    				'type'    => 'NUMERIC',
    				'compare' => '<='
    			),
    			array(
    				'key'     => 'files_%_end_range_num',
    				'value'   => intval( $_GET['s'] ),
    				'type'    => 'NUMERIC',
    				'compare' => '>='
    			)
    		),
    	);
    

    Filter:

    // custom filter to replace '=' with 'LIKE'
    // see: http://www.advancedcustomfields.com/resources/how-to/how-to-query-posts-filtered-by-custom-field-values/
    function acf_posts_where( $where ) {
    
    	$where = str_replace( "meta_key = 'files_%", "meta_key LIKE 'files_%", $where );
    
    	return $where;
    
    }
    
    add_filter( 'posts_where', 'acf_posts_where' );
    
  • Thanks for the update Elliot. This has also caused issues with several sites running on a theme that requires ACF:

    if(is_plugin_active('advanced-custom-fields/acf.php') == true && function_exists('get_field')) {
    
        include('myfile.php');
    
    }

    Looking forward to the new version soon! :]

  • That’s great news! I can’t wait. Best. plugin. ever.

  • That’s not a bad idea… I was hoping someone else had come across this before or had any code to start from. Otherwise, I may code it up in the next day or so if this thread gets buried.

  • Yes the instructions in the readme should be updated to just include the file – or perhaps use if file_exists include(…); thanks for the resolution!

  • This code worked a bit better for me than Giu Tae Kim’s

    <div id="contact-map-canvas"></div>
    
        <script>
            function initialize() {
              var myLatlng = new google.maps.LatLng(<?php the_field('locations');?>);
              var mapOptions = {
                zoom: 4,
                center: myLatlng,
                mapTypeId: google.maps.MapTypeId.ROADMAP
              }
              var map = new google.maps.Map(document.getElementById('contact-map-canvas'), mapOptions);
    
              var marker = new google.maps.Marker({
                  position: myLatlng,
                  map: map,
                  title: 'Hello World!'
              });
            }
    
            google.maps.event.addDomListener(window, 'load', initialize);
    
        </script>
    
Viewing 7 posts - 1 through 7 (of 7 total)