Hi @james,
I have inserted your code in functions.php but it doesn’t work. What would be wrong?
Greetings and thank you
function boldear($field) {
$text = get_field('usuario_pro');
$pattern = '/(.*)\*(.*)\*(.*)/';
$replacement = '$1<i>$2</i>$3';
//return preg_replace($pattern, $replacement, $text);
echo preg_replace($pattern, $replacement, $text);
}
//add_action('acf/include_field_types', 'boldear');
add_action('acf/render_field', 'boldear');
I do not want to create a custom post type. I have put “post” in place of yours “mycpt” but it still does not work.
Actually I had what you put in your code:
if (is_singular (array (‘mycpt’))
I have changed it to “gallery” because I have misunderstood your instructions. So now I do not know what to do.
Hi,
The query that I have inserted instead of this one is_singular( array( ‘custom-post-type’ ) ) is:
if ( is_singular( array( ‘galeria’ ) )
And if the slug(not the name) of the ACF field is galeria.
If I put [acf field="galeria"] , the result is:
Array, Array, Array
Wassy83, I think I’ve gone ahead or something I’ve done wrong. The gallery module (which I leave empty) shows me ALL the images in the library.
Thank you very much wassy83 !!
You have exposed it very well, and the code works perfectly.
How well you have found the solution!
Could you illustrate us by putting the code please?
Hello,
Try putting [acf field="YOUR GROUP NAME"] to show all the content of the group separated by commas.
I have not found a way to show each Field separately.
Does anyone have any ideas?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.