<?php
$image = get_field($post_image);
$pic = $image['sizes']['large'];
?>
<p><?php echo $pic; ?></p>
<?php var_dump($image);?>
and this code is working fine. But when I try to show image of a user with a code. it just shows me image id, not image. all image ACF settings are same for both post and user image field.
there is two code: one is:
<?php
$user_id = get_current_user_id();
$user = get_user_by( 'id', $user_id);
$userimg = get_field("$realtor_image",$user);
if( $userimg ) {
echo $userimg;
} else {
echo 'empty';
}
?>
another is:
<?php
$user_id = get_current_user_id();
$user = get_user_by( 'id', $user_id);
$userimg = $user->realtor_image;
?>
<p><?php echo $user->realtor_image; ?></p>
<?php var_dump($userimg);?>
and in the screenshot, you will see those above the line and below the like. Can anyone please help me?
Output ss: https://imgur.com/a/dPWqOoK
Here is my image field ss: https://imgur.com/a/MQxca3m
I am trying to show the image that is different from user to user, like what ACF actually does, showing dynamic content. I can do it for posts, but not for logged-in users. It is showing me the image id rather than the actual image. I have changed Return Format, but not work.
]]>WordPress version : 5.4.4
Advance Custom Fields PRO version: 5.8.7
(This website is not created by me. Im offering my support to maintain the website on behalf of the owner)
Thanks in advance.
]]>The block output looks like this:
<div class="acf-field-5eeb3586be7b6">
<div class="button-field_5eeb3586be7b6">
<div class="acf-input">
<div class="acf-button-group">
<button>
</div>
</div>
</div>
</div>
And what my code is suppose to do is when .acf-button-group is clicked, The background in the field .acf-field-5eeb3586be7b6 changes to black.
And the JS code:
jQuery(document).ready(function(){
jQuery(".button-field_5eeb3586be7b6 .acf-input .acf-button-group").click(function(){
jQuery(".acf-field-5eeb3586be7b6").css('background','black');
});
});
]]>Is there a way to make it work?
Here is how I have it implemented in the post editor.
]]>$.each(results, function(i, item) {
var ingredientsName = item.ingredients.body;
Result:
Ingredients: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
My custom post type does not display in the post types list in settings.
Your assistance is greatly appreciated!
Thank you
]]>I am trying to modify the ‘add-to-cart.php’ file in the loop so that I can run the following PHP query:
<?php
if(get_field('ad_activate_deposit') == "yes")
{
echo 'PLACE £99 DEPOSIT';
} else {
echo 'ADD TO CART';
}
?>
I currently have the above code modifying the single product add to cart button quite simply, however I am struggling with the loop.
Any advice will be appreciated!
]]>I have a site that I have only started building, however I notice when I use ACF’s Post Object to list posts of type tribe_events it only shows future events, I want them all. I know it’s a problem with The Events Calendar because when I deactivate the plugin this problem is resolved. Does anyone have any insight?
Many thanks
]]>