Home › Forums › ACF PRO › WYSIWYG Widgets/Widget Blocks With ACF PRO › Reply To: WYSIWYG Widgets/Widget Blocks With ACF PRO
Hi @toad78
It seems that you use a plugin for the widget. I’m afraid I’m not familiar with that plugin, so forgive me if I’m wrong.
For something like this, you need to check if a widget block is saved as a custom post or something else (I believe you can check it by using the location rule on the field group or asking the plugin author directly). If it’s saved as a custom post, then you need to get the ID of the widget block custom post to show custom field value. For example, if the ID of widget block custom post is 99, then you need to show it like this:
<?php if( the_field('Industries', 691) ): ?>
<div class="industries group">
<?php
// vars
$rows = get_field('repeater', 99);
$pagelink = get_sub_field('page_link', 99);
$image = get_sub_field('image', 99);
$title = get_sub_field('title', 99);
?>
<?php if( have_rows('repeater', 99) ): ?>
<?php while( have_rows('repeater', 99) ): the_row(); ?>
<div class="indus col-sm-3">
<p><a href="<?php $pagelink; ?>">
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /><?php echo $title; ?></a></p>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div><!--end container-->
<?php endif; ?><!--end 'repeater' if-->
I’m not sure how you can get the ID dynamically; maybe you can ask the Widget Block author about it?
I hope this makes sense 🙂
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.