Hello @juliape
There is not enough information in your question to help you.
To be clear, the support you seek is basic WordPress functionality with retrieving variables from a post rather than specific help with my plugin.
What i want to do is, for example, replace the default “date” or “author” with my custom fields “genre”, “format”, etc. In my theme i know how to call that info with get_field, but fail to write that correcly in the hooks that i’ve found here
you’re still not showing any code, so I can only assume.
This should be documented in ACF for the second parameter in get_field.
global $post;
get_field('your_field', $post->ID);
-
This reply was modified 2 years, 10 months ago by thehowarde.
Thank you for your quick response, and I am sorry that I cannot communicate my issue clearly.
I’ve coppied the following code from this answer
add_action( 'dd-carousel-after-content' , 'my_custom_carousel_header' , 10, 1);
function my_custom_carousel_header($id){
if ($id == 2267) { // your carousel ID - numeric
global $post;
echo '<a href="'.get_permalink($post->ID).'">'.get_the_title($post->ID).'</a><br>';
$terms = get_the_terms($post->ID, 'product_cat'); // use your custom taxonomy
$term_list = array();
foreach ($terms as $term){
$term_list[] = $term->name;
}
echo implode(', ', $term_list);
}
}
This indeed showed the title of my post, so i thought that simply editing the code below would show the info i need, but can’t seem to find the way.
I understand if this query is not relevant, sorry for any inconvenience
Hi
What you posted here doesn’t show what you’re trying to get or how you’re trying to get it.
Hi, what i have so far is this:
add_action( 'dd-carousel-after-content' , 'my_custom_carousel_header' , 10, 1);
function my_custom_carousel_header($id){
if ($id == 11253) { // your carousel ID - numeric
global $post;
echo '<p>'.get_field('resumen', $post->ID).'</p>';
}
}
what i want to do is add more of my custom fields, but i’m having some issues.
Also, i would need to set whatever i manage to add in this “new meta” in all my other carosusels, in which i’ve tried but failed with the following:
add_action( 'dd-carousel-after-content' , 'my_custom_carousel_header' , 10, 1);
function my_custom_carousel_header($id){
if (in_array($_GET['id'], array(11253, 10959))) {
global $post;
echo '<p>'.get_field('resumen', $post->ID).'<p>';
}
}
This
if (in_array($_GET['id'], array(11253, 10959)))
should probably be
if (in_array($id, array(11253, 10959)))
If you’re using the ID that is passed as the carousel ID.