Advertisement
Guest User

NewTek Functions 1.4.1

a guest
Jan 9th, 2014
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. if ( ! isset( $content_width ) ) $content_width = 600;
  4.  
  5. function newtek_wp_title( $title ) {
  6. global $page, $paged;
  7.  
  8. if ( is_feed() )
  9. return $title;
  10.  
  11. $site_description = get_bloginfo( 'description' );
  12.  
  13. $filtered_title = $title . get_bloginfo( 'name' );
  14. $filtered_title .= ( ! empty( $site_description ) && ( is_home() || is_front_page() ) ) ? ' | ' . $site_description: '';
  15. $filtered_title .= ( 2 <= $paged || 2 <= $page ) ? ' | ' . sprintf( __( 'Page %s', 'newtek' ), max( $paged, $page ) ) : '';
  16.  
  17. return $filtered_title;
  18. }
  19. add_filter( 'wp_title', 'newtek_wp_title' );
  20.  
  21. function newtek_widgets_init() {
  22.  
  23. register_sidebar( array(
  24. 'name' => 'Home right sidebar',
  25. 'id' => 'home_right_1',
  26. 'before_widget' => '',
  27. 'after_widget' => '<br />',
  28. 'before_title' => '<h5 class="sidebarhd">',
  29. 'after_title' => '</h5>',
  30. ) );
  31.  
  32. register_sidebar( array(
  33. 'name' => 'Footer Sidebar 1',
  34. 'id' => 'footer-sidebar-1',
  35. 'description' => 'Appears in the footer area',
  36. 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
  37. 'after_widget' => '</aside>',
  38. 'before_title' => '<h3 class="sidebarhd2">',
  39. 'after_title' => '</h3>',
  40. ) );
  41. register_sidebar( array(
  42. 'name' => 'Footer Sidebar 2',
  43. 'id' => 'footer-sidebar-2',
  44. 'description' => 'Appears in the footer area',
  45. 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
  46. 'after_widget' => '</aside>',
  47. 'before_title' => '<h3 class="sidebarhd2">',
  48. 'after_title' => '</h3>',
  49. ) );
  50. register_sidebar( array(
  51. 'name' => 'Footer Sidebar 3',
  52. 'id' => 'footer-sidebar-3',
  53. 'description' => 'Appears in the footer area',
  54. 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
  55. 'after_widget' => '</aside>',
  56. 'before_title' => '<h3 class="sidebarhd2">',
  57. 'after_title' => '</h3>',
  58. ) );
  59.  
  60. }
  61. add_action( 'widgets_init', 'newtek_widgets_init' );
  62.  
  63.  
  64. function newtek_scripts_styles() {
  65.  
  66. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
  67. wp_enqueue_script( 'comment-reply' );
  68.  
  69. wp_enqueue_style( 'newtek-style', get_stylesheet_uri(), array() );
  70.  
  71. }
  72.  
  73. add_action( 'wp_enqueue_scripts', 'newtek_scripts_styles' );
  74.  
  75.  
  76. // Register Theme Features
  77. function newtek_setup() {
  78.  
  79. // Add theme support for Semantic Markup
  80. $markup = array( 'search-form', 'comment-form', 'comment-list', );
  81. add_theme_support( 'html5', $markup );
  82.  
  83. add_theme_support( 'automatic-feed-links' );
  84.  
  85. add_theme_support( 'custom-background' );
  86.  
  87. $defaults = array(
  88. 'default-color' => '',
  89. 'default-image' => '',
  90. 'wp-head-callback' => '_custom_background_cb',
  91. 'admin-head-callback' => '',
  92. 'admin-preview-callback' => ''
  93. );
  94. add_theme_support( 'custom-background', $defaults );
  95.  
  96. add_theme_support( 'post-thumbnails' );
  97. set_post_thumbnail_size( 640, 360, true );
  98. add_image_size( 'category-thumb', 640, 360, true );
  99.  
  100. register_nav_menu( 'header-menu',__( 'Header Menu', 'newtek' ) );
  101.  
  102. add_editor_style( 'style.css' );
  103.  
  104. }
  105.  
  106. // Hook into the 'after_setup_theme' action
  107. add_action( 'after_setup_theme', 'newtek_setup' );
  108.  
  109.  
  110. function newtek_theme_customizer( $wp_customize ) {
  111.  
  112. $wp_customize->add_section( 'newtek_logo_section' , array(
  113. 'title' => __( 'Logo', 'newtek' ),
  114. 'priority' => 30,
  115. 'description' => 'Upload a logo to replace the default site name. Suggested dimensions 300 width x 50 height.',
  116. ) );
  117.  
  118. $wp_customize->add_setting( 'newtek_logo' );
  119.  
  120. $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'newtek_logo', array(
  121. 'label' => __( 'Logo', 'newtek' ),
  122. 'section' => 'newtek_logo_section',
  123. 'settings' => 'newtek_logo',
  124. ) ) );
  125.  
  126. }
  127. add_action('customize_register', 'newtek_theme_customizer');
  128.  
  129. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement