Skip to content

Instantly share code, notes, and snippets.

@scottnix
Last active December 18, 2015 13:29
Show Gist options
  • Save scottnix/5790772 to your computer and use it in GitHub Desktop.
Save scottnix/5790772 to your computer and use it in GitHub Desktop.
Thematic remove Author information from postheader (filter example)
<?php
// reference http://thematictheme.com/forums/topic/making-minor-amendments-to-templates/
// reference override example (same thing, different way to do it). I prefer the filter. https://gist.github.com/scottnix/5790774
// remove the author information from all posts using a filter
function childtheme_postheader_postmeta($postmeta) {
$postmeta = "\n\t\t\t\t\t";
$postmeta .= '<div class="entry-meta">' . "\n\n";
$postmeta .= "\t" . thematic_postmeta_entrydate() . "\n\n";
$postmeta .= "\t" . thematic_postmeta_editlink() . "\n\n";
$postmeta .= '</div><!-- .entry-meta -->' . "\n";
return $postmeta;
}
add_filter('thematic_postheader_postmeta', 'childtheme_postheader_postmeta');
// remove the author information from only categories using a filter
// this is just an example of the above, but utilizing a conditional wordpress tag
function childtheme_postheader_postmeta($postmeta) {
if ( is_category() ) {
$postmeta = "\n\t\t\t\t\t";
$postmeta .= '<div class="entry-meta">' . "\n\n";
$postmeta .= "\t" . thematic_postmeta_entrydate() . "\n\n";
$postmeta .= "\t" . thematic_postmeta_editlink() . "\n\n";
$postmeta .= '</div><!-- .entry-meta -->' . "\n";
}
return $postmeta;
}
add_filter('thematic_postheader_postmeta', 'childtheme_postheader_postmeta');
@scottnix
Copy link
Author

Override Example - https://gist.github.com/scottnix/5790774
Filter Example - https://gist.github.com/scottnix/5790772

Both do the same thing. You only need one of these functions, the second function is a example of using a conditional to achieve different results depending on your needs, the above example retains the normal functionality on everything except the categories, which are set to not show the Author Name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment