{"id":2093,"date":"2020-11-03T13:27:05","date_gmt":"2020-11-03T13:27:05","guid":{"rendered":"https:\/\/www.gmitropapas.com\/?post_type=knowledgebase&p=2093"},"modified":"2020-11-04T20:39:48","modified_gmt":"2020-11-04T20:39:48","slug":"the-new-generate_do_template_part-action","status":"publish","type":"knowledgebase","link":"https:\/\/www.gmitropapas.com\/generatepress-tips-and-tricks\/general\/the-new-generate_do_template_part-action\/","title":{"rendered":"The new generate_do_template_part action"},"content":{"rendered":"\n
This action, new to GeneratePress 3 premium<\/a> update looks like is a game changer! This action will allow us to build post loop templates in Block Elements, and then hook them into the theme.<\/p>\n\n\n\n Currently, there is no UI for the action but you can use some code and, the also new in GP3, Block Element to completely replace the post loop with your own creation. As Tom mentions in this post, he will be introducing Template Tags (like in the current Header Element<\/a>) into Block Elements in an upcoming GPP update that will allow us to dynamically pull in data from the current post object while using GenerateBlock elements!<\/p>\n\n\n\n Meanwhile, you can still take advantage of the Create your beautiful 404 page by going to Appearance -> Elements<\/strong> and setting up a new block element. Set the hook to be a generate_do_template_part<\/code> action to create some magic. In this example, we are going to replace the 404 page<\/strong> with a custom block element<\/strong>.<\/p>\n\n\n\n
Custom Hook<\/code> and select
generate_do_template_part<\/code> for Custom Hook Name<\/strong>. Finally, select the
404 template<\/code> as Location<\/strong>.<\/p>\n\n\n\n