Maybe not the ideal solution (you’re looking for), but you can probably hide/disable the current Paragraph block and create a new one from ACF.
This however would require you to migrate current content to the new ACF blocks, so far from ideal.
I have the same issue. You can increase the width of the sidebar by editing some CSS, but it’s not very intuitive.
To me, the sidebar should be at least draggable so a user can set the preferred width of it.
Figured it out 🙂
$product_id = $p->ID;
$product = wc_get_product( $product_id );
echo $product->get_sku();
Find the post/product ID inside the loop, look for the SKU.
I did notice however that it spits out all the data about the product, which doesn’t seem very optimised? Would there be any way to only get the SKU without getting the whole product data?
Seemed to have fixed it by using this. Maybe someone knows if this is the correct way? Maybe there’s a cleaner way?
$locs = get_posts(array(
'posts_per_page' => -1,
'post_type' => 'locations',
'orderby' => 'monday_start_time',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'monday_start_time',
'value' => '',
'compare' => '!=',
),
)
));
Found a snippet and modified it a little, seems to work now!
<?php
$starNumber = get_field('rating');
for($x=1;$x<=$starNumber;$x++) {
echo '<i class="fa fa-star" aria-hidden="true"></i>';
}
if (strpos($starNumber,'.')) {
echo '<i class="fa fa-star-half-o" aria-hidden="true"></i>';
$x++;
}
while ($x<=5) {
echo '<i class="fa fa-star-o" aria-hidden="true"></i>';
$x++;
}
?>
For anyone using this: it’s based on the stars from FontAwesome, with the smallest step being .5
I’ve managed to get @hube2 solution to work, but with help from (for me) a bit clearer code:
You’ll need to start a counter just above your while loop:
$counter = 0;
Then just before your closing endwhile; you’ll need to advance the counter:
$counter ++;
Then simply print the number of that loop like this:
<?php print "$counter"; ?>
or
<div class="name-<?php print "$counter"; ?>"
Source: https://support.advancedcustomfields.com/forums/topic/repeater-field-add-break-after-x-rows/
Hi @hube2 ,
I assume this creates a count which increases by 1 every time to get a unique ID?
This resulted in a white page for me though. I’m not sure if i’m supposed to change some of the tags (fields? don’t know what it’s called) but as I mentioned much of this is wizardry for me.
Thanks for the quick reply. I’ve tried variations of the code from the documentation but I’m a still lost.
<php $field = get_field($field_name, $post_id, $format_value); ?>
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.