Plugin Author
YMC
(@wssoffice21)
Hi!
Inside the custom layout you can display any information, including ACF fields. To do this, use ACF methods, for example:
function my_custom_post_layout($layout, $post_id, $filter_id, $increment_post, $arrOptions) {
$layout = ‘<h2>’.get_the_title($post_id).'</h2>’;
$layout .= get_field(‘my_name_acf’, $post_id ); // ACF Field
return $layout;
}
add_filter(‘ymc_post_custom_layout_545_1’, ‘my_custom_post_layout’, 10, 5);
-
This reply was modified 1 year, 1 month ago by
YMC.
Thank you. Where do I add these scripts?
And can I translate the line “x posts selected”?
Plugin Author
YMC
(@wssoffice21)
You should add this filter to your WordPress theme’s functions.php file.
You can use any translation functions that start with __()
See docs: https://github.com/YMC-22/smart-filter
-
This reply was modified 1 year, 1 month ago by
YMC.
Added this to my functions.php, but results don’t come up, just the loading animation.
add_filter(“ymc_post_custom_layout_1349_1”, “callback_function”, 10, 5);
function my_custom_post_layout($layout, $post_id, $filter_id, $increment_post, $arrOptions) {
$layout = ‘.get_the_title($post_id).’;
$layout .= get_field(‘product_sku’, $post_id ); // ACF Field
return $layout;
}
Also tried acf_get_field without luck.
Their website says: https://www.advancedcustomfields.com/resources/get_field/
Plugin Author
YMC
(@wssoffice21)
Check the filter IDs. Send us a link to the page on the site where the filter is located.
-
This reply was modified 1 year, 1 month ago by
YMC.
-
This reply was modified 1 year, 1 month ago by
YMC.
-
This reply was modified 1 year, 1 month ago by
YMC.
Ah, now I understand! Found the line where to make changes, get_fields is enough, the acf_ prefix, as suggested by them, is irrelevant for retrieving data. Now I can use the filds in my grid! Thank you so much, 5* support!