Guest User

Untitled

a guest
Sep 10th, 2014
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.58 KB | None | 0 0
  1. <?php
  2. add_action( 'after_setup_theme', 'coronado_setup' );
  3. function coronado_setup( $wp_customize )
  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. }
  29. add_action( 'customize_register', 'coronado_customize_register' );
  30. function coronado_customize_register($wp_customize) {
  31. $wp_customize->add_section( 'coronado_footer_image', array(
  32.     'title'      => __('Custom Footer','coronado'),
  33.     'width'         => 710,
  34.         'height'        => 55,
  35.         'default-image' => get_template_directory_uri() . '/images/coronado-bottom.jpg',
  36.         'uploads'       => true,
  37.     'priority'       => 35,
  38. ) );
  39. if ( $wp_customize->is_preview() && ! is_admin() )
  40.     add_action( 'wp_footer', 'coronado_customize_preview', 21);
  41.     }
  42. function themename_customize_preview() {
  43.     ?>
  44.     <script type="text/javascript">
  45.     ( function( $ ){
  46.     wp.customize('setting_name',function( value ) {
  47.         value.bind(function(to) {
  48.             $('#footer-pic').css('background-image', to ? to : '' );
  49.         });
  50.     });
  51.     } )( jQuery )
  52.     </script>
  53. <?php
  54. global $content_width;
  55. if ( ! isset( $content_width ) ) $content_width = 640;
  56. register_nav_menus(
  57. array( 'main-menu' => __( 'Main Menu', 'coronado' ) )
  58. );
  59. }
  60. function greenapples_add_editor_styles() {
  61.     add_editor_style( 'custom-editor-style.css' );
  62. }
  63. add_action( 'wp_enqueue_scripts', 'coronado_load_scripts' );
  64. function coronado_load_scripts()
  65. {
  66. wp_enqueue_script( 'jquery' );
  67. }
  68. add_action( 'comment_form_before', 'coronado_enqueue_comment_reply_script' );
  69. function coronado_enqueue_comment_reply_script()
  70. {
  71. if ( get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); }
  72. }
  73. add_filter( 'the_title', 'coronado_title' );
  74. function coronado_title( $title ) {
  75. if ( $title == '' ) {
  76. return '&rarr;';
  77. } else {
  78. return $title;
  79. }
  80. }
  81. add_filter( 'wp_title', 'coronado_filter_wp_title' );
  82. function coronado_filter_wp_title( $title )
  83. {
  84. return $title . esc_attr( get_bloginfo( 'name' ) );
  85. }
  86. add_action( 'widgets_init', 'coronado_widgets_init' );
  87. function coronado_widgets_init()
  88. {
  89. register_sidebar( array (
  90. 'name' => __( 'Sidebar Widget Area', 'coronado' ),
  91. 'id' => 'primary-widget-area',
  92. 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
  93. 'after_widget' => "</li>",
  94. 'before_title' => '<h3 class="widget-title">',
  95. 'after_title' => '</h3>',
  96. ) );
  97. }
  98. function coronado_custom_pings( $comment )
  99. {
  100. $GLOBALS['comment'] = $comment;
  101. ?>
  102. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"><?php echo comment_author_link(); ?></li>
  103. <?php
  104. }
  105. add_filter( 'get_comments_number', 'coronado_comments_number' );
  106. function coronado_comments_number( $count )
  107. {
  108. if ( !is_admin() ) {
  109. global $id;
  110. $comments_by_type = &separate_comments( get_comments( 'status=approve&post_id=' . $id ) );
  111. return count( $comments_by_type['comment'] );
  112. } else {
  113. return $count;
  114. }
  115. }
Advertisement
Add Comment
Please, Sign In to add comment