Advertisement
RoseCitySister

Theme Functions File

Sep 10th, 2014
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.18 KB | None | 0 0
  1. <?php
  2. add_action( 'after_setup_theme', 'coronado_setup' );
  3. function coronado_setup()
  4. {
  5. load_theme_textdomain( 'coronado', get_template_directory() . '/languages' );
  6. add_theme_support( 'automatic-feed-links' );
  7. add_theme_support( 'post-thumbnails' );
  8.  
  9.  
  10. $args = array(
  11. 'width' => 710,
  12. 'height' => 225,
  13. 'default-image' => get_template_directory_uri() . '/images/coronado.jpg',
  14. 'uploads' => true,
  15. );
  16. add_theme_support( 'custom-header', $args );
  17.  
  18. $defaults = array(
  19. 'default-color' => '',
  20. 'default-image' => '',
  21. 'default-repeat' => '',
  22. 'default-position-x' => '',
  23. 'wp-head-callback' => '_custom_background_cb',
  24. 'admin-head-callback' => '',
  25. 'admin-preview-callback' => ''
  26. );
  27. add_theme_support( 'custom-background', $defaults );
  28. $wp_customize->add_section( 'coronado_footer' , array(
  29. 'title' => __('Custom Footer','coronado'),
  30. 'width' => 710,
  31. 'height' => 55,
  32. 'default-image' => get_template_directory_uri() . '/images/coronado-bottom.jpg',
  33. 'uploads' => true,
  34. 'transport' => 'postMessage'
  35. ) );
  36.  
  37.  
  38. $wp_customize->add_setting( 'coronado_footer', array(
  39. 'default' => '',
  40. 'type' => 'theme_mod',
  41. 'capability' => 'edit_theme_options',
  42. ) );
  43.  
  44. $wp_customize->add_control( WP_Customize_Image_Control( $wp_customize,
  45. array(
  46. 'label' => __( 'Custom Footer', 'coronado' ),
  47. 'section' => 'coronado_footer',
  48. 'settings' => 'coronado_theme_options[coronado_footer]',
  49. ) ) );
  50.  
  51. add_action( 'customize_register', 'coronado_customize_register' );
  52. function coronado_customize_register($wp_customize) {
  53. $wp_customize->add_section( 'coronado_footer_image', array(
  54. 'title' => __('Custom Footer','coronado'),
  55. 'width' => 710,
  56. 'height' => 55,
  57. 'default-image' => get_template_directory_uri() . '/images/coronado-bottom.jpg',
  58. 'uploads' => true,
  59. 'priority' => 35,
  60. ) );
  61. if ( $wp_customize->is_preview() && ! is_admin() )
  62. add_action( 'wp_footer', 'coronado_customize_preview', 21);
  63. function themename_customize_preview() {
  64. ?>
  65. <script type="text/javascript">
  66. ( function( $ ){
  67. wp.customize('setting_name',function( value ) {
  68. value.bind(function(to) {
  69. $('#footer-pic').css('background-image', to ? to : '' );
  70. });
  71. });
  72. } )( jQuery )
  73. </script>
  74. global $content_width;
  75. if ( ! isset( $content_width ) ) $content_width = 640;
  76. register_nav_menus(
  77. array( 'main-menu' => __( 'Main Menu', 'coronado' ) )
  78. );
  79. }
  80. function greenapples_add_editor_styles() {
  81. add_editor_style( 'custom-editor-style.css' );
  82. }
  83. add_action( 'wp_enqueue_scripts', 'coronado_load_scripts' );
  84. function coronado_load_scripts()
  85. {
  86. wp_enqueue_script( 'jquery' );
  87. }
  88. add_action( 'comment_form_before', 'coronado_enqueue_comment_reply_script' );
  89. function coronado_enqueue_comment_reply_script()
  90. {
  91. if ( get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); }
  92. }
  93. add_filter( 'the_title', 'coronado_title' );
  94. function coronado_title( $title ) {
  95. if ( $title == '' ) {
  96. return '&rarr;';
  97. } else {
  98. return $title;
  99. }
  100. }
  101. add_filter( 'wp_title', 'coronado_filter_wp_title' );
  102. function coronado_filter_wp_title( $title )
  103. {
  104. return $title . esc_attr( get_bloginfo( 'name' ) );
  105. }
  106. add_action( 'widgets_init', 'coronado_widgets_init' );
  107. function coronado_widgets_init()
  108. {
  109. register_sidebar( array (
  110. 'name' => __( 'Sidebar Widget Area', 'coronado' ),
  111. 'id' => 'primary-widget-area',
  112. 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  113. 'after_widget' => "</li>",
  114. 'before_title' => '<h3 class="widget-title">',
  115. 'after_title' => '</h3>',
  116. ) );
  117. }
  118. function coronado_custom_pings( $comment )
  119. {
  120. $GLOBALS['comment'] = $comment;
  121. ?>
  122. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"><?php echo comment_author_link(); ?></li>
  123. <?php
  124. }
  125. add_filter( 'get_comments_number', 'coronado_comments_number' );
  126. function coronado_comments_number( $count )
  127. {
  128. if ( !is_admin() ) {
  129. global $id;
  130. $comments_by_type = &separate_comments( get_comments( 'status=approve&post_id=' . $id ) );
  131. return count( $comments_by_type['comment'] );
  132. } else {
  133. return $count;
  134. }
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement