Hey John. Sorry for my bad explanations.
Yes. The image is postetd directly inside the linktext, see the picture i loaded up. I tested your script. The result you can also see in the uploaded images. The crazy about is, that sometimes it’s working and sometimes not. But I don’t want to waste your time too much. Otherwise I’ll find another soultion. Maybe I can add an acf imagefield and call it directly inside the linktag. So ->a,img,linktext,/a<- That would probably make more sense too.
<?php if( $button_buy ): $button_buy_url = $button_buy['url']; $button_buy_title = $button_buy['title']; $button_buy_target = $button_buy['target'] ? $button_buy['target'] : '_self'; ?> <a class="button button-buy" href="<?php echo esc_url( $button_buy_url ); ?>" target="<?php echo esc_attr( $button_buy_target ); ?>"><?php echo strip_tags($button_buy_title); ?></a> <?php endif; ?>
Hey John, hope this helps. This ist the code from the template. I’m using normal img tag inside the Linktext. Can you see it in the picture i loaded up? I blacked out the URL for reasons.
thank your very much. This brought me some steps further. But I#m not the best PHP Developer so I don’t really know how to “merge” the export (PHP/JSON) into the existing fields coming with my theme. I really prefer JSON, but it’s not a must have.
Maybe you have a CodeSnippet how I can realize this last step? If it’s not part of your services as a supportmember, maybe we can connect on a personal way and you tell me what i have to pay for your help?
In the last line of your code, at the beginning, there ist a “<” missing. Try:
<?php $mywysisyg = get_field('description_main'); ( !empty( $mywysisyg ) ): ?> <div class="yourcontent"> <?php echo $mywysisyg; ?> </div> <?php endif; ?>
🙂 That means you can write “whatever” you want.
$mywysisyg oder $text or $kjdnehijd – it is just a variable.
So, if you decide to unse maybe $text please change all “$whatever” in the code above.
<?php $text = get_field('fieldnameofyourwysisyg'); ( !empty( $text ) ): ?> <div class="yourcontent"> <?php echo $text; ?> </div> <?php endif; ?>
Try this code:
<?php $whatever = get_field('fieldnameofyourwysisyg'); ( !empty( $whatever ) ): ?> <div class="yourcontent"> <?php echo $whatever; ?> </div> <?php endif; ?>
This Code only renders the Content and it’s container if there is code inside.
I don’t really know, but i had a similar problem but it’s long time ago. I couldn’t add Media Files, button not working. I remember that deep in my HTML/PHP code I missed a closing tag in the Footer (yes, the footer, the last thing on earth). Fixing it, solved the problem. Don’t know why, but it fixed it. Maybe you have something like that?
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!
© 2023 Advanced Custom Fields.