You have a WordPress site with a Genesis child theme and you want to display the post meta data before the title of the post.
What are the meta data of a post ? They are for example the name of the author, the post date, the category and the tags.
Genesis framework by default displays these meta data after the post title.
So if your web designer wants these data displayed before the title, how can you do it? The solution is to add these two lines of code.
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
add_action( 'genesis_entry_header', 'genesis_post_info', 9);
Where? You can put them in two different files of your child theme:
- functions.php
- a template file
If you add these lines in functions.php, they will affect every page that displays posts. So they will affect both single post pages and pages that display a list of posts, like the blog page, the author pages, the category, tag and date pages.
Or you could write them in a template file. In this case they will affect just the pages rendered by that template file.
If you are not interested in the technical details you can stop reading here. If you are interested, read on!
Technical explanation of how Genesis displays the post meta
The Genesis framework displays the post meta data by adding the function genesis_post_info to the hook genesis_entry_header. The priority assigned to the function genesis_post_info is 12. The line of code is the following one.
add_action( 'genesis_entry_header', 'genesis_post_info', 12 );
Then Genesis displays the post title through the function genesis_do_post_title. It hooks this function to the same hook genesis_entry_header as the post meta data. But here it uses the default priority 10.
add_action( 'genesis_entry_header', 'genesis_do_post_title' );
A priority of 10 is higher than a priority of 12, as the official WordPress documentation explains. So WordPress executes first genesis_do_post_title and after genesis_post_info.
So, what is the meaning of the two lines of code above ?
The first line uses the function remove_action to remove the Genesis implementation.
The second line adds again the genesis_post_info function, but with a priority of 9. In the WordPress world, it means that WordPress will execute first genesis_post_info and after genesis_do_post_title .