Advertisement
Guest User

NewTek Functions 1.4.3

a guest
Jan 9th, 2014
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.91 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.  
  5. if ( ! isset( $content_width ) ) $content_width = 600;
  6.  
  7.  
  8.  
  9. function newtek_wp_title( $title ) {
  10.  
  11. global $page, $paged;
  12.  
  13.  
  14.  
  15. if ( is_feed() )
  16.  
  17. return $title;
  18.  
  19.  
  20.  
  21. $site_description = get_bloginfo( 'description' );
  22.  
  23.  
  24.  
  25. $filtered_title = $title . get_bloginfo( 'name' );
  26.  
  27. $filtered_title .= ( ! empty( $site_description ) && ( is_home() || is_front_page() ) ) ? ' | ' . $site_description: '';
  28.  
  29. $filtered_title .= ( 2 <= $paged || 2 <= $page ) ? ' | ' . sprintf( __( 'Page %s', 'newtek' ), max( $paged, $page ) ) : '';
  30.  
  31.  
  32.  
  33. return $filtered_title;
  34.  
  35. }
  36.  
  37. add_filter( 'wp_title', 'newtek_wp_title' );
  38.  
  39.  
  40.  
  41. function newtek_widgets_init() {
  42.  
  43.  
  44.  
  45. register_sidebar( array(
  46.  
  47. 'name' => 'Home right sidebar',
  48.  
  49. 'id' => 'home_right_1',
  50.  
  51. 'before_widget' => '',
  52.  
  53. 'after_widget' => '<br />',
  54.  
  55. 'before_title' => '<h5 class="sidebarhd">',
  56.  
  57. 'after_title' => '</h5>',
  58.  
  59. ) );
  60.  
  61.  
  62.  
  63. register_sidebar( array(
  64.  
  65. 'name' => 'Footer Sidebar 1',
  66.  
  67. 'id' => 'footer-sidebar-1',
  68.  
  69. 'description' => 'Appears in the footer area',
  70.  
  71. 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
  72.  
  73. 'after_widget' => '</aside>',
  74.  
  75. 'before_title' => '<h3 class="sidebarhd2">',
  76.  
  77. 'after_title' => '</h3>',
  78.  
  79. ) );
  80.  
  81. register_sidebar( array(
  82.  
  83. 'name' => 'Footer Sidebar 2',
  84.  
  85. 'id' => 'footer-sidebar-2',
  86.  
  87. 'description' => 'Appears in the footer area',
  88.  
  89. 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
  90.  
  91. 'after_widget' => '</aside>',
  92.  
  93. 'before_title' => '<h3 class="sidebarhd2">',
  94.  
  95. 'after_title' => '</h3>',
  96.  
  97. ) );
  98.  
  99. register_sidebar( array(
  100.  
  101. 'name' => 'Footer Sidebar 3',
  102.  
  103. 'id' => 'footer-sidebar-3',
  104.  
  105. 'description' => 'Appears in the footer area',
  106.  
  107. 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
  108.  
  109. 'after_widget' => '</aside>',
  110.  
  111. 'before_title' => '<h3 class="sidebarhd2">',
  112.  
  113. 'after_title' => '</h3>',
  114.  
  115. ) );
  116.  
  117.  
  118.  
  119. }
  120.  
  121. add_action( 'widgets_init', 'newtek_widgets_init' );
  122.  
  123.  
  124.  
  125.  
  126.  
  127. function newtek_scripts_styles() {
  128.  
  129.  
  130.  
  131. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
  132.  
  133. wp_enqueue_script( 'comment-reply' );
  134.  
  135.  
  136.  
  137. wp_enqueue_style( 'newtek-style', get_stylesheet_uri(), array() );
  138.  
  139.  
  140.  
  141. }
  142.  
  143.  
  144.  
  145. add_action( 'wp_enqueue_scripts', 'newtek_scripts_styles' );
  146.  
  147.  
  148.  
  149.  
  150.  
  151. // Register Theme Features
  152.  
  153. function newtek_setup() {
  154.  
  155.  
  156.  
  157. // Add theme support for Semantic Markup
  158.  
  159. $markup = array( 'search-form', 'comment-form', 'comment-list', );
  160.  
  161. add_theme_support( 'html5', $markup );
  162.  
  163.  
  164.  
  165. add_theme_support( 'automatic-feed-links' );
  166.  
  167.  
  168.  
  169. add_theme_support( 'custom-background' );
  170.  
  171.  
  172.  
  173. $defaults = array(
  174.  
  175. 'default-color' => '',
  176.  
  177. 'default-image' => '',
  178.  
  179. 'wp-head-callback' => '_custom_background_cb',
  180.  
  181. 'admin-head-callback' => '',
  182.  
  183. 'admin-preview-callback' => ''
  184.  
  185. );
  186.  
  187. add_theme_support( 'custom-background', $defaults );
  188.  
  189.  
  190.  
  191. add_theme_support( 'post-thumbnails' );
  192.  
  193. set_post_thumbnail_size( 640, 360, true );
  194.  
  195. add_image_size( 'category-thumb', 640, 360, true );
  196.  
  197.  
  198.  
  199. register_nav_menu( 'header-menu',__( 'Header Menu', 'newtek' ) );
  200.  
  201.  
  202.  
  203. add_editor_style( 'editor-style.css' );
  204.  
  205.  
  206.  
  207. }
  208.  
  209.  
  210.  
  211. // Hook into the 'after_setup_theme' action
  212.  
  213. add_action( 'after_setup_theme', 'newtek_setup' );
  214.  
  215.  
  216.  
  217.  
  218.  
  219. function newtek_theme_customizer( $wp_customize ) {
  220.  
  221.  
  222.  
  223. $wp_customize->add_section( 'newtek_logo_section' , array(
  224.  
  225. 'title' => __( 'Logo', 'newtek' ),
  226.  
  227. 'priority' => 30,
  228.  
  229. 'description' => 'Upload a logo to replace the default site name. Suggested dimensions 300 width x 50 height.',
  230.  
  231. ) );
  232.  
  233.  
  234.  
  235. $wp_customize->add_setting( 'newtek_logo' );
  236.  
  237.  
  238.  
  239. $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'newtek_logo', array(
  240.  
  241. 'label' => __( 'Logo', 'newtek' ),
  242.  
  243. 'section' => 'newtek_logo_section',
  244.  
  245. 'settings' => 'newtek_logo',
  246.  
  247. ) ) );
  248.  
  249.  
  250.  
  251. }
  252.  
  253. add_action('customize_register', 'newtek_theme_customizer');
  254.  
  255.  
  256.  
  257. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement