Skip to content

Instantly share code, notes, and snippets.

@ziemekpr0
Created April 14, 2018 19:03
Show Gist options
  • Save ziemekpr0/3df5d322949d33d96205f185f2bae10f to your computer and use it in GitHub Desktop.
Save ziemekpr0/3df5d322949d33d96205f185f2bae10f to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Shortcode - autor wpisu
Description: Dodaje informację o autorze. Użycie: [wpa_post_author]
Author: ziemekpr0@gmail.com
Author URI: https://wpadmin.pl
*/
function wpa_post_author() {
$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 $author;
}
add_shortcode('wpa_post_author', 'wpa_post_author');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment