New answers tagged

0

Maybe try amending the query to something like this (i havent test this but cant hurt to try) maybe get rid of the meta query itself and just add 'meta_key' => 'recommended_sidebar', 'meta_value' => 'yes' into the query itself


0

I'm not using your theme. But if you want to call ACF field to frontend. just using below code. <?php echo get_field('slug_acf_field'); ?>


0

Little Aprilia learns to code ;-) was a silly idea to mix two things, justed added the ACF-Field, using its own if-rule if( get_field('apri') ): ?> <span class= "promo"><?php the_field('apri'); ?></span> <?php endif;


1

If you're using Autoload/Composer you can use $image = \acf_get_attachment( $attachment_id ); to get an acf image array. If not I guess you can use require_once() to load your plugins/advanced-custom-fields-pro/includes/api/api-helpers.php, however I haven't tested this yet.


0

Another workaround but maybe useful to others: I use a custom post type called "Globals" to store block templates used for global sections of the site such as footer. It would be nice to be able to use an options page but I don't think its possible at the moment.


0

I am no expert but you are submitting multiple checkboxes with the same name attribute. Your current form GET action will return the url params like this for example... http://www.urltoshow.com/ville/paris?style=Classique&syle=Luxe So because there are 2 usages of param style in the url above, it means PHP $_GET['style'] will only return the last getted ...


0

Thank you so much, Fresz! That helped me a lot :) I found another hook from Advanced Custom Fields (acf/save_posts), and now have a working (I think) solution! Reference: https://www.advancedcustomfields.com/resources/acf-save_post/ I've just tested by checking the old and new value of one of the custom fields, and the function seems to do the trick. Next ...


0

From your explanation, it seems that we need wp_mail() function and post_updated hook. wp_mail() reference: https://developer.wordpress.org/reference/functions/wp_mail/ post_updated action hook: https://developer.wordpress.org/reference/hooks/post_updated/ <CPT_name> - replace this with your custom post type key. (Untested code - it should give you a ...


0

The most basic option I can think of is this add_shortcode('bt_featured_image_acf_location', 'bt_featured_image_acf_location'); function bt_featured_image_acf_location ($atts) { return get_field('location', get_post_thumbnail_id()); } Change 'location' to your acf field name and thats it. get_post_thumbnail_id() will get the current post featured image ...


3

But how does the actual HTML get on the page? How does that SQL data translate into a page full of blocks? Normally the HTML for a block is inside the HTML comments. However, much like shortcodes, ACF blocks are rendered in PHP, so when the post is processed during the_content filter, that block is replaced with the rendered HTML. WordPress knows to do this ...


0

You have to return the output with the value. you can check the following code. function hello_shortcode() { // Load field settings and values. $field = get_field_object('producent'); if( ! is_product_category() ) { $checkbox = $field['value']; } else { $checkbox = $field['label']; } $output = '‹p›'....


Top 50 recent answers are included