True/False ACF field returning null by default even if default value is true
You will need to update every existing post otherwise, you will get NULL every time even if you set the default value to TRUE. You can bulk edit/update altogether.
You will need to update every existing post otherwise, you will get NULL every time even if you set the default value to TRUE. You can bulk edit/update altogether.
If you don’t want to deal with the coding part that much, you can always take a look on WCK plugin, that allows you to create custom taxonomies, and allow your users to see the information displayed as you want.
It looks to me like the_sub_field echoes content. It is never returned for substr to work on. You need get_sub_field. $givchars = 5; $postgiv = get_sub_field(‘get_involved_text’); $modgiv = substr($postgiv, 0, $givchars); echo ‘ ‘ .$modgiv. ‘ ‘;
If you pasted the exact second block you’ll get errors because you are breaking up the closing and opening PHP tags <?php and ?>. Try this instead, or have a look at this for a better understanding, notice the difference … if ( is_page( ‘about’ ) || ’29’ == $post->post_parent ) { //Start of the … Read more
I posted on ACF site, they were very helpful in finding the solution. if( get_field(‘field_name’) && get_field(‘field_name’)) { } Was that solution I was looking for. I knew it was never asked because it was simple logic :/ Slowly learning as I go. Hope this helps someone.
I would suggest two solutions. Solution:1 Use WP_Query, if there are only few products, may be 10 or 20 Use WP_Query, loop through all the products, check if transmission_URL is not empty, if it is not empty, print the link and break from the loop. The following code snippet goes inside header.php $product_query = new … Read more
How do I subquery with custom meta fields?
If I understand this correctly, you want the whole code inside if ($type == “payment-services”) to run only once. There might be an easier way to do this, but a suggestion is: Add a variable with a certain value before your for loop (e.g. $run=”yes”) Put the code you only want to run the first … Read more
It looks like you’re clearing the queried posts by setting the posts var to an empty array. $queryRecipesGrid = new WP_Query( $argsRecipesGrid ); // first you get the posts here /** partie de code Richardson **/ $queryRecipesGrid = array(); // then you wipe them out by setting the same var to empty array. Regarding the … Read more
The method to use is… In the acf_add_options_sub_page declaration, add ‘post_id’ => ‘article’ as a parameter. (post_id) This is how the field data, as entered on the Options page corresponding to my post type, will be saved. On the display end, display using $featured_posts = get_field(‘featured_posts’, ‘article’); ‘article’ and ‘report’ are both used. In my … Read more