In the members-only forum, a user asked:
Hi Sridhar, What do you think about a Tutorial either using ACF or another method to create a Services Page/Template. For example, if you have several services where you are using a Page per Service to provide further information about the service. It’s likely you would like to set those Pages as Childs to a Services Page, resulting in a Permalink Structure like: example.com/services/example-service How could you go about having a solution which would automatically add these ‘Service Pages’ to the Service Page/Template, pulling in the Featured Image and either a Content Limit or Excerpt then a Button to the Service Page for further information…Wouldn't it be handy to have a grid of child Pages automatically appear below the content on static Pages in your Genesis site? In this article I share the code that will do just that in an elegant 3-column grid showing linked featured image (if present, otherwise a placeholder), linked title, value of a custom field called "Custom Page Excerpt" (created using ACF) if present, otherwise the automatic excerpt. The default sort order of the sub Pages is alphabetically by their titles. This can be changed to custom order by specifying Page Order. Pages that do not have child pages continue to appear like before. We are going to add
page.phpto the child theme which works for all Pages rather than a custom Page template which would need to be manually applied.
Step 1Install and activate Advanced Custom Fields plugin. Add a field group named say "Page Meta" having a Wysiwyg field called
Custom Page Excerpt.
Step 2Set featured images for your sub Pages. In this example we are using images sized 800 x 389. If you would like control on how exactly how much text should appear in the grid or if you'd like to display formatted HTML (bold, links etc), populate the Custom Page Excerpt field for the sub Pages.
Step 3Add the following in child theme's functions.php:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.