functions.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. // If this file is called directly, busted!
  3. if ( ! defined( 'ABSPATH' ) ) {
  4. exit;
  5. }
  6. /*----------------------------------------------------------------------------------------------------------
  7. Adding the author box to the end of your single post
  8. -----------------------------------------------------------------------------------------------------------*/
  9. if ( ! function_exists( 'wpsabox_author_box' ) ) {
  10. function wpsabox_author_box( $saboxmeta = null ) {
  11. $show = ( is_single() || is_author() || is_archive() );
  12. $show = apply_filters( 'sabox_check_if_show', $show );
  13. if ( $show ) {
  14. global $post;
  15. $template = Simple_Author_Box_Helper::get_template();
  16. ob_start();
  17. $sabox_options = Simple_Author_Box_Helper::get_option( 'saboxplugin_options' );
  18. $sabox_author_id = $post->post_author;
  19. $show_post_author_box = apply_filters( 'sabox_check_if_show_post_author_box', true, $sabox_options );
  20. do_action( 'sabox_before_author_box', $sabox_options );
  21. if ( $show_post_author_box ) {
  22. include( $template );
  23. }
  24. do_action( 'sabox_after_author_box', $sabox_options );
  25. $sabox = ob_get_clean();
  26. $return = $saboxmeta . $sabox;
  27. // Filter returning HTML of the Author Box
  28. $saboxmeta = apply_filters( 'sabox_return_html', $return, $sabox, $saboxmeta );
  29. }
  30. return $saboxmeta;
  31. }
  32. }