Gutenberg First Block on Page Conditional?

Here’s a solution I’ve come up with, that works with WordPress 5.4 and ACF Pro 5.8.9. First you need this function somewhere in functions.php: /** * Get ID of the first ACF block on the page */ function sg_get_first_block_id() { $post = get_post(); if(has_blocks($post->post_content)) { $blocks = parse_blocks($post->post_content); $first_block_attrs = $blocks[0][‘attrs’]; if(array_key_exists(‘id’, $first_block_attrs)) { return … Read more

pre_get_posts filter using numeric meta_query comparison (from dates)

As mentioned in the comments you an issue in your meta query, as you set the key to 20161126 or similar. Instead key should be filled with your meta key post_end_date. Meta query also support multiple arrays to combine your query to also include posts where the meta key is not set. The example would … Read more