Skip to content

Instantly share code, notes, and snippets.

@scottnix
Created September 19, 2015 04:55
Show Gist options
  • Save scottnix/4a38c35941ec1e8c4f24 to your computer and use it in GitHub Desktop.
Save scottnix/4a38c35941ec1e8c4f24 to your computer and use it in GitHub Desktop.
Thematic Theme SVG Icons
// override post footer to add SVG icons, pulls from /icon/ folder inside the child theme
function childtheme_override_postfooter() {
$post_type = get_post_type();
$post_type_obj = get_post_type_object($post_type);
$tagsection = get_the_tags();
// Display nothing for "Page" post-type
if ( $post_type == 'page' ) {
$postfooter = '';
// For post-types other than "Pages" press on
} else {
$postfooter = '<footer class="entry-utility">';
$postfooter .= '<ul class="main-utilities">';
$postfooter .= '<li><svg class="icon-user"><use xlink:href="' . get_stylesheet_directory_uri() . '/icons/icons.svg#icon-user"></use></svg>' . thematic_postmeta_authorlink() . '</li>';
$postfooter .= '<li><svg class="icon-calendar"><use xlink:href="' . get_stylesheet_directory_uri() . '/icons/icons.svg#icon-calendar"></use></svg>' . thematic_postmeta_entrydate() . '</li>';
$postfooter .= '<li><svg class="icon-comment"><use xlink:href="' . get_stylesheet_directory_uri() . '/icons/icons.svg#icon-comment"></use></svg>' . thematic_postfooter_postcomments() . '</li>';
$postfooter .= '</ul>';
$postfooter .= '<ul class="sub-utilities">';
$postfooter .= '<li><svg class="icon-folder"><use xlink:href="' . get_stylesheet_directory_uri() . '/icons/icons.svg#icon-folder"></use></svg>' . thematic_postfooter_postcategory() . '</li>';
if ( $tagsection ) {
$postfooter .= '<li><svg class="icon-tag"><use xlink:href="' . get_stylesheet_directory_uri() . '/icons/icons.svg#icon-tag"></use></svg>' . thematic_postfooter_posttags() . '</li>';
}
if ( is_user_logged_in() ) {
$postfooter .= '<li><svg class="icon-pencil"><use xlink:href="' . get_stylesheet_directory_uri() . '/icons/icons.svg#icon-pencil"></use></svg>' . thematic_postfooter_posteditlink() . '</li>';
}
$postfooter .= '</ul>';
$postfooter .= "</footer><!-- .entry-utility -->\n";
}
// Put it on the screen
echo apply_filters( 'thematic_postfooter', $postfooter ); // Filter to override default post footer
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment