Skip to content

Instantly share code, notes, and snippets.

@ziemekpr0
Created April 14, 2018 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ziemekpr0/62300e23a217333291fe93abd62f96d2 to your computer and use it in GitHub Desktop.
Save ziemekpr0/62300e23a217333291fe93abd62f96d2 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Autor wpisu
Description: Dodaje informację o autorze na końcu każdego wpisu
Author: ziemekpr0@gmail.com
Author URI: https://wpadmin.pl
*/
function wpa_post_author($content) {
$author = '<style>.wpa-post-author-info{clear:both;}.wpa-post-author-info img{float:left;margin-right:15px;}.wpa-post-author-info h5{margin-bottom:10px;}</style>';
$author .= '<div class="wpa-post-author-info">';
$author .= '<h5>O autorze</h5>';
$author .= get_avatar( get_the_author_meta('user_email'), 80 );
$author .= wpautop( '<strong>'. get_the_author_meta('display_name') .'</strong> - '. get_the_author_meta('description') );
$author .= '</div><!-- /.wpa-post-author-info -->';
return $content.$author;
}
add_filter( 'the_content', 'wpa_post_author' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment