You’re welcome 🙂
Oh ok, then this code won’t work because what this does is to display a banner image in the product Category page, as in website-url/product-category/computers, is different to what you want to do.
In this case, I’d use a plugin to add custom badges, I’ve used this one and it works ok.
Hi there,
Make sure your field name is $foto or replace that part of the code with your own field name.
Thanks for your reply, will do some more tests tomorrow as today is a busy day for me, and will be back with any news.
That worked, in case this helps somebody else:
if ( is_product_category() ) {
// vars
$queried_object = get_queried_object();
$taxonomy = $queried_object->taxonomy;
$term_id = $queried_object->term_id;
$foto = get_field( 'foto', $queried_object );
$foto = get_field( 'foto', $taxonomy . '_' . $term_id );
if( get_field('foto', $taxonomy . '_' . $term_id) ) {
echo '<div class="cat-banner"><img src="' . $foto . '"/></div>';
}
}
Ok, just $post_id or that should be replaced with some specific data?
Thanks!
Solved!
I replaced $widget_id
with $args['widget_id']
Awesome, I’ll check that option. Hiring another dev is out of the client budget, but she’s quite flexible about the options for this events list.
Thanks!
Thanks James, seems too advanced for me at the moment. Would it be easier to achieve if I use single Date Time Picker fields, instead of a Repeater field?
Ok, the error is fixed but it only shows the third date, date1 and date2 display today’s date and time. I replaced $date_3 with $date, is that ok?
UPDATE > I think the date problem is because is inverting the day/month. If the calendar shows 27/09/2016 (September 27), it reads the day as 27 and the month doesn’t exist, if I pick 09/10/2016 (October 09) it displays as September 10. I inverted the formats in the field settings (to m/d/y) and now it works.
I tried this and it gives me the following error > FATAL ERROR: CALL TO UNDEFINED FUNCTION HAVE_ROW()
I’m sure I’m doing something wrong, this is the code:
function adb_display_custom_fields() {
echo '<div class="curso-meta">';
if (have_row('dates')) {
$dates = array();
while(have_row('dates')) {
the_row();
$date = get_sub_field('date');
if ($date) {
$dates[] = date_i18n('j \d\e\ F \-\ G \h\s', strtotime($date));
}
} // end while have rows
if ( $dates) {
echo '<h5>UPCOMING EVENTS</h5><p> ' . implode(' | ', $dates) . '</p>';
}
} // end if have rows
echo '</div>';
}
Hi John, if I only pick date and time for the required field ($date1), it returns:
UPCOMING EVENTS
17 de agosto – 16hs | Today’s date and current time | Today’s date and current time
I’ll try with your suggestion and will report back.
Thanks.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.