/i', $post->post_content, $matches); if($output2) { $first_img = $matches[1][0]; } else { return NULL; } if(empty($first_img)) { $first_img = "/path/to/default.png"; } return $first_img; } function bigpix_ahoy() { // let's get language support going, if you need it load_theme_textdomain( 'bigpixtheme', get_template_directory() . '/library/translation' ); // launching operation cleanup add_action( 'init', 'bigpix_head_cleanup' ); // A better title add_filter( 'wp_title', 'rw_title', 10, 3 ); // remove WP version from RSS add_filter( 'the_generator', 'bigpix_rss_version' ); // remove pesky injected css for recent comments widget add_filter( 'wp_head', 'bigpix_remove_wp_widget_recent_comments_style', 1 ); // clean up comment styles in the head add_action( 'wp_head', 'bigpix_remove_recent_comments_style', 1 ); // clean up gallery output in wp add_filter( 'gallery_style', 'bigpix_gallery_style' ); // enqueue base scripts and styles add_action( 'wp_enqueue_scripts', 'bigpix_scripts_and_styles', 999 ); // ie conditional wrapper // launching this stuff after theme setup bigpix_theme_support(); add_theme_support( 'custom-header' ); // adding sidebars to Wordpress (these are created in functions.php) add_action( 'widgets_init', 'bigpix_register_sidebars' ); // cleaning up random code around images add_filter( 'the_content', 'bigpix_filter_ptags_on_images' ); // cleaning up excerpt add_filter( 'excerpt_more', 'bigpix_excerpt_more' ); } /* end bigpix ahoy */ // let's get this party started add_action( 'after_setup_theme', 'bigpix_ahoy' ); /************* OEMBED SIZE OPTIONS *************/ if ( ! isset( $content_width ) ) { $content_width = 640; } /************* THUMBNAIL SIZE OPTIONS *************/ // Thumbnail sizes add_image_size( 'bigpix-thumb-600', 600, 150, true ); add_image_size( 'bigpix-thumb-300', 300, 100, true ); add_image_size( 'slider-image', 1280, 500, true ); add_image_size( 'thumb-image-300by300', 300, 300, true ); /* to add more sizes, simply copy a line from above and change the dimensions & name. As long as you upload a "featured image" as large as the biggest set width or height, all the other sizes will be auto-cropped. To call a different size, simply change the text inside the thumbnail function. For example, to call the 300 x 300 sized image, we would use the function: for the 600 x 100 image: You can change the names and dimensions to whatever you like. Enjoy! */ add_filter( 'image_size_names_choose', 'bigpix_custom_image_sizes' ); function bigpix_custom_image_sizes( $sizes ) { return array_merge( $sizes, array( 'bigpix-thumb-600' => '600px by 150px', 'bigpix-thumb-300' => '300px by 100px', 'slider-image' => '1280px by 500px' ) ); } /* The function above adds the ability to use the dropdown menu to select the new images sizes you have just created from within the media manager when you add media to your content blocks. If you add more image sizes, duplicate one of the lines in the array and name it according to your new image size. */ /************* ACTIVE SIDEBARS ********************/ // Sidebars & Widgetizes Areas function bigpix_register_sidebars() { register_sidebar(array( 'id' => 'sidebar3', 'name' => __( 'Homepage Menu Widget Area', 'bigpixtheme' ), 'description' => __( 'The Menu Widget Area.', 'bigpixtheme' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'id' => 'sidebar1', 'name' => __( 'Posts Menu Widget Area', 'bigpixtheme' ), 'description' => __( 'The Posts Menu Widget Area.', 'bigpixtheme' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'id' => 'sidebar2', 'name' => __( 'Page Menu Widget Area', 'bigpixtheme' ), 'description' => __( 'The Page Menu Widget Area.', 'bigpixtheme' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'id' => 'sidebar5', 'name' => __( 'Archive Menu Widget Area', 'bigpixtheme' ), 'description' => __( 'The Archive Menu Widget Area.', 'bigpixtheme' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'id' => 'sidebar4', 'name' => __( 'Footer Widget Area', 'bigpixtheme' ), 'description' => __( 'The Footer Widget Area.', 'bigpixtheme' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); /* to add more sidebars or widgetized areas, just copy and edit the above sidebar code. In order to call your new sidebar just use the following code: Just change the name to whatever your new sidebar's id is, for example: register_sidebar(array( 'id' => 'sidebar2', 'name' => __( 'Sidebar 2', 'bigpixtheme' ), 'description' => __( 'The second (secondary) sidebar.', 'bigpixtheme' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); To call the sidebar in your template, you can just copy the sidebar.php file and rename it to your sidebar's name. So using the above example, it would be: sidebar-sidebar2.php */ } // don't remove this bracket! /************* COMMENT LAYOUT *********************/ // Comment Layout function bigpix_comments( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; ?>
>
' ); */ ?>
comment_approved == '0') : ?>

