Home › Forums › Front-end Issues › uppercase
hi
after a lot of hard work, I found this option
which displays the label but makes the contents of the field in uppercase
how can i change the code just like Field Label to be uppercase and the content of the field to be written normally?
thank you
<?php
$fields = get_field_objects();
if( $fields )
{
foreach( $fields as $field_name => $field )
{
echo '<div>';
echo '<h3>' . $field['label'] . '</h3>';
echo $field['value'];
echo '</div>';
}
}
?>
I personally would do this using CSS
// css
.target.your.label {
text-transform: uppercase;
}
You can do it in PHP by using strtoupper()
<?php
$fields = get_field_objects();
if( $fields )
{
foreach( $fields as $field_name => $field )
{
echo '<div>';
echo '<h3>' . strtoupper($field['label']) . '</h3>';
echo $field['value'];
echo '</div>';
}
}
?>
for every label? I have 50-60 field
and are we talking about label or field content? that I am interested in the contents of the field
thank you
I don’t know why your site is showing the content of the field in upper case other than that’s the way it was entered. ACF does not alter the case of either the values or the labels from what is entered into the admin. If this is happening then you need to look at something else. Maybe there is already CSS in place that is doing this.
because of echo ‘<h3>’ . $field[‘label’] . ‘</h3>’;
from the code
but I do not want to quit because I want the label to be capitalized, but the text of the field to be normal
<h3>
does not automatcially set the text to upper case unless there is a CSS rule in your stylesheet that tells it to.
Nothing in the code you presented indicates why the content is being transformed to upper case and this has nothing to do with the code that you’ve posted.
ACF does not do this transformation.
This means that:
surely 2. I did not check but …
I’m sorry to have bothered you with such a trifle
but the problem here is very important
https://support.advancedcustomfields.com/forums/topic/gallery-array/
is something simple I think, but I dont find solution
It’s not a bother, it’s why I’m here, to point people in the right direction.
And you are doing it in a great way…Thank you so much for helping people over here.Just love people over here
And you are doing it in a great way…Thank you so much for helping people over here.Just love people over here mybkexperience
You must be logged in to reply to this topic.
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!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?
— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.