Brak opisu

template-functions.php 907B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Functions which enhance the theme by hooking into WordPress
  4. *
  5. * @package XShop
  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 xshop_body_classes( $classes ) {
  14. // Adds a class of hfeed to non-singular pages.
  15. if ( ! is_singular() ) {
  16. $classes[] = 'hfeed';
  17. }
  18. // Adds a class of no-sidebar when there is no sidebar present.
  19. if ( ! is_active_sidebar( 'sidebar-1' ) ) {
  20. $classes[] = 'no-sidebar';
  21. }
  22. return $classes;
  23. }
  24. add_filter( 'body_class', 'xshop_body_classes' );
  25. /**
  26. * Add a pingback url auto-discovery header for single posts, pages, or attachments.
  27. */
  28. function xshop_pingback_header() {
  29. if ( is_singular() && pings_open() ) {
  30. printf( '<link rel="pingback" href="%s">', esc_url( get_bloginfo( 'pingback_url' ) ) );
  31. }
  32. }
  33. add_action( 'wp_head', 'xshop_pingback_header' );