If you would like to remove “Post Info” section located at the bottom of your WordPress blog post in your Studiopress Genesis child theme, here are 3 ways you can remove the post info function.
Note: You do not need to add each of these to your code. You just need to select which option you want to use in your Genesis Child Theme and add the appropriate code to your functions.php file.
Option 1: Remove the post info function completely.
This will remove the post info section completely from your blog.
/** Remove the post info function */
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
- Open functions.php
- Copy and paste the above code into functions.php (at the bottom)
- Save your document and reload your site
Option 2: Change the position of the post info function.
This will remove the post info section from your blog. The second set of code will add it back in – this time, at the end of your blog post.
/** Remove the post info function */
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
/** Adding the post info function */
add_action( 'genesis_after_post_content', 'genesis_post_info' );
- Open functions.php
- Copy and paste the code labeled “Remove the post info function” into functions.php (at the bottom) – this will remove the code.
- Copy and paste the code labeled “Adding the post info function” into functions.php (at the bottom) – this will add it back in at the bottom of your post.
- Save your document and reload your site
Option 3: Customize the post info function
If you would like to customize the text in the post info function, add the following code and then make your edits.
/** Customize post info function in genesis */
function post_info_filter($post_info) {
if (!is_page()) {
$post_info = ' EDIT THIS TEXT ';
return $post_info;
}}
add_filter( 'genesis_post_info', 'post_info_filter' );
Make sure you edit the text that says EDIT THIS TEXT
$post_info = ' EDIT THIS TEXT ';
- Open functions.php
- Copy and paste the code labeled “Customize post info function in genesis” into functions.php (at the bottom) – this will let you keep the post info function and customize the section.
- Save your document and reload your site
Bonus: Using conditional tags with post info data
If you want to add conditional tags so that the post info is displayed on certain pages, add the following code.
/** Display post info data based on conditional tags */
function post_info_filter($post_info) {
if (is_home()) {
$post_info = ' EDIT THIS TEXT ';
return $post_info;
}
elseif(is_single()){
$post_info = ' EDIT THIS TEXT ';
return $post_info;
}
else {
}
}
add_filter( 'genesis_post_info', 'post_info_filter' );
- Open functions.php
- Copy and paste the code labeled “Display post info data based on conditional tags” into functions.php (at the bottom).
- Edit the text that says “EDIT THIS TEXT” – there are two instances.
- Save your document and reload your site