in using GeneratePress Theme construction WordPress At the time of the website, the Block Element and Hook The system provides powerful page insertion capabilities. Many users will insert customized modules, such as prompt boxes, advertisements, author information, etc., under the title of the article, at the end of the content or in the sidebar. The display order of these modules depends on the "Hook Priority".
In this article, we will illustrate how Hook Priority works and how to set it up by way of a practical demonstration.
![图片[1]-如何在 GeneratePress 中使用 Hook 优先级控制页面元素的显示顺序](https://www.361sale.com/wp-content/uploads/2025/05/20250517114004574-image.png)
i. The default priority is 10
When you create a Block ElementThe system defaults to 10 if no priority is set when a Hook is inserted into a page.
For example. generate_after_header In these two Hooks, content blocks are added:
- The first is the blue background container (default priority 10)
![图片[2]-如何在 GeneratePress 中使用 Hook 优先级控制页面元素的显示顺序](https://www.361sale.com/wp-content/uploads/2025/05/20250517140454371-image.png)
- The second is the pink background container (also default priority 10)
![图片[3]-如何在 GeneratePress 中使用 Hook 优先级控制页面元素的显示顺序](https://www.361sale.com/wp-content/uploads/2025/05/20250517140555303-image.png)
Because the priority is the same, the system displays them in the order they were created. That is, the blue container created first comes first and the pink container comes second.
![图片[4]-如何在 GeneratePress 中使用 Hook 优先级控制页面元素的显示顺序](https://www.361sale.com/wp-content/uploads/2025/05/20250517140617162-image.png)
II. Changing the display order by modifying the priority
You can manually set the priority value to control the order of the elements:
- Set the priority of the blue container to 12
![图片[5]-如何在 GeneratePress 中使用 Hook 优先级控制页面元素的显示顺序](https://www.361sale.com/wp-content/uploads/2025/05/20250517140703561-image.png)
- The pink container stays at the default 10
After refreshing the page, the blue container will be displayed after the pink container.
![图片[6]-如何在 GeneratePress 中使用 Hook 优先级控制页面元素的显示顺序](https://www.361sale.com/wp-content/uploads/2025/05/20250517140810583-image.png)
The conclusion is that the smaller the value the higher the priority, the further forward the element is. The larger the value the higher the priority, the further back the element goes.
III. Inserting subheadings between article titles and meta-information
This is a very common scenario: one wishes to insert a subheading or descriptive content to be displayed in the articlecaptionand between meta-information such as release date.
Default:
- The title of the article uses the
H1tab (of a window) (computing) - Meta-information (e.g., author, date) is also passed through the Hook Insert, priority 10
- If you create a subtitle block that also uses the
generate_after_entry_titleIf the priority is 10, then it comes after the meta-message
![图片[7]-如何在 GeneratePress 中使用 Hook 优先级控制页面元素的显示顺序](https://www.361sale.com/wp-content/uploads/2025/05/20250517141052723-image.png)
Solution:
- Set subheading priority to 7 (less than 10)
![图片[8]-如何在 GeneratePress 中使用 Hook 优先级控制页面元素的显示顺序](https://www.361sale.com/wp-content/uploads/2025/05/20250517141121719-image.png)
- This way the subtitle is displayed between the title and the meta information
![图片[9]-如何在 GeneratePress 中使用 Hook 优先级控制页面元素的显示顺序](https://www.361sale.com/wp-content/uploads/2025/05/20250517141147687-image.png)
If you set the priority to 11, the subtitle appears after the meta information.
![图片[10]-如何在 GeneratePress 中使用 Hook 优先级控制页面元素的显示顺序](https://www.361sale.com/wp-content/uploads/2025/05/20250517141212757-image.png)
![图片[11]-如何在 GeneratePress 中使用 Hook 优先级控制页面元素的显示顺序](https://www.361sale.com/wp-content/uploads/2025/05/20250517141308191-image.png)
IV. Controlling the order in which content blocks are displayed at the end of an article
Many sites will add modules at the end of articles such as:
- Author Information
- Related Articles
- advertisements or CTA blocs
![图片[12]-如何在 GeneratePress 中使用 Hook 优先级控制页面元素的显示顺序](https://www.361sale.com/wp-content/uploads/2025/05/20250517141644313-image.png)
These modules are usually inserted in the generate_after_entry_content in this Hook, and the footer meta information (Footer Meta) also uses this Hook with priority 10.
![图片[13]-如何在 GeneratePress 中使用 Hook 优先级控制页面元素的显示顺序](https://www.361sale.com/wp-content/uploads/2025/05/20250517141707125-image.png)
If you want the custom module to appear above the footer meta:
- Set the priority of this module to 9
![图片[14]-如何在 GeneratePress 中使用 Hook 优先级控制页面元素的显示顺序](https://www.361sale.com/wp-content/uploads/2025/05/20250517141729374-image.png)
This allows you to adjust their top and bottom order without changing the HTML Structure or writing CSSThe
![图片[15]-如何在 GeneratePress 中使用 Hook 优先级控制页面元素的显示顺序](https://www.361sale.com/wp-content/uploads/2025/05/20250517141811684-image.png)
summarize
Hook priority is GeneratePress One of the important mechanisms for controlling the structure of a page:
- The default priority is 10
- The smaller the priority value, the more content is displayed first
- If multiple elements use the same Hook and have the same priority, they are listed in the order they were created.
- Flexibility to insert advertisements, subheadings, explanatory text, etc. without code modifications
Proficiency in the way Hook and Priority are combined helps to better customize the page content layout and achieve a well-structured presentation.
Recent Updates
Link to this article:https://www.361sale.com/en/54952/The article is copyrighted and must be reproduced with attribution.



















![表情[wozuimei]-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/themes/zibll/img/smilies/wozuimei.gif)
![表情[baoquan]-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/themes/zibll/img/smilies/baoquan.gif)

No comments