I am a non-coder, I am trying to implement different entry-meta for home & single page.
For homepage I want to keep [post_author_posts_link] [post_modified_date] [post_edit]
Backend Code:
//* Customize the post info function
add_filter( 'genesis_post_info', 'explore_post' );
function explore_post($post_info) {
if ( is_front_page() ) {
$post_info = '[post_author_posts_link] [post_modified_date] [post_edit]';
return $post_info;
}}
Result
For a single page, I want the same output, but when someone hovers their mouse over admin, I want it to automatically show me the author box information with post link, as shown in the screenshots.
How can I make on single page? Please help me.
Thanks & Regards
Abhishek
My Answer:
To achieve this, you can use a combination of CSS and jQuery. Here's how you can do it:
1. Add the following CSS to your theme's stylesheet to hide the author box information by default:
css
.author-box {
display: none;
}
2. Add the following jQuery code to show the author box information when hovering over the post author's name on single pages:
javascript
jQuery(document).ready(function($) {
$('.entry-meta .author a').hover(function() {
$('.author-box').fadeIn();
}, function() {
$('.author-box').fadeOut();
});
});
3. Modify your backend code to include the author box information in the entry-meta for single pages:
php
//* Customize the post info function
add_filter( 'genesis_post_info', 'explore_post' );
function explore_post($post_info) {
if ( is_front_page() ) {
$post_info = '[post_author_posts_link] [post_modified_date] [post_edit]';
} else {
$post_info = '[post_author_posts_link] [post_modified_date] [post_edit] ';
}
return $post_info;
}
With these changes, the author box information will be hidden by default and will only be shown when hovering over the post author's name on single pages.
Rate this post
4 of 5 based on 3676 votesComments