Support

Account

Forum Replies Created

  • Hi.

    I had a similar problem where I had a custom post type for FAQ’s and I wanted to put the top five questions at the top then followed by the rest.
    I was tearing my hair out before I saw John’s answer above. At least in my case I had to update all the posts after I had created the custom field I wanted to sort against.

    It could be even more elaborate I guess but this does the trick for me.

    $args = array(
    	'post_type' => 'faq',
    	'posts_per_page' => -1,
    	'meta_key' => 'top_five',
    	'orderby' => 'meta_value',
    );
  • Hi!

    I opened a support ticket and just received an answer. James’ reply was:

    Can you please deactivate and re-activate your ACF PRO license (from the custom fields -> updates page) and try the plugin update again?
    You can also try the ‘Dashboard -> Updates’ page and click the ‘Check again’ button to clear plugin update cached data.

    The first solution did the trick for me.

    Hope it works for you 🙂

  • UPDATE:

    I updated WP to the latest version (4.8.1) but the problem with ACF remains.

  • I got it working now, seems like I called for the wrong ID. That was awkward 😛 Thanks anyway!

  • I store it on a page. I called for the field in the header.php but the meta-tag showed up empty. I called the field like so: <?php the_field('field', 300); ?> where 300 is the ID of the page where the value is stored.

  • Yes this makes total sense. As I said, I only wrote here as a last resort.

    Thank you for your answer.

  • Hi.

    I had a similar problem recently and I found this bit of code that did the trick for me. Here’s a link to the article.

    // Make the search to index custom
    /**
     * Extend WordPress search to include custom fields
     * http://adambalee.com
     *
     * Join posts and postmeta tables
     * http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_join
     */
    function cf_search_join( $join ) {
        global $wpdb;
        if ( is_search() ) {    
            $join .=' LEFT JOIN '.$wpdb->postmeta. ' ON '. $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id ';
        }
        return $join;
    }
    add_filter('posts_join', 'cf_search_join' );
    
    /**
     * Modify the search query with posts_where
     * http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_where
     */
    function cf_search_where( $where ) {
        global $pagenow, $wpdb;
        if ( is_search() ) {
            $where = preg_replace(
                "/\(\s*".$wpdb->posts.".post_title\s+LIKE\s*(\'[^\']+\')\s*\)/",
                "(".$wpdb->posts.".post_title LIKE $1) OR (".$wpdb->postmeta.".meta_value LIKE $1)", $where );
        }
        return $where;
    }
    add_filter( 'posts_where', 'cf_search_where' );
    
    /**
     * Prevent duplicates
     * http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_distinct
     */
    function cf_search_distinct( $where ) {
        global $wpdb;
        if ( is_search() ) {
            return "DISTINCT";
        }
        return $where;
    }
    add_filter( 'posts_distinct', 'cf_search_distinct' );
  • Thanks! Of course that’s the case! 🙂

  • It looks like this:

    <div>
        <?php if( have_rows('post_content') ): ?>
            <?php while ( have_rows('post_content') ) : the_row();
                if( get_row_layout() == 'layout_text' ): ?>
                <?php the_sub_field('text'); ?>
            <?php endif; endwhile; ?>
        <?php endif; ?>
    </div>
    
    <div>
        <?php if( have_rows('post_content') ): ?>
            <?php while ( have_rows('post_content') ) : the_row();
                if( get_row_layout() == 'layout_image' ): ?>
                <?php the_sub_field('image'); ?>
            <?php endif; endwhile; ?>
        <?php endif; ?>
    </div>
    
    <div>
        <?php if( have_rows('post_content') ): ?>
            <?php while ( have_rows('post_content') ) : the_row();
                if( get_row_layout() == 'layout_video' ): ?>
                <div class="videowrapper">
                    <?php the_sub_field('video'); ?>
                </div>
            <?php endif; endwhile; ?>
        <?php endif; ?>
    </div>

    Maybe I should somehow make it in to one loop, but I can’t figure it out.

    Thanks

  • Thanks! I think I’ll do that then 🙂

  • Alright, that’s too bad. It would be way more user friendly if those fields could be disabled.

    I might have to build my own.

    Thanks

  • Yes, at a second look i saw that I had indeed the headline and the text content in separate layouts. Thanks!

  • Thanks for your answer.
    That gave me the same output unfortunately. The thing is, the frontend looks good and as it should, it’s just a shame it should mess up the DOM.

  • Hello.
    You could define your marker as “nothing” in your add_marker-function. That would be something like this:

    function add_marker( $marker, map ) {
    	// var
    	var latlng = new google.maps.LatLng( $marker.attr('data-lat'), $marker.attr('data-lng') );
    	// create marker
    	var marker = new google.maps.Marker({
    		position	: latlng,
    		map			: map,
    		icon		: ''
    });

    I’m not quite sure if this is the absolutely best way to do it, but it gets the job done.

Viewing 15 posts - 1 through 15 (of 15 total)