Function that get ACF fields value before saving
Function that get ACF fields value before saving
Function that get ACF fields value before saving
Gettext for custom field checkbox values
I ran a test and the following works: global $testMe; $testMe = 0; function my_acf_update_value( $value, $post_id, $field ) { global $testMe; $testMe = $value; return $value; } add_filter(‘acf/update_value/key=field_5308e5e79784b’, ‘my_acf_update_value’, 10, 3); // Test: Apply the filter apply_filters(‘acf/update_value/key=field_5308e5e79784b’,’a’,’b’,’c’); // end Test echo $testMe; // prints ‘a’ So, in principle, your code is functional. There are … Read more
From pre_get_posts in Codex: Identifying Target Queries When using pre_get_posts, be aware of the query you are changing. One useful function is is_main_query(), which can help you ensure that the query you are modifying is only the main query. Use it in combination with other conditional tags to only alter the main query on the … Read more
I was having the exact same problem on an archive page of a custom post type with a needless extra query; for pagination reasons. Searching for the same solution I found this post on Stack Overflow https://stackoverflow.com/questions/21303743/new-wp-query-or-pre-get-posts-to-view-all-posts-for-custom-post-type I had a play and added this line of code into the function. if( ! $query->is_post_type_archive()) return; So … Read more
Well after some time time and the support of the guys in ACF i got through this. My template was accessing category data only by reference, a variable was created that referenced to the category id, and by that variable the category name and other data were called. Thankfully the guys at ACF have thought … Read more
Display “Today” Instead of Date for Pubslished Posts
how to load custom single.php?
I achieved this recently with the following code in archive.php add_action(‘genesis_loop’, ‘blah_search_results’); function blah_search_results() { while (have_posts()) : the_post(); if (is_category(‘in-the-news’)) { // Get article URL $article_url = get_field(‘original_article_url’); // rest of theme goes here } endwhile; }
Get post id of permalink for a specific custom post type?