Guest User

Funkcje motywu

a guest
Sep 13th, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.87 KB | None | 0 0
  1. <?php
  2. define('THEME_NAME',"PiBR_ver1_3");
  3. global $wp_version;
  4. define('WP_VERSION', $wp_version);
  5. define('THEME_NS', 'twentyten');
  6. define('THEME_LANGS_FOLDER','/languages');
  7. if (class_exists('xili_language')) {
  8. define('THEME_TEXTDOMAIN',THEME_NS);
  9. } else {
  10. load_theme_textdomain(THEME_NS, TEMPLATEPATH . THEME_LANGS_FOLDER);
  11. }
  12. mb_internal_encoding(get_bloginfo('charset'));
  13. mb_regex_encoding(get_bloginfo('charset'));
  14. if (WP_VERSION < 3.0){
  15. require_once(TEMPLATEPATH . '/library/legacy.php');
  16. }
  17.  
  18. theme_include_lib('defaults.php');
  19. theme_include_lib('misc.php');
  20. theme_include_lib('wrappers.php');
  21. theme_include_lib('sidebars.php');
  22. theme_include_lib('navigation.php');
  23. theme_include_lib('shortcodes.php');
  24. if (WP_VERSION >= 3.0) {
  25. theme_include_lib('widgets.php');
  26. }
  27.  
  28. if (!function_exists('theme_favicon')) {
  29. function theme_favicon() {
  30. if (is_file(TEMPLATEPATH .'/favicon.ico')):?>
  31. <link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/favicon.ico" />
  32. <?php endif;
  33. }
  34. }
  35. add_action('wp_head', 'theme_favicon');
  36. add_action('admin_head', 'theme_favicon');
  37. add_action('login_head', 'theme_favicon');
  38.  
  39. if ( function_exists( 'add_theme_support' ) ) {
  40. add_theme_support( 'post-thumbnails' );
  41. add_theme_support( 'nav-menus' );
  42. add_theme_support( 'automatic-feed-links' );
  43. add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
  44. }
  45. if (function_exists('register_nav_menus')) {
  46. register_nav_menus(array('primary-menu' => __( 'Primary Navigation', THEME_NS)));
  47. }
  48.  
  49.  
  50. if(is_admin()){
  51. theme_include_lib('options.php');
  52. theme_include_lib('admins.php');
  53. function theme_add_option_page() {
  54. add_theme_page(__('Theme Options', THEME_NS), __('Theme Options', THEME_NS), 'edit_themes', basename(__FILE__), 'theme_print_options');
  55. }
  56. add_action('admin_menu', 'theme_add_option_page');
  57. if (WP_VERSION >= 3.0) {
  58. add_action('sidebar_admin_setup', 'theme_widget_process_control');
  59. add_action('add_meta_boxes', 'theme_add_meta_boxes');
  60. add_action('save_post', 'theme_save_post');
  61. }
  62. return;
  63. }
  64.  
  65.  
  66. function theme_get_option($name){
  67. global $theme_default_options;
  68. $result = get_option($name);
  69. if ($result === false) {
  70. $result = theme_get_array_value($theme_default_options, $name);
  71. }
  72. return $result;
  73. }
  74.  
  75.  
  76.  
  77. function theme_get_meta_option($id, $name){
  78. global $theme_default_meta_options;
  79. return theme_get_array_value(get_option($name), $id, theme_get_array_value($theme_default_meta_options, $name));
  80. }
  81.  
  82.  
  83.  
  84. function theme_set_meta_option($id, $name, $value){
  85. $meta_option = get_option($name);
  86. if (!$meta_option || !is_array($meta_option)) {
  87. $meta_option = array();
  88. }
  89. $meta_option[$id] = $value;
  90. update_option($name, $meta_option);
  91. }
  92.  
  93.  
  94.  
  95. function theme_get_post_id(){
  96. $post_id = get_the_ID();
  97. if($post_id != ''){
  98. $post_id = 'post-' . $post_id;
  99. }
  100. return $post_id;
  101. }
  102.  
  103.  
  104.  
  105. function theme_get_post_class(){
  106. if (!function_exists('get_post_class')) return '';
  107. return implode(' ', get_post_class());
  108. }
  109.  
  110.  
  111. function theme_include_lib($name){
  112. if (function_exists('locate_template')){
  113. locate_template(array('library/'.$name), true);
  114. } else {
  115. theme_locate_template(array('library/'.$name), true);
  116. }
  117. }
  118.  
  119.  
  120. if (!function_exists('theme_get_meta_icon')){
  121. function theme_get_meta_icon($icon, $width, $height){
  122. return '<img src="'.get_bloginfo('template_url').'/images/'.$icon.'.png" width="'.$width.'" height="'.$height.'" alt="" />';
  123. }
  124. }
  125.  
  126. if (!function_exists('theme_get_metadata_icons')){
  127. function theme_get_metadata_icons($icons = '', $class=''){
  128. global $post;
  129. if (!is_string($icons) || mb_strlen($icons) == 0) return;
  130. $icons = explode(",", str_replace(' ', '', $icons));
  131. if (!is_array($icons) || count($icons) == 0) return;
  132. $result = array();
  133. for($i = 0; $i < count($icons); $i++){
  134. $icon = $icons[$i];
  135. switch($icon){
  136. case 'date':
  137. $result[] = theme_get_meta_icon('postdateicon', 16, 16) . sprintf( __('<span class="%1$s">Published</span> %2$s', THEME_NS),
  138. 'date',
  139. sprintf( '<span class="entry-date" title="%1$s">%2$s</span>',
  140. esc_attr( get_the_time() ),
  141. get_the_date()
  142. )
  143. );
  144. break;
  145. case 'author':
  146. $result[] = theme_get_meta_icon('postauthoricon', 14, 14) . sprintf(__('<span class="%1$s">By</span> %2$s', THEME_NS),
  147. 'author',
  148. sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
  149. get_author_posts_url( get_the_author_meta( 'ID' ) ),
  150. sprintf( esc_attr(__( 'View all posts by %s', THEME_NS )), get_the_author() ),
  151. get_the_author()
  152. )
  153. );
  154. break;
  155. case 'category':
  156. $categories = get_the_category_list(', ');
  157. if(mb_strlen($categories) == 0) break;
  158. $result[] = theme_get_meta_icon('postcategoryicon', 18, 18) . sprintf(__('<span class="%1$s">Posted in</span> %2$s', THEME_NS), 'categories', get_the_category_list(', '));
  159. break;
  160. case 'tag':
  161. $tags_list = get_the_tag_list( '', ', ' );
  162. if(!$tags_list) break;
  163. $result[] = theme_get_meta_icon('posttagicon', 18, 18) . sprintf( __( '<span class="%1$s">Tagged</span> %2$s', THEME_NS ), 'tags', $tags_list );
  164. break;
  165. case 'comments':
  166. if(!comments_open()) break;
  167. ob_start();
  168. comments_popup_link( __( 'Leave a comment', THEME_NS ), __( '1 Comment', THEME_NS ), __( '% Comments', THEME_NS ) );
  169. $result[] = theme_get_meta_icon('postcommentsicon', 18, 18) . ob_get_clean();
  170. break;
  171. case 'edit':
  172. if (!current_user_can('edit_post', $post->ID)) break;
  173. ob_start();
  174. edit_post_link(__('Edit', THEME_NS), '');
  175. $result[] = theme_get_meta_icon('postediticon', 14, 14) . ob_get_clean();
  176. break;
  177. }
  178. }
  179. $result = implode(theme_get_option('theme_metadata_separator'), $result);
  180. if (theme_is_empty_html($result)) return;
  181. return "<div class=\"art-post{$class}icons art-metadata-icons\">{$result}</div>";
  182. }
  183. }
  184.  
  185. if (!function_exists('theme_get_post_thumbnail')){
  186. function theme_get_post_thumbnail($args = array()){
  187. global $post;
  188.  
  189. $size = theme_get_array_value($args, 'size', array(theme_get_option('theme_metadata_thumbnail_width'), theme_get_option('theme_metadata_thumbnail_height')));
  190. $auto = theme_get_array_value($args, 'auto', theme_get_option('theme_metadata_thumbnail_auto'));
  191. $featured = theme_get_array_value($args, 'featured', theme_get_option('theme_metadata_use_featured_image_as_thumbnail'));
  192. $title = theme_get_array_value($args, 'title', get_the_title());
  193.  
  194.  
  195. $result = '';
  196.  
  197. if ($featured && (function_exists('has_post_thumbnail')) && (has_post_thumbnail())) {
  198. ob_start();
  199. the_post_thumbnail($size, array('alt' => '', 'title' => $title));
  200. $result = ob_get_clean();
  201. } elseif ($auto) {
  202. $attachments = get_children(array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID'));
  203. if($attachments) {
  204. $attachment = array_shift($attachments);
  205. $img = wp_get_attachment_image_src($attachment->ID, $size);
  206. if (isset($img[0])) {
  207. $result = '<img src="'.$img[0].'" alt="" width="'.$img[1].'" height="'.$img[2].'" title="'.$title.'" class="wp-post-image" />';
  208. }
  209. }
  210. }
  211. if($result !== ''){
  212. $result = '<div class="avatar alignleft"><a href="'.get_permalink($post->ID).'" title="'.$title.'">'.$result.'</a></div>';
  213. }
  214. return $result;
  215. }
  216. }
  217.  
  218. if (!function_exists('theme_get_content')){
  219. function theme_get_content($args = array()) {
  220. $more_tag = theme_get_array_value($args, 'more_tag', __('Continue reading <span class="meta-nav">&rarr;</span>', THEME_NS));
  221. $content = get_the_content($more_tag);
  222. // hack for badly written plugins
  223. ob_start();echo apply_filters('the_content', $content);$content = ob_get_clean();
  224. return $content . wp_link_pages(array(
  225. 'before' => '<p><span class="page-navi-outer page-navi-caption"><span class="page-navi-inner">' . __('Pages', THEME_NS) . ': </span></span>',
  226. 'after' => '</p>',
  227. 'link_before' => '<span class="page-navi-outer"><span class="page-navi-inner">',
  228. 'link_after' => '</span></span>',
  229. 'echo' => 0
  230. ));
  231. }
  232. }
  233.  
  234. if (!function_exists('theme_get_excerpt')){
  235. function theme_get_excerpt($args = array()) {
  236. global $post;
  237. $more_tag = theme_get_array_value($args, 'more_tag', __('Continue reading <span class="meta-nav">&rarr;</span>', THEME_NS));
  238. $auto = theme_get_array_value($args, 'auto', theme_get_option('theme_metadata_excerpt_auto'));
  239. $all_words = theme_get_array_value($args, 'all_words', theme_get_option('theme_metadata_excerpt_words'));
  240. $min_remainder = theme_get_array_value($args, 'min_remainder', theme_get_option('theme_metadata_excerpt_min_remainder'));
  241. $allowed_tags = theme_get_array_value($args, 'allowed_tags',
  242. (theme_get_option('theme_metadata_excerpt_use_tag_filter')
  243. ? explode(',',str_replace(' ', '', theme_get_option('theme_metadata_excerpt_allowed_tags')))
  244. : null));
  245. $perma_link = get_permalink($post->ID);
  246. $more_token = '%%theme_more%%';
  247. $show_more_tag = false;
  248. $tag_disbalance = false;
  249. if (function_exists('post_password_required') && post_password_required($post)){
  250. return get_the_excerpt();
  251. }
  252. if ($auto && has_excerpt($post->ID)) {
  253. $excerpt = get_the_excerpt();
  254. $show_more_tag = mb_strlen($post->post_content) > 0;
  255. } else {
  256. $excerpt = get_the_content($more_token);
  257. // hack for badly written plugins
  258. ob_start();echo apply_filters('get_the_excerpt', $excerpt);$excerpt = ob_get_clean();
  259. ob_start();echo apply_filters('the_excerpt', $excerpt);$excerpt = ob_get_clean();
  260. if(theme_is_empty_html($excerpt)) return $excerpt;
  261. if ($allowed_tags !== null) {
  262. $allowed_tags = '<' .implode('><',$allowed_tags).'>';
  263. $excerpt = strip_tags($excerpt, $allowed_tags);
  264. }
  265. $excerpt = strip_shortcodes($excerpt);
  266. if (strpos($excerpt, $more_token) !== false) {
  267. $excerpt = str_replace($more_token, $more_tag, $excerpt);
  268. } elseif($auto && is_numeric($all_words)) {
  269. $token = "%theme_tag_token%";
  270. $content_parts = explode($token, str_replace(array('<', '>'), array($token.'<', '>'.$token), $excerpt));
  271. $content = array();
  272. $word_count = 0;
  273. foreach($content_parts as $part)
  274. {
  275. if (strpos($part, '<') !== false || strpos($part, '>') !== false){
  276. $content[] = array('type'=>'tag', 'content'=>$part);
  277. } else {
  278. $all_chunks = preg_split('/([\s])/u', $part, -1, PREG_SPLIT_DELIM_CAPTURE);
  279. foreach($all_chunks as $chunk) {
  280. if('' != trim($chunk)) {
  281. $content[] = array('type'=>'word', 'content'=>$chunk);
  282. $word_count += 1;
  283. } elseif($chunk != '') {
  284. $content[] = array('type'=>'space', 'content'=>$chunk);
  285. }
  286. }
  287. }
  288. }
  289.  
  290. if(($all_words < $word_count) && ($all_words + $min_remainder) <= $word_count) {
  291. $show_more_tag = true;
  292. $tag_disbalance = true;
  293. $current_count = 0;
  294. $excerpt = '';
  295. foreach($content as $node) {
  296. if($node['type'] == 'word') {
  297. $current_count++;
  298. }
  299. $excerpt .= $node['content'];
  300. if ($current_count == $all_words){
  301. break;
  302. }
  303. }
  304. $excerpt .= '&hellip;'; // ...
  305. }
  306. }
  307. }
  308. if ($show_more_tag) {
  309. $excerpt = $excerpt.' <a class="more-link" href="'.$perma_link.'">'.$more_tag.'</a>';
  310. }
  311. if ($tag_disbalance) {
  312. $excerpt = force_balance_tags($excerpt);
  313. }
  314. return $excerpt;
  315. }
  316. }
  317.  
  318. if (!function_exists('theme_get_search')){
  319. function theme_get_search(){
  320. ob_start();
  321. get_search_form();
  322. return ob_get_clean();
  323. }
  324. }
  325.  
  326.  
  327. function theme_is_home(){
  328. return (is_home() && !is_paged());
  329. }
  330.  
  331.  
  332. if (!function_exists('theme_404_content')){
  333. function theme_404_content() {
  334. $error_message = __( 'Apologies, but the page you requested could not be found. Perhaps searching will help.', THEME_NS);
  335. theme_post_wrapper(
  336. array(
  337. 'title' => __('Not Found', THEME_NS),
  338. 'content' => '<p class="center">'
  339. . $error_message
  340. . '</p>' . "\n" . theme_get_search()
  341. )
  342. );
  343. if (theme_get_option('theme_show_random_posts_on_404_page')){
  344. ob_start();
  345. echo '<h4 class="box-title">' . theme_get_option('theme_show_random_posts_title_on_404_page') . '</h4>'; ?>
  346. <ul>
  347. <?php
  348. global $post;
  349. $rand_posts = get_posts('numberposts=5&orderby=rand');
  350. foreach( $rand_posts as $post ) :
  351. ?>
  352. <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
  353. <?php endforeach; ?>
  354. </ul>
  355. <?php theme_post_wrapper(array('content' => ob_get_clean()));
  356. }
  357. if (theme_get_option('theme_show_tags_on_404_page')){
  358. ob_start();
  359. echo '<h4 class="box-title">' . theme_get_option('theme_show_tags_title_on_404_page') . '</h4>';
  360. wp_tag_cloud('smallest=9&largest=22&unit=pt&number=200&format=flat&orderby=name&order=ASC');
  361. theme_post_wrapper(array('content' => ob_get_clean()));
  362. }
  363. }
  364. }
  365.  
  366. if (!function_exists('theme_page_navigation')){
  367. function theme_page_navigation($args = '') {
  368. $args = wp_parse_args($args, array('wrap' => true, 'prev_link' => false, 'next_link' => false));
  369. $prev_link = $args['prev_link'];
  370. $next_link = $args['next_link'];
  371. $wrap = $args['wrap'];
  372. if (!$prev_link && !$next_link) {
  373. if (function_exists('wp_page_numbers')) { // http://wordpress.org/extend/plugins/wp-page-numbers/
  374. ob_start();
  375. wp_page_numbers();
  376. theme_post_wrapper(array('content' => ob_get_clean()));
  377. return;
  378. }
  379. if (function_exists('wp_pagenavi')) { // http://wordpress.org/extend/plugins/wp-pagenavi/
  380. ob_start();
  381. wp_pagenavi();
  382. theme_post_wrapper(array('content' => ob_get_clean()));
  383. return;
  384. }
  385. //posts
  386. $prev_link = get_previous_posts_link(__('Newer posts <span class="meta-nav">&rarr;</span>', THEME_NS));
  387. $next_link = get_next_posts_link(__('<span class="meta-nav">&larr;</span> Older posts', THEME_NS));
  388. }
  389. $content = '';
  390. if ($prev_link || $next_link) {
  391.  
  392. $content = <<<EOL
  393. <div class="navigation">
  394. <div class="alignleft">{$next_link}</div>
  395. <div class="alignright">{$prev_link}</div>
  396. </div>
  397. EOL;
  398. }
  399. if ($wrap) {
  400. theme_post_wrapper(array('content' => $content));
  401. } else {
  402. echo $content;
  403. }
  404. }
  405. }
  406.  
  407. if (!function_exists('theme_get_previous_post_link')){
  408.  
  409. function theme_get_previous_post_link($format='&laquo; %link', $link='%title', $in_same_cat = false, $excluded_categories = '') {
  410. return theme_get_adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, true);
  411. }
  412. }
  413.  
  414. if (!function_exists('theme_get_next_post_link')){
  415. function theme_get_next_post_link($format='%link &raquo;', $link='%title', $in_same_cat = false, $excluded_categories = '') {
  416. return theme_get_adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, false);
  417. }
  418. }
  419.  
  420. if (!function_exists('theme_get_adjacent_image_link')){
  421. function theme_get_adjacent_image_link($prev = true, $size = 'thumbnail', $text = false) {
  422. global $post;
  423. $post = get_post($post);
  424. $attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') ));
  425.  
  426. foreach ( $attachments as $k => $attachment )
  427. if ( $attachment->ID == $post->ID )
  428. break;
  429.  
  430. $k = $prev ? $k - 1 : $k + 1;
  431.  
  432. if ( isset($attachments[$k]) )
  433. return wp_get_attachment_link($attachments[$k]->ID, $size, true, false, $text);
  434. }
  435. }
  436.  
  437. if (!function_exists('theme_get_previous_image_link')){
  438. function theme_get_previous_image_link($size = 'thumbnail', $text = false) {
  439. $result = theme_get_adjacent_image_link(true, $size, $text);
  440. if ($result) $result = '&laquo; ' . $result;
  441. return $result;
  442. }
  443. }
  444.  
  445. if (!function_exists('theme_get_next_image_link')){
  446. function theme_get_next_image_link($size = 'thumbnail', $text = false) {
  447. $result = theme_get_adjacent_image_link(false, $size, $text);
  448. if ($result) $result .= ' &raquo;';
  449. return $result;
  450. }
  451. }
  452.  
  453. if (!function_exists('theme_get_adjacent_post_link')){
  454. function theme_get_adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) {
  455. if ( $previous && is_attachment() )
  456. $post = & get_post($GLOBALS['post']->post_parent);
  457. else
  458. $post = get_adjacent_post($in_same_cat, $excluded_categories, $previous);
  459.  
  460. if ( !$post )
  461. return;
  462.  
  463. $title = $post->post_title;
  464.  
  465. if ( empty($post->post_title) )
  466. $title = $previous ? __('Previous Post', THEME_NS) : __('Next Post', THEME_NS);
  467.  
  468. $title = apply_filters('the_title', $title, $post->ID);
  469. $short_title = $title;
  470. if (theme_get_option('theme_single_navigation_trim_title')) {
  471. $short_title = theme_trim_long_str($title, theme_get_option('theme_single_navigation_trim_len'));
  472. }
  473. $date = mysql2date(get_option('date_format'), $post->post_date);
  474. $rel = $previous ? 'prev' : 'next';
  475.  
  476. $string = '<a href="'.get_permalink($post).'" title="'.esc_attr($title).'" rel="'.$rel.'">';
  477. $link = str_replace('%title', $short_title, $link);
  478. $link = str_replace('%date', $date, $link);
  479. $link = $string . $link . '</a>';
  480.  
  481. $format = str_replace('%link', $link, $format);
  482.  
  483. $adjacent = $previous ? 'previous' : 'next';
  484. return apply_filters( "{$adjacent}_post_link", $format, $link );
  485. }
  486. }
  487.  
  488. if (!function_exists('get_previous_comments_link')) {
  489. function get_previous_comments_link($label)
  490. {
  491. ob_start();
  492. previous_comments_link($label);
  493. return ob_get_clean();
  494. }
  495. }
  496.  
  497. if (!function_exists('get_next_comments_link')) {
  498. function get_next_comments_link($label)
  499. {
  500. ob_start();
  501. next_comments_link($label);
  502. return ob_get_clean();
  503. }
  504. }
  505.  
  506. if (!function_exists('theme_comment')){
  507. function theme_comment( $comment, $args, $depth ) {
  508. $GLOBALS['comment'] = $comment;
  509.  
  510.  
  511. switch ( $comment->comment_type ) :
  512.  
  513. case '' :
  514. ?>
  515. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
  516. <?php ob_start(); ?>
  517. <div class="comment-author vcard">
  518. <?php echo theme_get_avatar(array('id' => $comment, 'size' => 48)); ?>
  519. <?php printf( __( '%s <span class="says">says:</span>', THEME_NS ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
  520. </div>
  521. <?php if ( $comment->comment_approved == '0' ) : ?>
  522. <em><?php _e( 'Your comment is awaiting moderation.', THEME_NS); ?></em>
  523. <br />
  524. <?php endif; ?>
  525.  
  526. <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
  527. <?php
  528. printf( __( '%1$s at %2$s', THEME_NS ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', THEME_NS), ' ' );
  529. ?>
  530. </div>
  531.  
  532. <div class="comment-body"><?php comment_text(); ?></div>
  533.  
  534. <div class="reply">
  535. <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
  536. </div>
  537. <?php theme_post_wrapper(array('content' => ob_get_clean(), 'id' => 'comment-'.get_comment_ID())); ?>
  538.  
  539.  
  540. <?php
  541. break;
  542. case 'pingback' :
  543. case 'trackback' :
  544. ?>
  545. <li class="post pingback">
  546. <?php ob_start(); ?>
  547. <p><?php _e( 'Pingback:', THEME_NS ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __('(Edit)', THEME_NS), ' ' ); ?></p>
  548. <?php theme_post_wrapper(array('content' => ob_get_clean(), 'class' => $comment->comment_type));
  549. break;
  550. endswitch;
  551. }
  552. }
  553.  
  554. if (!function_exists('theme_get_avatar')){
  555. function theme_get_avatar($args = ''){
  556. $args = wp_parse_args($args, array('id' => false, 'size' => 96, 'default' => '', 'alt' => false, 'url' => false));
  557. extract($args);
  558. $result = get_avatar($id, $size, $default, $alt);
  559. if ($result) {
  560. if ($url){
  561. $result = '<a href="'.esc_url($url).'">' . $result . '</a>';
  562. }
  563. $result = '<div class="avatar">' . $result . '</div>';
  564. }
  565. return $result;
  566. }
  567. }
  568.  
  569. if (!function_exists('get_post_format')){
  570. function get_post_format(){
  571. return false;
  572. }
  573. }
Advertisement
Add Comment
Please, Sign In to add comment