template-functions.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Functions which enhance the theme by hooking into WordPress
  4. *
  5. * @package photos
  6. */
  7. /**
  8. * Adds custom classes to the array of body classes.
  9. *
  10. * @param array $classes Classes for the body element.
  11. * @return array
  12. */
  13. function photos_body_classes( $classes ) {
  14. // Adds a class of hfeed to non-singular pages.
  15. if ( ! is_singular() ) {
  16. $classes[] = 'hfeed';
  17. }
  18. return $classes;
  19. }
  20. add_filter( 'body_class', 'photos_body_classes' );
  21. /**
  22. * Add a pingback url auto-discovery header for single posts, pages, or attachments.
  23. */
  24. function photos_pingback_header() {
  25. if ( is_singular() && pings_open() ) {
  26. echo '<link rel="pingback" href="', esc_url( get_bloginfo( 'pingback_url' ) ), '">';
  27. }
  28. }
  29. add_action( 'wp_head', 'photos_pingback_header' );
  30. /**
  31. * Filtering the comment reply link arguments so we can add an svg icon
  32. */
  33. function photos_comment_reply_link_args( $args, $comment, $post ) {
  34. $args['reply_text'] = photos_get_svg( array( 'icon' => 'reply' ) ) . ' ' . $args['reply_text'];
  35. return $args;
  36. }
  37. add_filter( 'comment_reply_link_args', 'photos_comment_reply_link_args', 10, 3 );