Frederik Rosendahl-Kaa
Forum Replies Created
-
Forum: Plugins
In reply to: [ACF-VC Integrator] Can’t get the data from a Custom Post TypeHi @crundi,
Unfortunately, I can not say when I will get this added.
My day job takes up all my time at the moment.
But I will try and see if I can find time for it in the near future.Forum: Plugins
In reply to: [ACF-VC Integrator] Date picker outpoutHi @claudeine,
I’m still here but just have not had time to look in here.
I’m trying to see if I can make time tonight when I get home.Forum: Plugins
In reply to: [ACF-VC Integrator] Post object outputHi @claudeine,
I have made 2 examples for you.
The first is if you have only made it possible to select 1 post in your post object field, the second is if you have allowed multiple posts to be selected.Where it says post_object_field_name_1 and post_object_field_name_2 this is the name of your post object field and this allows you to change the content only for the specific field output.
The reason I added 2 was because you wrote you have 2 different ones.
You can add more and delete so you only have one.
But post_object_field_name_1 and post_object_field_name_2 just need to be changed to the names of your post obejct fields.Where it says custom_field_name_1 and custom_field_name_2 here you can insert the name of your custom field you want to retrieve.
You can read more about it here https://www.advancedcustomfields.com/resources/get_field//*Example 1 - Single post object */ add_filter( 'acfvc_post_object', 'acfvc_custom_post_object_output', 10, 3 ); function acfvc_custom_post_object_output ( $output, $field, $post_id ) { if ( $field["name"] == "post_object_field_name_1" ) { $ttile = $field["value"]->post_title; $thumbnail = get_the_post_thumbnail( $value["value"]->ID, 'full'); $custom_field = get_field( 'custom_field_name', $value["value"]->ID ); $output .= $ttile.'<br>'.$thumbnail.'<br>'.$custom_field; } if ( $field["name"] == "post_object_field_name_2" ) { $ttile = $field["value"]->post_title; $thumbnail = get_the_post_thumbnail( $value["value"]->ID, 'full'); $custom_field = get_field( 'custom_field_name_2', $value["value"]->ID ); $output .= $ttile.'<br>'.$thumbnail.'<br>'.$custom_field; } return $output; } /*Example 2 - multiple post object */ add_filter( 'acfvc_post_object', 'acfvc_custom_post_object_multiple_post_output', 10, 3 ); function acfvc_custom_post_object_multiple_post_output ( $output, $field, $post_id ) { $output = ''; if ( $field["name"] == "post_object_field_name_1" ) { foreach ($field["value"] as $key => $value) { $ttile = $value->post_title; $thumbnail = get_the_post_thumbnail( $value->ID, 'full'); $custom_field = get_field( 'custom_field_name', $value->ID ); $output .= $ttile.'<br>'.$thumbnail.'<br>'.$custom_field; } } if ( $field["name"] == "post_object_field_name_2" ) { foreach ($field["value"] as $key => $value) { $ttile = $value->post_title; $thumbnail = get_the_post_thumbnail( $value->ID, 'full'); $custom_field = get_field( 'custom_field_name_2', $value->ID ); $output .= $ttile.'<br>'.$thumbnail.'<br>'.$custom_field; } } return $output; }
Hope this can help you
Best regards
Frederik- This reply was modified 4 years, 5 months ago by Frederik Rosendahl-Kaa. Reason: Added Example 1 and 2 to code example
Forum: Plugins
In reply to: [ACF-VC Integrator] Post object outputHi @claudeine, I’m trying to look at it tonight when I get home from work.
Forum: Plugins
In reply to: [ACF-VC Integrator] ACF Image in Custom Taxonomy Not Showing in PostHi @joelle,
I have made an example where an image is displayed instead of standard output.
‘acf_image’ this should be the name of your image field.
‘category_’ this should be your taxonomy slug and _ should be there after your taxonomy slug.add_filter( 'acfvc_taxonomy', 'acfvc_custom_taxonomy_output', 10, 3 ); function acfvc_custom_taxonomy_output ( $output, $field, $post_id ) { $output = ''; foreach ($field["value"] as $key => $term_id) { $image = get_field( 'acf_image', 'category_'.$term_id ); $size = 'full'; // (thumbnail, medium, large, full or custom size) if( $image ) { $output .= wp_get_attachment_image( $image, $size ); } } return $output; }
I hope this can help you
Best regards
FrederikForum: Plugins
In reply to: [ACF-VC Integrator] Post object outputHi @contixmedia,
Yes it is possible to view excerpt, I have made 2 examples for you.
One is if you have chosen that you can only select one entry in your post object field the other example is if you have done so you can select more in one entry/*Single post object */ add_filter( 'acfvc_post_object', 'acfvc_custom_post_object_output', 10, 3 ); function acfvc_custom_post_object_output ( $output, $field, $post_id ) { $ttile = $field["value"]->post_title; $content = apply_filters( "the_content", $field["value"]->post_content ); $excerpt = $field["value"]->post_excerpt; $output = $excerpt.'<br>'.$content.'<br>'.$ttile; return $output; } /*multiple post object */ add_filter( 'acfvc_post_object', 'acfvc_custom_post_object_output', 10, 3 ); function acfvc_custom_post_object_output ( $output, $field, $post_id ) { $output = ''; foreach ($field["value"] as $key => $value) { $ttile = $value->post_title; $content = apply_filters( "the_content", $value->post_content ); $excerpt = $value->post_excerpt; $output .= $excerpt.'<br>'.$content.'<br>'.$ttile; } return $output; }
Hope this can help you
Best regards
Frederik- This reply was modified 4 years, 6 months ago by Frederik Rosendahl-Kaa.
- This reply was modified 4 years, 6 months ago by Frederik Rosendahl-Kaa. Reason: Removed some br tags from code example
Forum: Plugins
In reply to: [ACF-VC Integrator] Post object outputHi @claudeine,
Sorry I have not answered for some days but my day job is busy at the moment.
But am not quite sure what you mean by display the title and permalink sometimes.But the way you can output for example the title as a link is something like this.
$output = '<a href="'.$permalink.'">'.$title.'</a>'; return $output;
Hope this can help you
Best regards
FrederikForum: Plugins
In reply to: [ACF-VC Integrator] ACF Image in Custom Taxonomy Not Showing in PostHi @joelle,
By default, the plugin cannot display acf fields that have been added to other post/terms, as it can only display the acf fields for the post/page where the acf-vc integrator element has been added.
But as I understand your problem, it does not sound like something that this plugin can by default.
But I am writing it on my list so it should come in the future.
I can not put a date on it.However, there is a way I think you will be able to solve the problem however requires some code.
What you need to do is add an acf taxonomy field to your post type books where you can select your Authors, this allows you to then use the acf-vc integrator to view a simple list view of your authors.
But using a hook you will be able to change how the content of the Taxonomy field is displayed and in that way get the image displayed.
You need to put the hook into your function.php in theme/child-theme.add_filter( 'acfvc_taxonomy', 'acfvc_custom_taxonomy_output', 10, 3 ); function acfvc_custom_taxonomy_output ( $output, $field, $post_id ) { return $output; }
I hope it makes some sense.
Best regards
FrederikForum: Plugins
In reply to: [ACF-VC Integrator] Post object outputHi @claudeine,
You can change how the plugin displays the data using this hook.
The code just needs to be placed in your function.php file in the theme or child-theme.add_filter( 'acfvc_post_object', 'acfvc_custom_post_object_output', 10, 3 ); function acfvc_custom_post_object_output ( $output, $field, $post_id ) { return $output; }
Best regards
FrederikForum: Plugins
In reply to: [ACF-VC Integrator] Comma separatorHI @simoneboccuzzi,
I just changed the code a bit so it should work.
If it does not then I do not quite know what I can do as both codes I have sent work on my development environment.add_filter( 'acfvc_relationship', 'acfvc_custom_relationship', 10, 3 ); function acfvc_custom_relationship ( $output, $field, $post_id ) { $posts = $field["value"]; $output = "<div>"; $count = count( $posts ); $i = 1; foreach($posts as $key => $post_details) { $post_id = $post_details->ID; $output .= '<a href="'.get_permalink($post_id).'" title="'.get_the_title($post_id).'">'.get_the_title($post_id).'</a>'; if ( $i < $count ) { $output .= ', '; } $i++; } $output .= "</div>"; return $output; }
Forum: Plugins
In reply to: [ACF-VC Integrator] Comma separatorHi @simoneboccuzzi,
To change the way relationship field output is displayed on then you have to add some code in your function.php in your theme or child-theme.
I do not really know anything about the code snippet plugin so do not know if you can insert the code here as well.
But I have made some code as you can see here which makes the relationship field a comma seperate list
add_filter( 'acfvc_relationship', 'acfvc_custom_relationship', 10, 3 ); function acfvc_custom_relationship ( $output, $field, $post_id ) { $posts = $field["value"]; $output = "<div>"; foreach($posts as $key => $post_details) { $post_id = $post_details->ID; $output .= '<a href="'.get_permalink($post_id).'" title="'.get_the_title($post_id).'">'.get_the_title($post_id).'</a>'; if ( $key != array_key_last( $posts ) ) { $output .= ', '; } } $output .= "</div>"; return $output; }
Hope it can help you, otherwise feel free to write again.
Best regards
FrederikForum: Plugins
In reply to: [UpSell for WooCommerce] Variable productsHi @support160418,
Unfortunately, it does not work with bundle products.
But I try to get a look at it but it will probably take a few weeks before I have something ready.
Best regards
frederikForum: Plugins
In reply to: [ACF-VC Integrator] Link with _blank targetHi @carmolim,
I just released a new version 1.8.2 and may have fixed the bug you found.Forum: Plugins
In reply to: [ACF-VC Integrator] Social mediaThe code I wrote it should be written for example function.php which can be found in your theme or child theme
Forum: Plugins
In reply to: [ACF-VC Integrator] Displaying mp3 files.Hi @maartenrietdijk,
I have now implanted so it is possible to view files as an audio/video player.