The code in this download folder adds a custom block which enables you to select individual entries from posts, pages & custom post types displayed in any number of grid columns.
The above screenshot shows the block added on a single Edit Post screen which includes a drop down list of single posts you can select for inclusion in your grid. Watch the following demo video to learn more.
Shows a Selected Posts box added after the editor on the Edit Post screen enabling the user to select specific posts to display in a grid on specific single posts and pages.
Tested using the Genesis Sample child theme & the 2021 default theme for WordPress. Works in any WordPress theme.
There’s 3 steps :
- # Upload the folder named selected-posts to your child themes blocks folder like this :
- # Copy & paste the PHP code ( without the opening PHP tag ) to the end of your child themes functions file.
- # Install ACF, in your Dashboard, go to Custom Fields > Tools and import the .json file.
The code works with the Genesis Custom Blocks plugin and the Advanced Custom Fields ( ACF ) plugin by Elliot Condon.
Theme Specific Code
The block.php file contains code which works in any WordPress theme as well as code which only works in Genesis child themes ( by default, this code is commented out ). Only use 1 solution.
This is the demo video showing the custom block working in the Twenty twenty One default theme for WordPress.