Support

Account

Forum Replies Created

  • This is what I have before I activate the filter plugin…

    Array
    (
    [ID] => 5711
    [id] => 5711
    [title] => client-name-logo-blue
    [filename] => client-name-logo-blue1.png
    [url] => http://localhost.com/client-name/wp-content/uploads/2015/03/client-name-logo-blue1.png
    [alt] =>
    [author] => 1
    [description] =>
    [caption] =>
    [name] => client-name-logo-blue
    [date] => 2015-03-06 17:14:25
    [modified] => 2015-03-06 17:14:25
    [mime_type] => image/png
    [type] => image
    [icon] => http://localhost.com/client-name/wp-includes/images/media/default.png
    [width] => 447
    [height] => 160
    [sizes] => Array
    (
    [thumbnail] => http://localhost.com/client-name/wp-content/uploads/2015/03/client-name-logo-blue1-150×150.png
    [thumbnail-width] => 150
    [thumbnail-height] => 150
    [medium] => http://localhost.com/client-name/wp-content/uploads/2015/03/client-name-logo-blue1-300×107.png
    [medium-width] => 300
    [medium-height] => 107
    [large] => http://localhost.com/client-name/wp-content/uploads/2015/03/client-name-logo-blue1.png
    [large-width] => 447
    [large-height] => 160
    [yith-woocompare-image] => http://localhost.com/client-name/wp-content/uploads/2015/03/client-name-logo-blue1-220×154.png
    [yith-woocompare-image-width] => 220
    [yith-woocompare-image-height] => 154
    [logo-image-size] => http://localhost.com/client-name/wp-content/uploads/2015/03/client-name-logo-blue1-447×160.png
    [logo-image-size-width] => 447
    [logo-image-size-height] => 160
    [paralax-image-size] => http://localhost.com/client-name/wp-content/uploads/2015/03/client-name-logo-blue1.png
    [paralax-image-size-width] => 447
    [paralax-image-size-height] => 160
    [team-image-size] => http://localhost.com/client-name/wp-content/uploads/2015/03/client-name-logo-blue1-400×143.png
    [team-image-size-width] => 400
    [team-image-size-height] => 143
    [shop_thumbnail] => http://localhost.com/client-name/wp-content/uploads/2015/03/client-name-logo-blue1-170×114.png
    [shop_thumbnail-width] => 170
    [shop_thumbnail-height] => 114
    [shop_catalog] => http://localhost.com/client-name/wp-content/uploads/2015/03/client-name-logo-blue1-341×160.png
    [shop_catalog-width] => 341
    [shop_catalog-height] => 160
    [shop_single] => http://localhost.com/client-name/wp-content/uploads/2015/03/client-name-logo-blue1.png
    [shop_single-width] => 447
    [shop_single-height] => 160
    [mpfy_location_tag] => http://localhost.com/client-name/wp-content/uploads/2015/03/client-name-logo-blue1.png
    [mpfy_location_tag-width] => 31
    [mpfy_location_tag-height] => 11
    )

    )

    After plugin activation

    5711

  • Yeah, deactivation of the plugin allows ACF to work again. As I say I don’t think the issue lays with ACF, but the other plugin, but I wondered if there was something that someone could point me at to help.

  • Hi,

    It’s set to be an image array

  • Very good point. I will take a look at yours and this one and see. I would be grateful to any solution you come up with as this one has been on my list of things to try and fix for some time now, and I still can’t get to the bottom of it.

  • Funny,

    I was looking at this just yesterday again. I think I have found someone that has done this now ( see
    https://imperativeideas.com/making-custom-fields-work-yoast-wordpress-seo/ ) I’ve tried it, and seems to be almost working. I say almost as the check still shows the focus keyword(s) not to be in the content on the traffic light system, even though it does find them in there to pass it.

    Try it, it will make more sense than I have just made here.

  • I’m having the same issue here

  • @frysteen … Sorry, I’m not totally sure. I’m not a backend developer, more front-end. Perhaps using this post as a starting point can point you in the right direction.
    http://goo.gl/flryRN Jan, starts off by building an array of items to search. Maybe you could do an if statement that singles out the fields you want?

    If you get to a solution I would be keen to know what it is.

  • @frysteen Thanks for the thanks 🙂

  • Hi,

    I’ve gotten close thanks to stumbling onto this post from the old support site http://goo.gl/flryRN

    I’ve had to amended it a little for my needs & it isn’t perfect at all, but maybe we can get to a better solution together?

    You will need to use Relevanssi, with this code added to your functions.php file…

    // Get Relevanssi to display excerpts from your custom fields
    add_filter('relevanssi_excerpt_content', 'excerpt_function', 10, 3); function excerpt_function($content, $post, $query) {
    
    global $wpdb; $fields = $wpdb->get_col("SELECT DISTINCT(meta_key) FROM $wpdb->postmeta");
    
    foreach($fields as $key => $field){ $field_value = get_post_meta($post->ID, $field, TRUE); $content .= ' ' . ( is_array($field_value) ? implode(' ', $field_value) : $field_value ); }
    
    $content = preg_replace($wordlist, '', $content);
    
    return $content; }

    This works, but (and there is a but) it seems to display post revisions, so if you’re like me and use Latin as place holders for dummy content during the build process, it shows up in the results. Also, it seems to show the custom field IDs at times too, depending where your search term shows up in the order of the ACF field content.

    I’ve not figured out a solution to the revisions yet, but to remove the IDs I’ve tweaked the code for this…

    // Get Relevanssi to display excerpts from your custom fields
    add_filter('relevanssi_excerpt_content', 'excerpt_function', 10, 3); function excerpt_function($content, $post, $query) {
    
    global $wpdb; $fields = $wpdb->get_col("SELECT DISTINCT(meta_key) FROM $wpdb->postmeta");
    
    foreach($fields as $key => $field){ $field_value = get_post_meta($post->ID, $field, TRUE); $content .= ' ' . ( is_array($field_value) ? implode(' ', $field_value) : $field_value ); }
    
    // Remove random terms from showing in the search. These are related to the names of the ACF field names
    $wordlist = array('acf_id_1', 'acf_id_2', 'acf_id_3', 'acf_id_4');
    foreach ($wordlist as &$word) {
        $word = '/\b' . preg_quote($word, '/') . '\b/';
    }
    
    $content = preg_replace($wordlist, '', $content);
    
    // The excerpt ready with bits removed from it
    return $content; }

    Again, not ideal, but works of sorts.

  • Hi,

    I’ve been having a similar issue for a while now. I use the flexible content field to allow my clients to create columns within WordPress and other elements they may need.

    I’ve been working on a solution for a while (I’m no PHP developer, so forgive me here), I’ve gotten close thanks to stumbling onto this post from the old support site http://goo.gl/flryRN

    I’ve had to amended it a little for my needs & it isn’t perfect at all, but maybe we can get to a better solution together?

    You will need to use Relevanssi, with this code added to your functions.php file…

    // Get Relevanssi to display excerpts from your custom fields
    add_filter('relevanssi_excerpt_content', 'excerpt_function', 10, 3); function excerpt_function($content, $post, $query) {
    
    global $wpdb; $fields = $wpdb->get_col("SELECT DISTINCT(meta_key) FROM $wpdb->postmeta");
    
    foreach($fields as $key => $field){ $field_value = get_post_meta($post->ID, $field, TRUE); $content .= ' ' . ( is_array($field_value) ? implode(' ', $field_value) : $field_value ); }
    
    $content = preg_replace($wordlist, '', $content);
    
    return $content; }

    This works, but (and there is a but) it seems to display post revisions, so if you’re like me and use Latin as place holders for dummy content during the build process, it shows up in the results. Also, it seems to show the custom field IDs at times too, depending where your search term shows up in the order of the ACF field content.

    I’ve not figured out a solution to the revisions yet, but to remove the IDs I’ve tweaked the code for this…

    // Get Relevanssi to display excerpts from your custom fields
    add_filter('relevanssi_excerpt_content', 'excerpt_function', 10, 3); function excerpt_function($content, $post, $query) {
    
    global $wpdb; $fields = $wpdb->get_col("SELECT DISTINCT(meta_key) FROM $wpdb->postmeta");
    
    foreach($fields as $key => $field){ $field_value = get_post_meta($post->ID, $field, TRUE); $content .= ' ' . ( is_array($field_value) ? implode(' ', $field_value) : $field_value ); }
    
    // Remove random terms from showing in the search. These are related to the names of the ACF field names
    $wordlist = array('acf_id_1', 'acf_id_2', 'acf_id_3', 'acf_id_4');
    foreach ($wordlist as &$word) {
        $word = '/\b' . preg_quote($word, '/') . '\b/';
    }
    
    $content = preg_replace($wordlist, '', $content);
    
    // The excerpt ready with bits removed from it
    return $content; }

    Again, not ideal, but works of sorts.

  • Hi Elliot,

    I have tried looking into getting this to work with no joy.

    Here’s what I have added to the functions file.

    <?php
    add_filter( 'the_content', 'add_to_content' );
    
    function add_to_content($content) {
    		
    		global $post;
    		
    		$rows = get_field('multiple_columns');
    		$content = '';
    		
    		if( $rows )
    		{
    		    foreach( $rows as $row )
    		    {
    		        // debug the row
    		        /*
    		        echo '<pre>';
    		            print_r($row);
    		        echo '</pre>';
    		        die;
    		        */
    		        
    		        // set $content
    		        $content = $rows['one_column'];
    		        // $content .= $rows['two_columns'];
    		        
    		        //  break the loop
    		        break;
    		        
    		    }
    		    
    		}
    		
    	return $content;
    
    }
    ?>

    Can you or anyone else see where I have gone wrong?

    Thanks

  • Hi Elliot,

    Thanks once again for your help, but I’ve got a couple of questions.

    1) Sorry my PHP skills are still coming along and I’m unsure how would I go about doing that, could you point me in the right direction?

    2) I see you have defined a single sub field name, but It could be from multiple possibilities as it is a flexible content area with more than one layout which have different sub fields. How would I check for this?

    I’ve attached a screen shot of my fields if this helps explain what I have.

    Also reading about the acf/update_value has got me thinking, would it be possible to populate the default WP content editor with the content stored in the ACF fields I have? As this may allow Yoasts SEO plugin to ‘scan’ through the content within ACF without it going through ACF. I just wouldn’t display it on the front-end of the site.

    Just a thought.

    Thanks again.

  • Elliot,

    I’m SO sorry for wasting your time. But thanks all the same.

    *hangs his head in shame*

  • Hi Elliot,

    Thanks for the reply. I’m using a custom child theme I’m building based on the Roots theme ( http://www.rootstheme.com/ )

    I’m not sure what you mean when you say ‘where is te data saved’.

    The template is a custom one which looks like this http://snipt.org/AFah6/Dark

    I have attached two screen shots that might help.

    Thanks

Viewing 15 posts - 26 through 40 (of 40 total)