The ‘Check first block type’ function is exactly what I need (THANK YOU!), but how do I use it outside of a loop?
E.g., I want to show a different logo in my header if the first block isn’t a cover…
Im getting this error:
Notice: Trying to get property ‘post_content’ of non-object
This is for the 404 page and archive…
I tried adding ‘global $post;’ to the function.. I can’t get it working 😢
@dmchale Thank you for the code, but how do I use it?
If I want to get the authors name (ACF field) from my Testimonials block on page 2, would I use the following…? what is the selector?
get_field_from_block( $selector, 2, 'block-49b987a0-a081-4bf7-b7e0-5858d28c9c0a' );
any help is appreciated.
@micqey Thanks for the code – are you able to give an example of use?
Anyone looking how to do this, answer at https://stackoverflow.com/questions/35997249/populate-acf-checkboxes-with-post-types
How do you use this code?
I added it to my fuctions.php and changed the $fc_field and $fc_layout variables to match mine, but how do I use it in my index.php loop? Do I need to call the function? Nothing happens when I add it to my functions file.
I’m currently having to manually add an excerpt via the “except field”- <?php the_excerpt_max_charlength( 400 ); ?>
Any help appreciated.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.