Get specific Blocks from Post

PHP-side you can pass the post_content to the parse_blocks() function which will provide you with an array of associative arrays representing each block. Similar functionality is offered JS-side in the form of the wp.blocks.parse() function from the @wordpress/blocks package. For illustrative purposes, here is a var_dump() of that output for the default “Sample Page”: array(9) … Read more

Get Content Limit?

Limiting the content to a number of words is a little tricky. Limiting the number of characters is much easier to do and is built in to WordPress already. You can use the the_excerpt() and get_the_excerpt() functions to limit the number of characters in the beginning of the post content. The example in the first … Read more