Community Forums › Forums › Archived Forums › Design Tips and Tricks › Remove Date on Post Byline in Home Page Widget / Church Theme
- This topic has 10 replies, 2 voices, and was last updated 8 years, 4 months ago by Porter.
-
AuthorPosts
-
November 21, 2015 at 7:11 am #171701Melanie AmorimParticipant
Could you assist with removing the post date on the homepage
http://stemgardeninstitute.org/Thanks, Melanie
http://stemgardeninstitute.org/November 21, 2015 at 1:20 pm #171718PorterParticipantThis should do the trick, for home page only:
add_action('genesis_before_loop','porter_remove_home_post_info'); function porter_remove_home_post_info() { if (is_home() || is_front_page()) { remove_action( 'genesis_before_post_content', 'genesis_post_info' ); } }
Add the above to your functions.php file.
November 21, 2015 at 1:32 pm #171720PorterParticipantThe above didn't work, I believe I used the wrong hook on the remove_action. That being said, this is more specific, and I just tested it:
add_filter( 'genesis_post_info','porter_remove_home_post_info'); function porter_remove_home_post_info() { if (is_home() || is_front_page()) { $post_info = 'By [post_author_posts_link] [post_comments] [post_edit]'; return $post_info; } }
That will keep the author and comments, and edit button, but removes the date.
November 23, 2015 at 7:49 pm #171881Melanie AmorimParticipantHi Porter - Thank you but that crashed the site with an error message.... Syntax error. Maybe something else ? Melanie
November 23, 2015 at 9:10 pm #171883PorterParticipantWhere are you adding that code? I've just tested it on a live site, and it works perfectly, definitely no syntax error. Copy this exact code, and add it to your theme or child theme's function.php file, after the opening <?php tag.
add_filter( 'genesis_post_info','porter_remove_home_post_info'); function porter_remove_home_post_info() { if (is_home() || is_front_page()) { $post_info = 'By [post_author_posts_link] [post_comments] [post_edit]'; return $post_info; } }
November 23, 2015 at 9:36 pm #171885Melanie AmorimParticipantFirst time I added to the bottom, this time I added it here, up top?
November 23, 2015 at 9:45 pm #171886PorterParticipantAs you can see, the copy and pasting is turning certain characters into different text. You have no ', you have ' in place all over, which is breaking the code. What are you using to view this forum, and do you see the code in a grey box, with code formatting? Essentially your copy / paste is breaking it, where it doesn't for me, so something is going wrong there, as those characters shouldn't be converted.
November 23, 2015 at 9:51 pm #171887Melanie AmorimParticipantwell that's embarrassing, yes, I see what you mean. thank you 🙂
I have the code correctly updated but the date is still on the homepage ?
It's not showing up on the "News" page because I removed the byline using Genesis simple edits plugin.November 23, 2015 at 9:54 pm #171888Melanie AmorimParticipantOMG .... It just hit me that I can use the widget to remove the date?! ...
I'm so sorry, but that could do it ? I'm going to play around with the widget settings.
November 23, 2015 at 9:57 pm #171889Melanie AmorimParticipantSo I think using the plugin and widget settings and your code there are no dates on the website posts. I thank you very very much !!
November 23, 2015 at 9:57 pm #171890PorterParticipant -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.