%1$s %2$s', 'bigpixtheme' ), get_comment_author_link(), edit_comment_link(__( '(Edit)', 'bigpixtheme' ),' ','') ) ?>
$depth, 'max_depth' => $args['max_depth']))) ?>
is added by WordPress automatically ?> remove_section( 'title_tagline'); $wp_customize->remove_section( 'static_front_page' ); /* color scheme option */ $wp_customize->add_setting( 'BIGPIX_color_settings', array ( 'default' => '#161616', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'BIGPIX_color_settings', array( 'label' => __( 'Primary Color Scheme', 'BIGPIX' ), 'section' => 'colors', 'settings' => 'BIGPIX_color_settings', ) ) ); $wp_customize->add_setting( 'BIGPIX_color_settings_2', array ( 'default' => '#656565', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'BIGPIX_color_settings_2', array( 'label' => __( 'Secondary Color Scheme', 'BIGPIX' ), 'section' => 'colors', 'settings' => 'BIGPIX_color_settings_2', ) ) ); $wp_customize->add_setting( 'BIGPIX_color_settings_3', array ( 'default' => '#fcff00', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'BIGPIX_color_settings_3', array( 'label' => __( 'Button and link Color Scheme', 'BIGPIX' ), 'section' => 'colors', 'settings' => 'BIGPIX_color_settings_3', ) ) ); /* logo option */ $wp_customize->add_section( 'BIGPIX_logo_section' , array( 'title' => __( 'Site Logo', 'BIGPIX' ), 'priority' => 1, 'description' => __( 'Upload a logo to replace the default site name in the header', 'BIGPIX' ), ) ); $wp_customize->add_setting( 'BIGPIX_logo', array( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'BIGPIX_logo', array( 'label' => __( 'Choose your logo (ideal width is 100-350px and ideal height is 35-40)', 'BIGPIX' ), 'section' => 'BIGPIX_logo_section', 'settings' => 'BIGPIX_logo', ) ) ); /* favicon option */ $wp_customize->add_section( 'BIGPIX_favicon_section' , array( 'title' => __( 'Site favicon', 'BIGPIX' ), 'priority' => 2, 'description' => __( 'Upload a favicon', 'BIGPIX' ), ) ); $wp_customize->add_setting( 'BIGPIX_favicon', array( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'BIGPIX_favicon', array( 'label' => __( 'Choose your favicon (ideal width and height is 16x16 or 32x32)', 'BIGPIX' ), 'section' => 'BIGPIX_favicon_section', 'settings' => 'BIGPIX_favicon', ) ) ); /* social media option */ $wp_customize->add_section( 'BIGPIX_social_section' , array( 'title' => __( 'Social Media Icons', 'BIGPIX' ), 'priority' => 32, 'description' => __( 'Optional media icons in the header', 'BIGPIX' ), ) ); $wp_customize->add_setting( 'BIGPIX_facebook', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'BIGPIX_facebook', array( 'label' => __( 'Enter your Facebook url', 'BIGPIX' ), 'section' => 'BIGPIX_social_section', 'settings' => 'BIGPIX_facebook', 'priority' => 101, ) ) ); $wp_customize->add_setting( 'BIGPIX_twitter', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'BIGPIX_twitter', array( 'label' => __( 'Enter your Twitter url', 'BIGPIX' ), 'section' => 'BIGPIX_social_section', 'settings' => 'BIGPIX_twitter', 'priority' => 102, ) ) ); $wp_customize->add_setting( 'BIGPIX_google', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'BIGPIX_google', array( 'label' => __( 'Enter your Google+ url', 'BIGPIX' ), 'section' => 'BIGPIX_social_section', 'settings' => 'BIGPIX_google', 'priority' => 103, ) ) ); $wp_customize->add_setting( 'BIGPIX_pinterest', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'BIGPIX_pinterest', array( 'label' => __( 'Enter your Pinterest url', 'BIGPIX' ), 'section' => 'BIGPIX_social_section', 'settings' => 'BIGPIX_pinterest', 'priority' => 104, ) ) ); $wp_customize->add_setting( 'BIGPIX_linkedin', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'BIGPIX_linkedin', array( 'label' => __( 'Enter your Linkedin url', 'BIGPIX' ), 'section' => 'BIGPIX_social_section', 'settings' => 'BIGPIX_linkedin', 'priority' => 105, ) ) ); $wp_customize->add_setting( 'BIGPIX_youtube', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'BIGPIX_youtube', array( 'label' => __( 'Enter your Youtube url', 'BIGPIX' ), 'section' => 'BIGPIX_social_section', 'settings' => 'BIGPIX_youtube', 'priority' => 106, ) ) ); $wp_customize->add_setting( 'BIGPIX_tumblr', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'BIGPIX_tumblr', array( 'label' => __( 'Enter your Tumblr url', 'BIGPIX' ), 'section' => 'BIGPIX_social_section', 'settings' => 'BIGPIX_tumblr', 'priority' => 107, ) ) ); $wp_customize->add_setting( 'BIGPIX_instagram', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'BIGPIX_instagram', array( 'label' => __( 'Enter your Instagram url', 'BIGPIX' ), 'section' => 'BIGPIX_social_section', 'settings' => 'BIGPIX_instagram', 'priority' => 108, ) ) ); $wp_customize->add_setting( 'BIGPIX_flickr', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'BIGPIX_flickr', array( 'label' => __( 'Enter your Flickr url', 'BIGPIX' ), 'section' => 'BIGPIX_social_section', 'settings' => 'BIGPIX_flickr', 'priority' => 109, ) ) ); $wp_customize->add_setting( 'BIGPIX_vimeo', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'BIGPIX_vimeo', array( 'label' => __( 'Enter your Vimeo url', 'BIGPIX' ), 'section' => 'BIGPIX_social_section', 'settings' => 'BIGPIX_vimeo', 'priority' => 110, ) ) ); $wp_customize->add_setting( 'BIGPIX_yelp', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'BIGPIX_yelp', array( 'label' => __( 'Enter your Yelp url', 'BIGPIX' ), 'section' => 'BIGPIX_social_section', 'settings' => 'BIGPIX_yelp', 'priority' => 111, ) ) ); $wp_customize->add_setting( 'BIGPIX_rss', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'BIGPIX_rss', array( 'label' => __( 'Enter your RSS url', 'BIGPIX' ), 'section' => 'BIGPIX_social_section', 'settings' => 'BIGPIX_rss', 'priority' => 112, ) ) ); $wp_customize->add_setting( 'BIGPIX_email', array ( 'sanitize_callback' => 'sanitize_email', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'BIGPIX_email', array( 'label' => __( 'Enter your email address', 'BIGPIX' ), 'section' => 'BIGPIX_social_section', 'settings' => 'BIGPIX_email', 'priority' => 113, ) ) ); /* slider options */ $wp_customize->add_section( 'BIGPIX_slider_section' , array( 'title' => __( 'Slider Options', 'BIGPIX' ), 'priority' => 33, 'description' => __( 'Adjust the behavior of the image slider.', 'BIGPIX' ), ) ); $wp_customize->add_setting( 'BIGPIX_slider_effect', array( 'default' => 'scrollHorz', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control( 'effect_select_box', array( 'settings' => 'BIGPIX_slider_effect', 'label' => __( 'Select Effect:', 'BIGPIX' ), 'section' => 'BIGPIX_slider_section', 'type' => 'select', 'choices' => array( 'scrollHorz' => 'Horizontal (Default)', 'scrollVert' => 'Vertical', 'tileSlide' => 'Tile Slide', 'tileBlind' => 'Blinds', 'shuffle' => 'Shuffle', ), )); $wp_customize->add_setting( 'BIGPIX_slider_timeout', array ( 'sanitize_callback' => 'BIGPIX_sanitize_integer', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'BIGPIX_slider_timeout', array( 'label' => __( 'Autoplay Speed in Seconds', 'BIGPIX' ), 'section' => 'BIGPIX_slider_section', 'settings' => 'BIGPIX_slider_timeout', ) ) ); /* author bio in posts option */ $wp_customize->add_section( 'BIGPIX_author_bio_section' , array( 'title' => __( 'Disable Author Bio', 'BIGPIX' ), 'priority' => 35, 'description' => __( 'Option to disable the author bio in the posts.', 'BIGPIX' ), ) ); $wp_customize->add_setting( 'BIGPIX_author_bio', array ( 'sanitize_callback' => 'BIGPIX_sanitize_checkbox', ) ); $wp_customize->add_control('author_bio', array( 'settings' => 'BIGPIX_author_bio', 'label' => __('Disable the Author Bio?', 'BIGPIX'), 'section' => 'BIGPIX_author_bio_section', 'type' => 'checkbox', )); /* related posts option */ $wp_customize->add_section( 'BIGPIX_related_posts_section' , array( 'title' => __( 'Disable Related Posts', 'BIGPIX' ), 'priority' => 36, 'description' => __( 'Option to disable the related posts in the posts.', 'BIGPIX' ), ) ); $wp_customize->add_setting( 'BIGPIX_related_posts', array ( 'sanitize_callback' => 'BIGPIX_sanitize_checkbox', ) ); $wp_customize->add_control('related_posts', array( 'settings' => 'BIGPIX_related_posts', 'label' => __('Disable the Related Posts?', 'BIGPIX'), 'section' => 'BIGPIX_related_posts_section', 'type' => 'checkbox', )); /*$wp_customize->add_setting( 'BIGPIX_slider_pager', array ( 'sanitize_callback' => 'BIGPIX_sanitize_checkbox', ) ); $wp_customize->add_control('enable_pager', array( 'settings' => 'BIGPIX_slider_pager', 'label' => __('Enable pager', 'BIGPIX'), 'section' => 'BIGPIX_slider_section', 'type' => 'checkbox', ));*/ /* date format options $wp_customize->add_section( 'BIGPIX_date_format_section' , array( 'title' => __( 'Date Format Options', 'BIGPIX' ), 'priority' => 34, 'description' => __( 'Adjust the date format.', 'BIGPIX' ), ) ); $wp_customize->add_setting( 'BIGPIX_date_format', array( 'default' => 'd.m.y', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control( 'date_format_select_box', array( 'settings' => 'BIGPIX_date_format', 'label' => __( 'Select Format:', 'BIGPIX' ), 'section' => 'BIGPIX_date_format_section', 'type' => 'select', 'choices' => array( 'd.m.y' => '31.01.13 (DD.MM.YY)', 'm.d.y' => '01.31.13 (MM.DD.YY)', 'F d, Y' => 'January 01, 2013', ), ));*/ $wp_customize->remove_section( 'nav'); $wp_customize->remove_section( 'header_image'); $wp_customize->remove_section( 'background_image'); } endif; add_action('customize_register', 'BIGPIX_theme_customizer'); /** * Sanitize checkbox */ if ( ! function_exists( 'BIGPIX_sanitize_checkbox' ) ) : function BIGPIX_sanitize_checkbox( $input ) { if ( $input == 1 ) { return 1; } else { return ''; } } endif; /** * Sanitize integer input */ if ( ! function_exists( 'BIGPIX_sanitize_integer' ) ) : function BIGPIX_sanitize_integer( $input ) { return absint($input); } endif; /** * Apply Color Scheme */ if ( ! function_exists( 'BIGPIX_apply_color' ) ) : function BIGPIX_apply_color() { if ( get_theme_mod('BIGPIX_color_settings') ) { ?> query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1; $pagination = array( 'base' => @add_query_arg('page','%#%'), 'format' => '', 'total' => $wp_query->max_num_pages, 'current' => $current, 'show_all' => true, 'type' => 'list', 'next_text' => '»', 'prev_text' => '«' ); if( $wp_rewrite->using_permalinks() ) $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 'page', get_pagenum_link( 1 ) ) ) . '?page=%#%/', 'paged' ); if( !empty($wp_query->query_vars['s']) ) $pagination['add_args'] = array( 's' => get_query_var( 's' ) ); echo paginate_links( $pagination ); } add_filter( 'the_content', 'remove_br_gallery', 11, 2); function remove_br_gallery($output) { return preg_replace('/
/mi','',$output); } function author_excerpt() { $text_limit = 50; //Words to show in author bio excerpt $read_more = "Read more"; //Read more text $end_of_txt = "..."; $name_of_author = get_the_author(); $url_of_author = get_author_posts_url(get_the_author_meta('ID')); $short_desc_author = wp_trim_words(strip_tags( get_the_author_meta('description')), $text_limit, $end_of_txt.'
'.$read_more .''); return $short_desc_author; } /* DON'T DELETE THIS CLOSING TAG */ ?>