Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // WP THEME CUSTOMIZER: START
- //// REMOVE SECTIONS
- //// TITLE & TAGLINE
- add_action( 'customize_register', 'wpse8170_customize_register' );
- function wpse8170_customize_register( WP_Customize_Manager $wp_customize ) {
- $wp_customize->remove_section( 'title_tagline' );
- }
- //// SECTION: LOGO
- function wptuts_theme_customizer( $wp_customize ) {
- /* Section: Pagination */
- $wp_customize->add_section( 'themeslug_pagination', array(
- 'title' => __( 'Pagination', 'themeslug' ),
- ) );
- $wp_customize->add_setting( 'pagination_style', array(
- 'default' => 'next-previous-links',
- ) );
- $wp_customize->add_control( 'pagination_style', array(
- 'label' => __( 'Pagination Style', 'themeslug' ),
- 'section' => 'themeslug_pagination',
- 'type' => 'radio',
- 'choices' => array(
- 'next-previous-links' => __( 'Next/Previous Links', 'themeslug' ),
- 'numbered' => __( 'Numbered', 'themeslug' ),
- ),
- ) );
- $wp_customize->add_section( 'themeslug_logo_section' , array(
- 'title' => __( 'Logo', 'themeslug' ),
- 'priority' => 2,
- 'description' => 'Upload a logo to replace the default site name and description in the header',
- ) );
- $wp_customize->add_setting( 'themeslug_logo' );
- $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'themeslug_logo', array(
- 'label' => __( 'Logo', 'themeslug' ),
- 'section' => 'themeslug_logo_section',
- 'settings' => 'themeslug_logo',
- ) ) );
- //// SECTION: Sidebar
- $wp_customize->add_setting('sidebar_position', array());
- $wp_customize->add_control('sidebar_position', array(
- 'label' => __('Sidebar position', 'Ari'),
- 'section' => 'layout',
- 'settings' => 'sidebar_position',
- 'type' => 'radio',
- 'choices' => array(
- 'left' => 'left',
- 'right' => 'right',
- ),
- ));
- $wp_customize->add_section('layout' , array(
- 'title' => __('Layout','Ari'),
- ));
- // WP THEME CUSTOMIZER: COLORS
- $colors = array();
- $colors[] = array(
- 'slug'=>'primary_color',
- 'default' => '#88C34B',
- 'label' => __('Primary Color', 'Ari')
- );
- $colors[] = array(
- 'slug'=>'secondary_color',
- 'default' => '#333333',
- 'label' => __('Content Text Color', 'Ari')
- );
- $colors[] = array(
- 'slug'=>'headings_color',
- 'default' => '#333333',
- 'label' => __('Headings Color', 'Ari')
- );
- $colors[] = array(
- 'slug'=>'background_color',
- 'default' => '#FFFFFF',
- 'label' => __('Background Color', 'Ari')
- );
- foreach( $colors as $color ) {
- // SETTINGS
- $wp_customize->add_setting(
- $color['slug'], array(
- 'default' => $color['default'],
- 'type' => 'option',
- 'capability' =>
- 'edit_theme_options'
- )
- );
- // CONTROLS
- $wp_customize->add_control(
- new WP_Customize_Color_Control(
- $wp_customize,
- $color['slug'],
- array('label' => $color['label'],
- 'section' => 'colors',
- 'settings' => $color['slug'])
- )
- );
- }
- // WP THEME CUSTOMIZER: LAST LINE
- }
- add_action( 'customize_register', 'wptuts_theme_customizer', 11 );
- // Posts per page
- add_filter('parse_query', 'wpq_parse_query');
- function wpq_parse_query($query)
- {
- if(!$query->is_main_query())
- {
- return $query;
- }
- if($query->is_archive())
- {
- $query->query_vars['posts_per_page'] = get_option('to_count_archives', 1);
- }
- if($query->is_home())
- {
- $query->query_vars['posts_per_page'] = get_option('to_count_home', 1);
- }
- if($query->is_search())
- {
- $query->query_vars['posts_per_page'] = get_option('to_count_search', 1);
- }
- return $query;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement