How not to strip leading zero in advanced custom fields
Just make the field type as text and it will work
Just make the field type as text and it will work
WordPress content is “frozen”. That is, if you add an alt on an image after posting an article with the image, the alt attribute will not be updated on its own. If you ever use Gutenberg, it is easy to be able to make a regex and update your article on the fly. You can … Read more
Less code lines with get_post_custom_values() $values = get_post_custom_values(‘slider_id’, $post_id); // if non-empty if($values) { foreach($values as $value) echo get_new_royalslider($value); } If $values array is empty, nothing happens.
Rather than outputting all rows, you can check each row in a loop and only output it if something matches. In this example, there’s a treatment field within the repeater that is the value of the name of the treatment post. If the two match, output the other values: $other_page = 89; $practioners = get_field( … Read more
“Advanced custom field plugin not showing in admin sidebar” gave me a useful clue. Finally, I’ve moved int the plugin directory, and cloned the git repo directly: git clone git://github.com/elliotcondon/acf4.git advanced-custom-fields
Check if meta_key exists in wp_list_pages
Used normal method to get field data instead of “unserialize“ Switched this line: $album_repeatable = unserialize($post_meta_data[‘album_repeatable’][0]); to this line: $album_repeatable = get_post_meta($post->ID, ‘album_repeatable’, true); Now my repeatable field Data is being displayed. Thanks @toscho for pointing it out…
Possibly better than strtotime, as you already know the date format would be date_create_from_format(). Something like: $course_start = date_create_from_format(‘dmY’,$row[‘start_date’]); if ($course_start > date(‘dmY’)){ echo ‘<tr>’; echo ‘<td>’ . $i . ‘</td>’; echo ‘<td>’ . $row[‘start_date’] ; // Check, if “end_date” field is not empty if( $row[‘end_date’]) { echo ‘ – ‘ . $row[‘end_date’] . ‘</td>’; … Read more
use if instead of while because you want to compare if a field is exist or has some value, by using while you are looping trough and this loop can’t stop until your php’s execution time limit is ended, try this. <?php if (get_field(‘block_repeater’)) { ?> <ul> <?php if (has_sub_field(‘block_repeater’)) : ?> <li> <!– problem … Read more
Replace $do_not_duplicate = $post->ID; with $do_not_duplicate = get_the_ID();. After the first loop (the featured) call wp_reset_postdata(); …. </div><!– end #featured –> <?php endwhile; wp_reset_postdata(); if( have_posts() ) : while ( have_posts() ) : the_post(); …