Display ACF field only if value is greater than 0

I see you’ve found your own answer, but I wanted to offer some advice for making your code a little more succinct. <?php // Different versions of a number $unformatted = get_field(‘paid_attendance’); $cleaned = str_replace(‘,’, ”, $unformatted); // Remove commas from string $integerValue = absint( $cleaned ); // Convert to absolute integer. $floatValue = number_format($cleaned, … Read more

Advanced Custom Fields Image Crop

There’s a plugin with an additional field typ with which you can force the user to crop the image to a specific size: https://github.com/andersthorborg/ACF-Image-Crop It’s not clear if it’s still under active development so you’d have to test it with newer ACF versions. There’s also one with aspect ratios instead of sizes if you need … Read more

ACF | WooCommerce | Theme Development | How to include a /template-part/ that makes use of ACF’s on a custom WooCommerce homepage?

You cannot include template files via URL, which is what get_template_directory_uri() returns. You need to use the server file path, which you get get with get_theme_file_path(): $heroslider = get_theme_file_path( ‘template-parts/hero-slider.php’ ); echo $heroslider; include_once( $heroslider ); However, if you’re including templates (rather than files with function/class definitions), you should use get_template_part() to get the correct … Read more

How to search pdf attachment?

I would recommend you first to search attachments by your search term. For example: $attachments_query = new WP_Query( array( ‘s’ => ‘Your search query’, // <– Your search term ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘application/pdf’, ‘post_status’ => ‘inherit’, ‘posts_per_page’ => -1, ) ); With this query, you will get all PDF files that fit your … Read more

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