Date not working correctly

What you did wrong here is the part date(‘d’, $rem_days). The function date() should be used to convert timestamp to a formatted date, not to converting a time difference in timestamp to time difference in days. You can fix this by replacing date(‘d’, $rem_days) with floor($rem_days/86400). The complete code should be: $event_date = strtotime( get_field( … Read more

How to automatically update ACF field value every year?

If you don’t want to use a scheduler (ex: Action Scheduler) or a cron job, and you only want to update once per year, then an option that tracks the next update time is probably the simplest approach (untested): add_action( ‘init’, static function () { $option_name=”cpt_ages_next_update”; $option = absint( get_option( $option_name ) ); if ( … Read more

ACF – How to get custom taxonomy term image field

I found a solution for this: <?php $current_term_id = get_queried_object_id(); $taxonomyName = “car-brand”; $parent_tax_ID = $current_term_id; $parent_tax = get_term($parent_tax_ID); $terms = get_terms( $taxonomyName, array( ‘parent’ => $parent_tax_ID, ‘orderby’ => ‘slug’, ‘hide_empty’ => false ) ); foreach ( $terms as $term ) { $image2 = get_field(‘am-brand-img’, $term); echo ‘ <div class=”am-ts-item”> <a href=”‘ . get_term_link( $term … Read more

Custom fields disappearing when a custom post type is assigned

I ended up solving this on my own and thought I would come back to show my solution. On my taxonomy page I needed to get the current taxonomy term like so: <?php $term = get_queried_object(); if (get_field(‘subtitle’, $term)) { ?> <p><?php the_field( ‘subtitle’, $term )?></p> <?php } ?> Here is the documentation page: https://www.advancedcustomfields.com/resources/adding-fields-taxonomy-term/

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)