/wp-content/themes/pinboard/functions.php
PHP | 1301 lines | 1073 code | 43 blank | 185 comment | 291 complexity | eb80cd083a735cf9ddad44d2bc0605b0 MD5 | raw file
Possible License(s): Apache-2.0, AGPL-1.0, LGPL-2.1, GPL-2.0
- <?php
- /**
- * Load the theme options page if in admin mode
- */
- if ( is_admin() && is_readable( get_template_directory() . '/includes/theme-options.php' ) )
- require_once( get_template_directory() . '/includes/theme-options.php' );
- if ( ! function_exists( 'pinboard_theme_setup' ) ) :
- /*
- * Set up theme specific settings
- *
- * @uses add_theme_support() To add support for post thumbnails and automatic feed links.
- * @uses register_nav_menus() To add support for navigation menus.
- * @uses add_editor_style() To style the visual editor.
- * @uses load_theme_textdomain() For translation/localization support.
- * @uses add_image_size() To set custom image sizes.
- *
- * @since Pinboard 1.0
- */
- function pinboard_theme_setup() {
- // Set default content width based on the theme's layout. This affects the width of post images and embedded media.
- global $content_width;
- if( ! isset( $content_width ) ) $content_width = 660;
-
- // Automatically add feed links to document head
- add_theme_support( 'automatic-feed-links' );
-
- // Register Primary Navigation Menu
- register_nav_menus(
- array(
- 'primary_nav' => 'Primary Menu', // You can add more menus here
- )
- );
-
- // Add support for Post Formats
- add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat' ) );
-
- // Add support for post thumbnails and custom image sizes specific to theme locations
- add_theme_support( 'post-thumbnails', array( 'post' ) );
- add_image_size( 'slider-thumb', 1140, 395, 1 );
- add_image_size( 'blog-thumb', 700, ( pinboard_get_option( 'crop_thumbnails' ) ? 300 : 9999 ), ( pinboard_get_option( 'crop_thumbnails' ) ? 1 : 0 ) );
- add_image_size( 'teaser-thumb', 332, ( pinboard_get_option( 'crop_thumbnails' ) ? 205 : 9999 ), ( pinboard_get_option( 'crop_thumbnails' ) ? 1 : 0 ) );
- add_image_size( 'gallery-1-thumb', 432, 432, 1 );
- add_image_size( 'gallery-2-thumb', 268, 268, 1 );
- add_image_size( 'gallery-3-thumb', 268, 164, 1 );
- add_image_size( 'image-thumb', 700, 9999 );
- add_image_size( 'video-thumb', 700, 393, 1 );
-
- // Allows users to set a custom header image
- add_theme_support( 'custom-header', array(
- 'width' => ( pinboard_get_option( 'retina_header' ) ? 392 : 196 ),
- 'height' => ( pinboard_get_option( 'retina_header' ) ? 96 : 48 ),
- 'default-text-color' => '333',
- 'flex-width' => true,
- 'wp-head-callback' => 'pinboard_header_style',
- 'admin-head-callback' => 'pinboard_admin_header_style',
- 'admin-preview-callback' => 'pinboard_admin_header_image'
- ) );
-
- // Allows users to set a custom background
- add_theme_support( 'custom-background', array(
- 'default-image' => get_template_directory_uri() . '/images/bg.jpg',
- ) );
-
- // Styles the post editor
- add_editor_style();
-
- // Makes theme translation ready
- load_theme_textdomain( 'pinboard', get_template_directory() . '/languages' );
-
- }
- endif;
- add_action( 'after_setup_theme', 'pinboard_theme_setup' );
- if ( ! function_exists( 'pinboard_widgets_init' ) ) :
- /**
- * Registers theme widget areas
- *
- * @uses register_sidebar()
- *
- * @since Pinboard 1.0
- */
- function pinboard_widgets_init() {
- $title_tag = pinboard_get_option( 'widget_title_tag' );
-
- register_sidebar(
- array(
- 'name' => 'Header',
- 'description' => 'Displays in the header. Intended exclusively for displaying ads of standard dimentions.',
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</aside><!-- .widget -->',
- 'before_title' => '<' . $title_tag . ' class="widget-title">',
- 'after_title' => '</' . $title_tag . '>'
- )
- );
- register_sidebar(
- array(
- 'name' => 'Sidebar Top',
- 'description' => 'Displays in in the main sidebar stacked at the top.',
- 'before_widget' => '<div class="column onecol"><aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</aside><!-- .widget --></div>',
- 'before_title' => '<' . $title_tag . ' class="widget-title">',
- 'after_title' => '</' . $title_tag . '>'
- )
- );
- register_sidebar(
- array(
- 'name' => 'Sidebar Left',
- 'description' => 'Displays in in the main sidebar floated to the left.',
- 'before_widget' => '<div class="column onecol"><aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</aside><!-- .widget --></div>',
- 'before_title' => '<' . $title_tag . ' class="widget-title">',
- 'after_title' => '</' . $title_tag . '>'
- )
- );
- register_sidebar(
- array(
- 'name' => 'Sidebar Right',
- 'description' => 'Displays in in the main sidebar floated to the right.',
- 'before_widget' => '<div class="column onecol"><aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</aside><!-- .widget --></div>',
- 'before_title' => '<' . $title_tag . ' class="widget-title">',
- 'after_title' => '</' . $title_tag . '>'
- )
- );
- register_sidebar(
- array(
- 'name' => 'Sidebar Bottom',
- 'description' => 'Displays in in the main sidebar stacked at the bottom.',
- 'before_widget' => '<div class="column onecol"><aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</aside><!-- .widget --></div>',
- 'before_title' => '<' . $title_tag . ' class="widget-title">',
- 'after_title' => '</' . $title_tag . '>'
- )
- );
- $columns = pinboard_get_option( 'footer_columns' );
- if( 1 == $columns )
- $grid_class = 'onecol';
- elseif( 2 == $columns )
- $grid_class = 'twocol';
- elseif( 3 == $columns )
- $grid_class = 'threecol';
- elseif( 4 == $columns )
- $grid_class = 'fourcol';
- register_sidebar(
- array(
- 'name' => 'Footer',
- 'description' => 'Displays in in the footer area.',
- 'before_widget' => '<div class="column ' . $grid_class . '"><aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</aside><!-- .widget --></div>',
- 'before_title' => '<' . $title_tag . ' class="widget-title">',
- 'after_title' => '</' . $title_tag . '>'
- )
- );
- register_sidebar(
- array(
- 'name' => '404 Page',
- 'description' => 'Displays on 404 Pages in the content area.',
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</aside><!-- .widget -->',
- 'before_title' => '<' . $title_tag . ' class="widget-title">',
- 'after_title' => '</' . $title_tag . '>'
- )
- );
- register_sidebar(
- array(
- 'name' => 'Wide',
- 'description' => 'Displays on the front page and spans full width.',
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</aside><!-- .widget -->',
- 'before_title' => '<' . $title_tag . ' class="widget-title">',
- 'after_title' => '</' . $title_tag . '>'
- )
- );
- $columns = pinboard_get_option( 'boxes_columns' );
- if( 1 == $columns )
- $grid_class = 'onecol';
- elseif( 2 == $columns )
- $grid_class = 'twocol';
- elseif( 3 == $columns )
- $grid_class = 'threecol';
- elseif( 4 == $columns )
- $grid_class = 'fourcol';
- register_sidebar(
- array(
- 'name' => 'Boxes',
- 'before_widget' => '<div class="column ' . $grid_class . '"><aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</aside><!-- .widget --></div>',
- 'before_title' => '<' . $title_tag . ' class="widget-title">',
- 'after_title' => '</' . $title_tag . '>'
- )
- );
- register_sidebar(
- array(
- 'name' => 'Footer Wide',
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</aside><!-- .widget -->',
- 'before_title' => '<' . $title_tag . ' class="widget-title">',
- 'after_title' => '</' . $title_tag . '>'
- )
- );
- }
- endif;
- add_action( 'widgets_init', 'pinboard_widgets_init' );
- if ( ! function_exists( 'pinboard_header_style' ) ) :
- /**
- * Styles the header image displayed on the Appearance > Header admin panel.
- *
- * @since Pinboard 1.0
- */
- function pinboard_header_style() { ?>
- <style type="text/css">
- <?php if ( 'blank' == get_header_textcolor() ) : ?>
- #site-title .home,
- #site-description {
- position:absolute !important;
- clip:rect(1px, 1px, 1px, 1px);
- }
- <?php else : ?>
- #site-title a,
- #site-description {
- color:#<?php header_textcolor(); ?>;
- }
- <?php endif; ?>
- </style>
- <?php
- }
- endif;
- if ( ! function_exists( 'pinboard_admin_header_style' ) ) :
- /**
- * Shows the header image preview in the admin panel.
- *
- * @since Pinboard 1.0
- */
- function pinboard_admin_header_style() {
- $header_image = get_header_image(); ?>
- <style type="text/css">
- @import url("<?php echo ( is_ssl() ? 'https' : 'http' ); ?>://fonts.googleapis.com/css?family=Oswald:300|Open+Sans:normal&subset=latin");
- .appearance_page_custom-header #headimg {
- max-width:1132px;
- width:100%;
- border:none;
- }
- #headimg {
- padding:0 20px;
- background:#F8F8F8;
- }
- #headimg h1 {
- float:left;
- margin:0;
- font-family:"Oswald", sans-serif;
- font-size:32px;
- font-weight:bold;
- line-height:120px;
- }
- #headimg h1 a {
- text-decoration:none;
- }
- #desc {
- float:left;
- margin-left:20px;
- font-family:"Open Sans", sans-serif;
- font-size:12px;
- font-weight:normal;
- line-height:120px;
- }
- #headimg img {
- max-width: 100%;
- vertical-align:middle;
- }
- #headimg h1 a,
- #desc {
- color:#<?php header_textcolor() ?>;
- }
- </style>
- <?php
- }
- endif;
- if ( ! function_exists( 'pinboard_admin_header_image' ) ) :
- /**
- * Custom header image markup displayed on the Appearance > Header admin panel.
- *
- * @since Pinboard 1.0
- */
- function pinboard_admin_header_image() {
- if ( 'blank' == get_header_textcolor() || '' == get_header_textcolor() )
- $style = ' style="display:none;"';
- else
- $style = ' style="color:#' . get_header_textcolor() . ';"';
- $header_image = get_header_image(); ?>
- <div id="headimg">
- <h1>
- <?php if ( ! empty( $header_image ) ) : ?>
- <a id="name" onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>">
- <img src="<?php header_image(); ?>" alt="<?php bloginfo( 'name' ); ?>" width="<?php echo ( pinboard_get_option( 'retina_header' ) ? absint( get_custom_header()->width / 2 ) : get_custom_header()->width ); ?>" height="<?php echo ( pinboard_get_option( 'retina_header' ) ? absint( get_custom_header()->height / 2 ) : get_custom_header()->height ); ?>" />
- </a>
- <?php endif; ?>
- <a id="name"<?php echo $style; ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php bloginfo( 'name' ); ?></a>
- </h1>
- <div id="desc"<?php echo $style; ?>><?php bloginfo( 'description' ); ?></div>
- <div class="clear"></div>
- </div>
- <?php
- }
- endif;
- if ( ! function_exists( 'pinboard_default_options' ) ) :
- /**
- * Returns an array of theme default options.
- *
- * @since Pinboard 1.0
- */
- function pinboard_default_options() {
- $options = array(
- 'home_page_excerpts' => 2,
- 'slider' => true,
- 'location' => true,
- 'retina_header' => false,
- 'crop_thumbnails' => false,
- 'lightbox' => true,
- 'facebook_link' => '',
- 'twitter_link' => '',
- 'pinterest_link' => '',
- 'flickr_link' => '',
- 'youtube_link' => '',
- 'vimeo_link' => '',
- 'googleplus_link' => '',
- 'dribble_link' => '',
- 'linkedin_link' => '',
- 'portfolio_cat' => -1,
- 'portfolio_filter' => true,
- 'portfolio_excerpts' => 0,
- 'portfolio_archive_excerpts' => 0,
- 'portfolio_columns' => 3,
- 'portfolio_meta' => true,
- 'blog_exclude_portfolio' => true,
- 'location' => true,
- 'archive_excerpts' => 0,
- 'posts_nav' => 'infinite',
- 'posts_nav_labels' => 'older/newer',
- 'fancy_dropdowns' => true,
- 'facebook' => true,
- 'twitter' => true,
- 'google' => true,
- 'pinterest' => true,
- 'author_box' => false,
- 'copyright_notice' => '© %year% %blogname%',
- 'theme_credit_link' => true,
- 'author_credit_link' => false,
- 'wordpress_credit_link' => true,
- 'page_background' => '#f8f8f8',
- 'menu_background' => '#111',
- 'menu_item_hover_background' => '#555',
- 'sidebar_wide_background' => '#eee',
- 'content_background' => '#fff',
- 'post_meta_background' => '#fcfcfc',
- 'footer_area_background' => '#222',
- 'footer_background' => '#111',
- 'layout' => 'content-sidebar',
- 'layout_columns' => 3,
- 'boxes_columns' => 3,
- 'footer_columns' => 3,
- 'hide_sidebar' => false,
- 'hide_footer_area' => false,
- 'user_css' => '',
- 'body_font' => 'open-sans',
- 'headings_font' => 'oswald',
- 'content_font' => 'open-sans',
- 'body_font_size' => '13',
- 'body_font_size_unit' => 'px',
- 'body_line_height' => '1.62',
- 'body_line_height_unit' => 'em',
- 'h1_font_size' => '36',
- 'h1_font_size_unit' => 'px',
- 'h2_font_size' => '32',
- 'h2_font_size_unit' => 'px',
- 'h3_font_size' => '24',
- 'h3_font_size_unit' => 'px',
- 'h4_font_size' => '18',
- 'h4_font_size_unit' => 'px',
- 'headings_line_height' => '1.62',
- 'headings_line_height_unit' => 'em',
- 'content_font_size' => '15',
- 'content_font_size_unit' => 'px',
- 'content_line_height' => '1.62',
- 'content_line_height_unit' => 'em',
- 'mobile_font_size' => '17',
- 'mobile_font_size_unit' => 'px',
- 'mobile_line_height' => '1.62',
- 'mobile_line_height_unit' => 'em',
- 'body_color' => '#333',
- 'headings_color' => '#333',
- 'content_color' => '#333',
- 'links_color' => '#21759b',
- 'links_hover_color' => '#d54e21',
- 'menu_color' => '#f0f0f0',
- 'menu_hover_color' => '#fff',
- 'sidebar_color' => '#ccc',
- 'sidebar_title_color' => '#ccc',
- 'sidebar_links_color' => '#7597B9',
- 'footer_color' => '#ccc',
- 'footer_title_color' => '#e0e0e0',
- 'copyright_color' => '#ccc',
- 'copyright_links_color' => '#7597B9',
- 'home_site_title_tag' => 'h1',
- 'home_desc_title_tag' => 'div',
- 'home_post_title_tag' => 'h2',
- 'archive_site_title_tag' => 'div',
- 'archive_desc_title_tag' => 'div',
- 'archive_location_title_tag' => 'h1',
- 'archive_post_title_tag' => 'h2',
- 'single_site_title_tag' => 'div',
- 'single_desc_title_tag' => 'div',
- 'single_post_title_tag' => 'h1',
- 'single_comments_title_tag' => 'h2',
- 'single_respond_title_tag' => 'h2',
- 'widget_title_tag' => 'h3',
- );
- return $options;
- }
- endif;
- if ( ! function_exists( 'pinboard_get_option' ) ) :
- /**
- * Used to output theme options is an elegant way
- *
- * @uses get_option() To retrieve the options array
- *
- * @since Pinboard 1.0
- */
- function pinboard_get_option( $option ) {
- global $pinboard_options;
- if( ! isset( $pinboard_options ) )
- $pinboard_options = get_option( 'pinboard_theme_options', pinboard_default_options() );
- return $pinboard_options[ $option ];
- }
- endif;
- if ( ! function_exists( 'pinboard_available_fonts' ) ) :
- /**
- * Returns an array of fonts available to the theme.
- *
- * @since Pinboard 1.0
- */
- function pinboard_available_fonts() {
- return array(
- 'helvetica' => '"Helvetica Neue", "Nimbus Sans L", sans-serif',
- 'verdana' => 'Geneva, Verdana, "DejaVu Sans", sans-serif',
- 'tahoma' => 'Tahoma, "DejaVu Sans", sans-serif',
- 'trebuchet' => '"Trebuchet MS", "Bitstream Vera Sans", sans-serif',
- 'lucida-grande' => '"Lucida Grande", "Lucida Sans Unicode", "Bitstream Vera Sans", sans-serif',
- 'droid-sans' => '"Droid Sans", sans-serif',
- 'lato' => '"Lato", sans-serif',
- 'pt-sans' => '"PT Sans", sans-serif',
- 'cantarell' => '"Cantarell", sans-serif',
- 'open-sans' => '"Open Sans", sans-serif',
- 'oswald' => '"Oswald", sans-serif',
- 'yanone-kaffeesatz' => '"Yanone Kaffeesatz", sans-serif',
- 'quattrocento-sans' => '"Quattrocento Sans", sans-serif',
- 'georgia' => 'Georgia, "URW Bookman L", serif',
- 'times' => 'Times, "Times New Roman", "Century Schoolbook L", serif',
- 'palatino' => 'Palatino, "Palatino Linotype", "URW Palladio L", serif',
- 'droid-serif' => '"Droid Serif", serif',
- 'lora' => '"Lora", serif',
- 'pt-serif' => '"PT Serif", serif',
- 'courier' => 'Courier, "Courier New", "Nimbus Mono L", monospace',
- 'monaco' => 'Monaco, Consolas, "Lucida Console", "Bitstream Vera Sans Mono", monospace',
- );
- }
- endif;
- if ( ! function_exists( 'pinboard_filter_query' ) ) :
- /**
- * Filter the main loop
- *
- * Allows overriding of query parameters
- * for the main loop without performing
- * additional database queries
- *
- * @since Pinboard 1.0
- */
- function pinboard_filter_query( $query ) {
- global $wp_the_query;
- if( $wp_the_query === $query ) {
- if( $query->is_home() && pinboard_get_option( 'slider' ) )
- $query->set( 'ignore_sticky_posts', 1 );
- if( $query->is_home() && pinboard_get_option( 'blog_exclude_portfolio' ) )
- $query->set( 'cat', '-' . pinboard_get_option( 'portfolio_cat' ) );
- }
- }
- endif;
- add_action( 'pre_get_posts', 'pinboard_filter_query' );
- if ( ! function_exists( 'pinboard_register_styles' ) ) :
- /**
- * Register theme styles
- *
- * Registers stylesheets used by the theme.
- * Also offers integration with Google Web Fonts Directory
- * @uses wp_register_style() To register styles
- *
- * @since Pinboard 1.0.
- */
- function pinboard_register_styles() {
- $web_fonts = array(
- 'droid-sans' => 'Droid+Sans',
- 'lato' => 'Lato',
- 'pt-sans' => 'PT+Sans',
- 'cantarell' => 'Cantarell',
- 'open-sans' => 'Open+Sans',
- 'oswald' => 'Oswald',
- 'yanone-kaffeesatz' => 'Yanone+Kaffeesatz',
- 'quattrocento-sans' => 'Quattrocento+Sans',
- 'droid-serif' => 'Droid+Serif',
- 'lora' => 'Lora',
- 'pt-serif' => 'PT+Serif'
- );
- if( array_key_exists( pinboard_get_option( 'body_font' ), $web_fonts ) || in_array( pinboard_get_option( 'headings_font' ), $web_fonts )|| in_array( pinboard_get_option( 'content_font' ), $web_fonts ) ) {
- $web_fonts_stylesheet = 'http' . ( is_ssl() ? 's' : '' ) . '://fonts.googleapis.com/css?family=';
- if( array_key_exists( pinboard_get_option( 'body_font' ), $web_fonts ) ) {
- $web_fonts_stylesheet .= $web_fonts[pinboard_get_option( 'body_font' )] . ':300,300italic,regular,italic,600,600italic';
- }
- if( ( pinboard_get_option( 'headings_font' ) != pinboard_get_option( 'body_font' ) ) && array_key_exists( pinboard_get_option( 'headings_font' ), $web_fonts ) ) {
- $web_fonts_stylesheet .= '|' . $web_fonts[pinboard_get_option( 'headings_font' )] . ':300,300italic,regular,italic,600,600italic';
- }
- if( ( pinboard_get_option( 'content_font' ) != pinboard_get_option( 'body_font' ) ) && ( pinboard_get_option( 'content_font' ) != pinboard_get_option( 'headings_font' ) ) && array_key_exists( pinboard_get_option( 'content_font' ), $web_fonts ) ) {
- $web_fonts_stylesheet .= '|' . $web_fonts[pinboard_get_option( 'content_font' )] . ':300,300italic,regular,italic,600,600italic';
- }
- $web_fonts_stylesheet .= '&subset=latin';
- } else
- $web_fonts_stylesheet = false;
- if( false !== $web_fonts_stylesheet ) {
- wp_register_style( 'pinboard-web-font', $web_fonts_stylesheet, false, null );
- $pinboard_deps = array( 'pinboard-web-font' );
- } else
- $pinboard_deps = false;
- wp_register_style( 'pinboard', get_stylesheet_uri(), $pinboard_deps, null );
- wp_register_style( 'colorbox', get_template_directory_uri() . '/styles/colorbox.css', false, null );
- wp_register_style( 'mediaelementplayer', get_template_directory_uri() . '/styles/mediaelementplayer.css', false, null );
- }
- endif;
- add_action( 'init', 'pinboard_register_styles' );
- if ( ! function_exists( 'pinboard_enqueue_styles' ) ) :
- /**
- * Enqueue theme styles
- *
- * @uses wp_enqueue_style() To enqueue styles
- *
- * @since Pinboard 1.0
- */
- function pinboard_enqueue_styles() {
- //wp_enqueue_style( 'pinboard-web-font' );
- wp_enqueue_style( 'pinboard' );
- if( pinboard_get_option( 'lightbox' ) )
- wp_enqueue_style( 'colorbox' );
- wp_enqueue_style( 'mediaelementplayer' );
- }
- endif;
- add_action( 'wp_enqueue_scripts', 'pinboard_enqueue_styles' );
- if ( ! function_exists( 'pinboard_register_scripts' ) ) :
- /**
- * Register theme scripts
- *
- * @uses wp_register_scripts() To register scripts
- *
- * @since Pinboard 1.0
- */
- function pinboard_register_scripts() {
- wp_register_script( 'ios-orientationchange-fix', get_template_directory_uri() . '/scripts/ios-orientationchange-fix.js', false, null );
- wp_register_script( 'flexslider', get_template_directory_uri() . '/scripts/jquery.flexslider-min.js', array( 'jquery' ), null );
- wp_register_script( 'masonry', get_template_directory_uri() . '/scripts/jquery.masonry.min.js', array( 'jquery' ), null );
- wp_register_script( 'colorbox', get_template_directory_uri() . '/scripts/colorbox.js', array( 'jquery' ), null );
- wp_register_script( 'fitvids', get_template_directory_uri() . '/scripts/fitvids.js', array( 'jquery' ), null );
- wp_register_script( 'mediaelement', get_template_directory_uri() . '/scripts/mediaelement.js', array( 'jquery' ), null );
- wp_register_script( 'mediaelementplayer', get_template_directory_uri() . '/scripts/mediaelementplayer.js', array( 'mediaelement' ), null );
- wp_register_script( 'infinitescroll', get_template_directory_uri() . '/scripts/jquery.infinitescroll.js', array( 'jquery' ), null );
- }
- endif;
- add_action( 'init', 'pinboard_register_scripts' );
- if ( ! function_exists( 'pinboard_enqueue_scripts' ) ) :
- /**
- * Enqueue theme scripts
- *
- * @uses wp_enqueue_scripts() To enqueue scripts
- *
- * @since Pinboard 1.0
- */
- function pinboard_enqueue_scripts() {
- wp_enqueue_script( 'ios-orientationchange-fix' );
- wp_enqueue_script( 'jquery' );
- wp_enqueue_script( 'flexslider' );
- wp_enqueue_script( 'fitvids' );
- wp_enqueue_script( 'mediaelementplayer' );
- if( 'infinite' == pinboard_get_option( 'posts_nav' ) && ! is_singular() && ! is_paged() || ( is_page_template( 'template-blog.php' ) || is_page_template( 'template-blog-full-width.php' ) || is_page_template( 'template-blog-four-col.php' ) || is_page_template( 'template-blog-left-sidebar.php' ) || is_page_template( 'template-blog-no-sidebars.php' ) || is_page_template( 'template-portfolio.php' ) || is_page_template( 'template-portfolio-right-sidebar.php' ) || is_page_template( 'template-portfolio-four-col.php' ) || is_page_template( 'template-portfolio-left-sidebar.php' ) || is_page_template( 'template-portfolio-no-sidebars.php' ) && ! is_paged() ) )
- wp_enqueue_script( 'infinitescroll' );
- if( ! is_singular() || is_page_template( 'template-blog.php' ) || is_page_template( 'template-blog-full-width.php' ) || is_page_template( 'template-blog-four-col.php' ) || is_page_template( 'template-blog-left-sidebar.php' ) || is_page_template( 'template-blog-no-sidebars.php' ) || is_page_template( 'template-blog-no-sidebars.php' ) || is_page_template( 'template-portfolio.php' ) || is_page_template( 'template-portfolio-right-sidebar.php' ) || is_page_template( 'template-portfolio-four-col.php' ) || is_page_template( 'template-portfolio-left-sidebar.php' ) || is_page_template( 'template-portfolio-no-sidebars.php' ) )
- wp_enqueue_script( 'masonry' );
- if( pinboard_get_option( 'lightbox' ) )
- wp_enqueue_script( 'colorbox' );
- if ( is_singular() && get_option( 'thread_comments' ) )
- wp_enqueue_script( 'comment-reply' );
- }
- endif;
- add_action( 'wp_enqueue_scripts', 'pinboard_enqueue_scripts' );
- if ( ! function_exists( 'pinboard_html5_shiv' ) ) :
- /**
- * Outputs the html5.js script with IE conditionals
- *
- * @since Pinboard 1.0
- */
- function pinboard_html5_shiv() { ?>
- <!--[if lt IE 9]>
- <script src="<?php echo get_template_directory_uri(); ?>/scripts/html5.js" type="text/javascript"></script>
- <![endif]-->
- <?php
- }
- endif;
- add_action( 'wp_print_scripts', 'pinboard_html5_shiv' );
- if ( ! function_exists( 'pinboard_call_scripts' ) ) :
- /**
- * Call script functions in document head
- *
- * @since Pinboard 1.0
- */
- function pinboard_call_scripts() { ?>
- <script>
- /* <![CDATA[ */
- jQuery(document).ready(function($) {
- $('#access .menu > li > a').each(function() {
- var title = $(this).attr('title');
- if(typeof title !== 'undefined' && title !== false) {
- $(this).append('<br /> <span>'+title+'</span>');
- $(this).removeAttr('title');
- }
- });
- function pinboard_move_elements(container) {
- if( container.hasClass('onecol') ) {
- var thumb = $('.entry-thumbnail', container);
- if('undefined' !== typeof thumb)
- $('.entry-container', container).before(thumb);
- var video = $('.entry-attachment', container);
- if('undefined' !== typeof video)
- $('.entry-container', container).before(video);
- var gallery = $('.post-gallery', container);
- if('undefined' !== typeof gallery)
- $('.entry-container', container).before(gallery);
- var meta = $('.entry-meta', container);
- if('undefined' !== typeof meta)
- $('.entry-container', container).after(meta);
- }
- }
- function pinboard_restore_elements(container) {
- if( container.hasClass('onecol') ) {
- var thumb = $('.entry-thumbnail', container);
- if('undefined' !== typeof thumb)
- $('.entry-header', container).after(thumb);
- var video = $('.entry-attachment', container);
- if('undefined' !== typeof video)
- $('.entry-header', container).after(video);
- var gallery = $('.post-gallery', container);
- if('undefined' !== typeof gallery)
- $('.entry-header', container).after(gallery);
- var meta = $('.entry-meta', container);
- if('undefined' !== typeof meta)
- $('.entry-header', container).append(meta);
- else
- $('.entry-header', container).html(meta.html());
- }
- }
- if( ($(window).width() > 960) || ($(document).width() > 960) ) {
- // Viewport is greater than tablet: portrait
- } else {
- $('#content .post').each(function() {
- pinboard_move_elements($(this));
- });
- }
- $(window).resize(function() {
- if( ($(window).width() > 960) || ($(document).width() > 960) ) {
- <?php if( is_category( pinboard_get_option( 'portfolio_cat' ) ) || ( is_category() && cat_is_ancestor_of( pinboard_get_option( 'portfolio_cat' ), get_queried_object() ) ) ) : ?>
- $('#content .post').each(function() {
- pinboard_restore_elements($(this));
- });
- <?php else : ?>
- $('.page-template-template-full-width-php #content .post, .page-template-template-blog-full-width-php #content .post, .page-template-template-blog-four-col-php #content .post').each(function() {
- pinboard_restore_elements($(this));
- });
- <?php endif; ?>
- } else {
- $('#content .post').each(function() {
- pinboard_move_elements($(this));
- });
- }
- if( ($(window).width() > 760) || ($(document).width() > 760) ) {
- var maxh = 0;
- $('#access .menu > li > a').each(function() {
- if(parseInt($(this).css('height'))>maxh) {
- maxh = parseInt($(this).css('height'));
- }
- });
- $('#access .menu > li > a').css('height', maxh);
- } else {
- $('#access .menu > li > a').css('height', 'auto');
- }
- });
- if( ($(window).width() > 760) || ($(document).width() > 760) ) {
- var maxh = 0;
- $('#access .menu > li > a').each(function() {
- var title = $(this).attr('title');
- if(typeof title !== 'undefined' && title !== false) {
- $(this).append('<br /> <span>'+title+'</span>');
- $(this).removeAttr('title');
- }
- if(parseInt($(this).css('height'))>maxh) {
- maxh = parseInt($(this).css('height'));
- }
- });
- $('#access .menu > li > a').css('height', maxh);
- <?php if( pinboard_get_option( 'fancy_dropdowns' ) ) : ?>
- $('#access li').mouseenter(function() {
- $(this).children('ul').css('display', 'none').stop(true, true).fadeIn(250).css('display', 'block').children('ul').css('display', 'none');
- });
- $('#access li').mouseleave(function() {
- $(this).children('ul').stop(true, true).fadeOut(250).css('display', 'block');
- });
- <?php endif; ?>
- } else {
- $('#access li').each(function() {
- if($(this).children('ul').length)
- $(this).append('<span class="drop-down-toggle"><span class="drop-down-arrow"></span></span>');
- });
- $('.drop-down-toggle').click(function() {
- $(this).parent().children('ul').slideToggle(250);
- });
- }
- <?php if( ( is_home() && ! is_paged() ) || ( is_front_page() && ! is_home() ) || is_page_template( 'template-landing-page.php' ) ) : ?>
- $('#slider').flexslider({
- selector: '.slides > li',
- video: true,
- prevText: '←',
- nextText: '→',
- pausePlay: true,
- pauseText: '||',
- playText: '>',
- before: function() {
- $('#slider .entry-title').hide();
- },
- after: function() {
- $('#slider .entry-title').fadeIn();
- }
- });
- <?php endif; ?>
- <?php if( ! is_singular() || is_page_template( 'template-blog.php' ) || is_page_template( 'template-blog-full-width.php' ) || is_page_template( 'template-blog-four-col.php' ) || is_page_template( 'template-blog-left-sidebar.php' ) || is_page_template( 'template-blog-no-sidebars.php' ) || is_page_template( 'template-blog-no-sidebars.php' ) || is_page_template( 'template-portfolio.php' ) || is_page_template( 'template-portfolio-right-sidebar.php' ) || is_page_template( 'template-portfolio-four-col.php' ) || is_page_template( 'template-portfolio-left-sidebar.php' ) || is_page_template( 'template-portfolio-no-sidebars.php' ) ) : ?>
- var $content = $('.entries');
- $content.imagesLoaded(function() {
- $content.masonry({
- itemSelector : '.post',
- columnWidth : function( containerWidth ) {
- return containerWidth / 12;
- },
- });
- });
- <?php if( ( ! is_singular() && ! is_paged() ) || ( ( is_page_template( 'template-blog.php' ) || is_page_template( 'template-blog-full-width.php' ) || is_page_template( 'template-blog-four-col.php' ) || is_page_template( 'template-blog-left-sidebar.php' ) || is_page_template( 'template-blog-no-sidebars.php' ) || is_page_template( 'template-blog-no-sidebars.php' ) || is_page_template( 'template-portfolio.php' ) || is_page_template( 'template-portfolio-right-sidebar.php' ) || is_page_template( 'template-portfolio-four-col.php' ) || is_page_template( 'template-portfolio-left-sidebar.php' ) || is_page_template( 'template-portfolio-no-sidebars.php' ) ) && ! is_paged() ) ) : ?>
- <?php if( 'ajax' == pinboard_get_option( 'posts_nav' ) ) : ?>
- var nav_link = $('#posts-nav .nav-all a');
- if(!nav_link.length)
- var nav_link = $('#posts-nav .nav-next a');
- if(nav_link.length) {
- nav_link.addClass('ajax-load');
- nav_link.html('Load more posts');
- nav_link.click(function() {
- var href = $(this).attr('href');
- nav_link.html('<img src="<?php echo get_template_directory_uri(); ?>/images/loading.gif" style="float: none; vertical-align: middle;" /> Loading more posts …');
- $.get(href, function(data) {
- var helper = document.createElement('div');
- helper = $(helper);
- helper.html(data);
- var content = $('#content .entries', helper);
- $('.entries').append(content.html());
- var nav_url = $('#posts-nav .nav-next a', helper).attr('href');
- if(typeof nav_url !== 'undefined') {
- nav_link.attr('href', nav_url);
- nav_link.html('Load more posts');
- } else {
- $('#posts-nav').html('<span class="ajax-load">There are no more posts to display.</span>');
- }
- });
- return false;
- });
- }
- <?php elseif( 'infinite' == pinboard_get_option( 'posts_nav' ) ) : ?>
- $('#content .entries').infinitescroll({
- debug : false,
- nextSelector : "#posts-nav .nav-all a, #posts-nav .nav-next a",
- loadingImg : ( window.devicePixelRatio > 1 ? "<?php echo get_template_directory_uri(); ?>/images/ajax-loading_2x.gif" : "<?php echo get_template_directory_uri(); ?>/images/ajax-loading.gif" ),
- loadingText : "Loading more posts …",
- donetext : "There are no more posts to display.",
- navSelector : "#posts-nav",
- contentSelector : "#content .entries",
- itemSelector : "#content .entries .post",
- }, function(entries){
- var $entries = $( entries ).css({ opacity: 0 });
- $entries.imagesLoaded(function(){
- $entries.animate({ opacity: 1 });
- $content.masonry( 'appended', $entries, true );
- });
- if( ($(window).width() > 960) || ($(document).width() > 960) ) {
- // Viewport is greater than tablet: portrait
- } else {
- $('#content .post').each(function() {
- pinboard_move_elements($(this));
- });
- }
- $('audio,video').mediaelementplayer({
- videoWidth: '100%',
- videoHeight: '100%',
- audioWidth: '100%',
- alwaysShowControls: true,
- features: ['playpause','progress','tracks','volume'],
- videoVolume: 'horizontal'
- });
- $(".entry-attachment, .entry-content").fitVids({ customSelector: "iframe, object, embed"});
- <?php if( pinboard_get_option( 'lightbox' ) ) : ?>
- $('.entry-content a[href$=".jpg"],.entry-content a[href$=".jpeg"],.entry-content a[href$=".png"],.entry-content a[href$=".gif"],a.colorbox').colorbox();
- <?php endif; ?>
- });
- <?php endif; ?>
- <?php endif; ?>
- <?php endif; ?>
- $('audio,video').mediaelementplayer({
- videoWidth: '100%',
- videoHeight: '100%',
- audioWidth: '100%',
- alwaysShowControls: true,
- features: ['playpause','progress','tracks','volume'],
- videoVolume: 'horizontal'
- });
- $(".entry-attachment, .entry-content").fitVids({ customSelector: "iframe, object, embed"});
- });
- jQuery(window).load(function() {
- <?php if( pinboard_get_option( 'lightbox' ) ) : ?>
- jQuery('.entry-content a[href$=".jpg"],.entry-content a[href$=".jpeg"],.entry-content a[href$=".png"],.entry-content a[href$=".gif"],a.colorbox').colorbox();
- <?php endif; ?>
- });
- /* ]]> */
- </script>
- <?php
- }
- endif;
- add_action( 'wp_head', 'pinboard_call_scripts' );
- if ( ! function_exists( 'pinboard_custom_styles' ) ) :
- /**
- * Custom style declarations
- *
- * Outputs CSS declarations generated by theme options
- * and custom user defined CSS in the document <head>
- *
- * @since Pinboard 1.0
- */
- function pinboard_custom_styles() {
- $default_options = pinboard_default_options();
- $fonts = pinboard_available_fonts(); ?>
- <style type="text/css">
- <?php if( '' == pinboard_get_option( 'facebook_link' ) && '' == pinboard_get_option( 'twitter_link' ) && '' == pinboard_get_option( 'pinterest_link' ) && '' == pinboard_get_option( 'vimeo_link' ) && '' == pinboard_get_option( 'youtube_link' ) && '' == pinboard_get_option( 'flickr_link' ) && '' == pinboard_get_option( 'googleplus_link' ) && '' == pinboard_get_option( 'dribble_link' ) && '' == pinboard_get_option( 'linkedin_link' ) ) : ?>
- #header input#s {
- width:168px;
- box-shadow:inset 1px 1px 5px 1px rgba(0, 0, 0, .1);
- text-indent: 0;
- }
- <?php endif; ?>
- <?php if( is_category( pinboard_get_option( 'portfolio_cat' ) ) || ( is_category() && cat_is_ancestor_of( pinboard_get_option( 'portfolio_cat' ), get_queried_object() ) ) ) : ?>
- .post.onecol .entry-header {
- float:left;
- width:27.6%;
- }
- .post.onecol .entry-summary {
- float:right;
- width:69.5%;
- }
- .post.onecol .wp-post-image,
- .post.onecol .entry-attachment,
- .post.onecol .post-gallery {
- float:right;
- max-width:69.5%;
- }
- .post.onecol .entry-attachment,
- .post.onecol .post-gallery {
- width:69.5%;
- }
- .twocol .entry-title,
- .threecol .entry-title,
- .fourcol .entry-title {
- margin: 0;
- text-align: center;
- }
- @media screen and (max-width: 960px) {
- .post.onecol .wp-post-image,
- .post.onecol .entry-attachment,
- .post.onecol .post-gallery {
- float:none;
- max-width:100%;
- margin:0;
- }
- .post.onecol .entry-attachment,
- .post.onecol .post-gallery {
- width:100%;
- }
- .post.onecol .entry-header,
- .post.onecol .entry-summary {
- float:none;
- width:auto;
- }
- }
- <?php endif; ?>
- <?php if( pinboard_get_option( 'hide_sidebar' ) ) : ?>
- @media screen and (max-width: 760px) {
- #sidebar {
- display: none;
- }
- }
- <?php endif; ?>
- <?php if( pinboard_get_option( 'hide_footer_area' ) ) : ?>
- @media screen and (max-width: 760px) {
- #footer-area {
- display: none;
- }
- }
- <?php endif; ?>
- <?php if( $default_options['page_background'] != pinboard_get_option( 'page_background' ) ) : ?>
- #wrapper {
- background: <?php echo esc_attr( pinboard_get_option( 'page_background' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['menu_background'] != pinboard_get_option( 'menu_background' ) ) : ?>
- #access {
- background: <?php echo esc_attr( pinboard_get_option( 'menu_background' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['menu_item_hover_background'] != pinboard_get_option( 'menu_item_hover_background' ) ) : ?>
- #access a:hover,
- #access li.current_page_item > a,
- #access li.current-menu-item > a {
- background: <?php echo esc_attr( pinboard_get_option( 'menu_item_hover_background' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['sidebar_wide_background'] != pinboard_get_option( 'sidebar_wide_background' ) ) : ?>
- #sidebar-wide,
- #sidebar-footer-wide,
- #current-location {
- background: <?php echo esc_attr( pinboard_get_option( 'sidebar_wide_background' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['content_background'] != pinboard_get_option( 'content_background' ) ) : ?>
- .entry,
- #comments,
- #respond {
- background: <?php echo esc_attr( pinboard_get_option( 'content_background' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['post_meta_background'] != pinboard_get_option( 'post_meta_background' ) ) : ?>
- .home .entry-meta,
- .blog .entry-meta,
- .archive .entry-meta,
- .search .entry-meta {
- background: <?php echo esc_attr( pinboard_get_option( 'post_meta_background' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['footer_area_background'] != pinboard_get_option( 'footer_area_background' ) ) : ?>
- #footer-area {
- background: <?php echo esc_attr( pinboard_get_option( 'footer_area_background' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['footer_background'] != pinboard_get_option( 'footer_background' ) ) : ?>
- #copyright {
- background: <?php echo esc_attr( pinboard_get_option( 'footer_background' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['body_font'] != pinboard_get_option( 'body_font' ) ) : ?>
- body,
- #slider .entry-title,
- .page-title,
- #sidebar-wide .widget-title,
- #sidebar-boxes .widget-title,
- #sidebar-footer-wide .widget-title {
- font-family:<?php echo $fonts[pinboard_get_option( 'body_font' )]; ?>;
- }
- h1, h2, h3, h4, h5, h6,
- #site-title,
- #site-description,
- .entry-title,
- #comments-title,
- #reply-title,
- .widget-title {
- font-family:<?php echo $fonts[pinboard_get_option( 'headings_font' )]; ?>;
- }
- .entry-content {
- font-family:<?php echo $fonts[pinboard_get_option( 'content_font' )]; ?>;
- }
- <?php else : ?>
- <?php if( $default_options['headings_font'] != pinboard_get_option( 'headings_font' ) ) : ?>
- h1, h2, h3, h4, h5, h6 {
- font-family:<?php echo $fonts[pinboard_get_option( 'headings_font' )]; ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['content_font'] != pinboard_get_option( 'content_font' ) ) : ?>
- .entry-content {
- font-family:<?php echo $fonts[pinboard_get_option( 'content_font' )]; ?>;
- }
- <?php endif; ?>
- <?php endif; ?>
- <?php if( $default_options['body_font_size'] != pinboard_get_option( 'body_font_size' ) ) : ?>
- body {
- font-size:<?php echo pinboard_get_option( 'body_font_size' ) . pinboard_get_option( 'body_font_size_unit' ); ?>;
- line-height:<?php echo pinboard_get_option( 'body_line_height' ) . pinboard_get_option( 'body_line_height_unit' ); ?>;
- }
- <?php elseif( $default_options['body_line_height'] != pinboard_get_option( 'body_line_height' ) ) : ?>
- body {
- line-height:<?php echo pinboard_get_option( 'body_line_height' ) . pinboard_get_option( 'body_line_height_unit' ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['h1_font_size'] != pinboard_get_option( 'h1_font_size' ) ) : ?>
- h1,
- .single .entry-title,
- .page .entry-title,
- .error404 .entry-title {
- font-size:<?php echo pinboard_get_option( 'h1_font_size' ) . pinboard_get_option( 'h1_font_size_unit' ); ?>;
- line-height:<?php echo pinboard_get_option( 'headings_line_height' ) . pinboard_get_option( 'headings_line_height_unit' ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['h2_font_size'] != pinboard_get_option( 'h2_font_size' ) ) : ?>
- h2,
- .entry-title {
- font-size:<?php echo pinboard_get_option( 'h2_font_size' ) . pinboard_get_option( 'h2_font_size_unit' ); ?>;
- line-height:<?php echo pinboard_get_option( 'headings_line_height' ) . pinboard_get_option( 'headings_line_height_unit' ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['h3_font_size'] != pinboard_get_option( 'h3_font_size' ) ) : ?>
- h3,
- .teaser .entry-title {
- font-size:<?php echo pinboard_get_option( 'h3_font_size' ) . pinboard_get_option( 'h3_font_size_unit' ); ?>;
- line-height:<?php echo pinboard_get_option( 'headings_line_height' ) . pinboard_get_option( 'headings_line_height_unit' ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['h4_font_size'] != pinboard_get_option( 'h4_font_size' ) ) : ?>
- h4 {
- font-size:<?php echo pinboard_get_option( 'h4_font_size' ) . pinboard_get_option( 'h4_font_size_unit' ); ?>;
- line-height:<?php echo pinboard_get_option( 'headings_line_height' ) . pinboard_get_option( 'headings_line_height_unit' ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['headings_line_height'] != pinboard_get_option( 'headings_line_height' ) ) : ?>
- h1, h2, h3, h4, h5, h6 {
- line-height:<?php echo pinboard_get_option( 'headings_line_height' ) . pinboard_get_option( 'headings_line_height_unit' ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['content_font_size'] != pinboard_get_option( 'content_font_size' ) ) : ?>
- .entry-content {
- font-size:<?php echo pinboard_get_option( 'content_font_size' ) . pinboard_get_option( 'content_font_size_unit' ); ?>;
- line-height:<?php echo pinboard_get_option( 'content_line_height' ) . pinboard_get_option( 'content_line_height_unit' ); ?>;
- }
- @media screen and (max-width: 640px) {
- .entry-content {
- font-size:<?php echo pinboard_get_option( 'mobile_font_size' ) . pinboard_get_option( 'content_font_size_unit' ); ?>;
- line-height:<?php echo pinboard_get_option( 'mobile_line_height' ) . pinboard_get_option( 'content_line_height_unit' ); ?>;
- }
- }
- <?php elseif( $default_options['content_line_height'] != pinboard_get_option( 'content_line_height' ) ) : ?>
- .entry-content {
- line-height:<?php echo pinboard_get_option( 'content_line_height' ) . pinboard_get_option( 'content_line_height' ); ?>;
- }
- @media screen and (max-width: 640px) {
- .entry-content {
- font-size:<?php echo pinboard_get_option( 'mobile_font_size' ) . pinboard_get_option( 'mobile_font_size_unit' ); ?>;
- line-height:<?php echo pinboard_get_option( 'mobile_line_height' ) . pinboard_get_option( 'mobile_line_height_unit' ); ?>;
- }
- }
- <?php elseif( $default_options['mobile_font_size'] != pinboard_get_option( 'mobile_font_size' ) ) : ?>
- @media screen and (max-width: 640px) {
- .entry-content {
- font-size:<?php echo pinboard_get_option( 'mobile_font_size' ) . pinboard_get_option( 'mobile_font_size_unit' ); ?>;
- line-height:<?php echo pinboard_get_option( 'mobile_line_height' ) . pinboard_get_option( 'mobile_line_height_unit' ); ?>;
- }
- }
- <?php elseif( $default_options['mobile_line_height'] != pinboard_get_option( 'mobile_line_height' ) ) : ?>
- @media screen and (max-width: 640px) {
- .entry-content {
- line-height:<?php echo pinboard_get_option( 'mobile_line_height' ) . pinboard_get_option( 'mobile_line_height_unit' ); ?>;
- }
- }
- <?php endif; ?>
- <?php if( $default_options['body_color'] != pinboard_get_option( 'body_color' ) ) : ?>
- body {
- color:<?php echo esc_attr( pinboard_get_option( 'body_color' ) ); ?>;
- }
- h1, h2, h3, h4, h5, h6,
- .entry-title,
- .entry-title a {
- color:<?php echo esc_attr( pinboard_get_option( 'headings_color' ) ); ?>;
- }
- .entry-content {
- color:<?php echo pinboard_get_option( 'content_color' ); ?>;
- }
- <?php else : ?>
- <?php if( $default_options['headings_color'] != pinboard_get_option( 'headings_color' ) ) : ?>
- h1, h2, h3, h4, h5, h6,
- .entry-title,
- .entry-title a {
- color:<?php echo esc_attr( pinboard_get_option( 'headings_color' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['content_color'] != pinboard_get_option( 'content_color' ) ) : ?>
- .entry-content {
- color:<?php echo esc_attr( pinboard_get_option( 'content_color' ) ); ?>;
- }
- <?php endif; ?>
- <?php endif; ?>
- <?php if( $default_options['links_color'] != pinboard_get_option( 'links_color' ) ) : ?>
- a {
- color:<?php echo esc_attr( pinboard_get_option( 'links_color' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['links_hover_color'] != pinboard_get_option( 'links_hover_color' ) ) : ?>
- a:hover {
- color:<?php echo esc_attr( pinboard_get_option( 'links_hover_color' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['menu_color'] != pinboard_get_option( 'menu_color' ) ) : ?>
- #access a {
- color:<?php echo esc_attr( pinboard_get_option( 'menu_color' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['menu_hover_color'] != pinboard_get_option( 'menu_hover_color' ) ) : ?>
- #access a:hover,
- #access li.current_page_item > a {
- color:<?php echo esc_attr( pinboard_get_option( 'menu_hover_color' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['sidebar_color'] != pinboard_get_option( 'sidebar_color' ) ) : ?>
- #sidebar,
- #sidebar-left,
- #sidebar-right {
- color:<?php echo esc_attr( pinboard_get_option( 'sidebar_color' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['sidebar_title_color'] != pinboard_get_option( 'sidebar_title_color' ) ) : ?>
- .widget-title {
- color:<?php echo esc_attr( pinboard_get_option( 'sidebar_title_color' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['sidebar_links_color'] != pinboard_get_option( 'sidebar_links_color' ) ) : ?>
- .widget-area a {
- color:<?php echo esc_attr( pinboard_get_option( 'sidebar_links_color' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['footer_color'] != pinboard_get_option( 'footer_color' ) ) : ?>
- #footer-area {
- color:<?php echo esc_attr( pinboard_get_option( 'footer_color' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['footer_title_color'] != pinboard_get_option( 'footer_title_color' ) ) : ?>
- #footer-area .widget-title {
- color:<?php echo esc_attr( pinboard_get_option( 'footer_title_color' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['copyright_color'] != pinboard_get_option( 'copyright_color' ) ) : ?>
- #copyright {
- color:<?php echo esc_attr( pinboard_get_option( 'copyright_color' ) ); ?>;
- }
- <?php endif; ?>
- <?php if( $default_options['copyright_links_color'] != pinboard_get_option( 'copyright_links_color' ) ) : ?>
- #copyright a {
- color:<?php echo esc_attr( pinboard_get_option( 'copyright_links_color' ) ); ?>;
- }
- <?php endif; ?>
- <?php echo esc_html( pinboard_get_option( 'user_css' ) ); ?>
- </style>
- <?php
- }
- endif;
- add_action( 'wp_head', 'pinboard_custom_styles' );
- if ( ! function_exists( 'pinboard_body_class' ) ) :
- /**
- * Adds template names to body_class filter
- *
- * The custom layouts are shared with the custom templates
- * and use the same style declarations
- * @since Pinboard 1.0
- */
- function pinboard_body_class( $classes ) {
- if( ! is_page_template() ) {
- $default_options = pinboard_default_options();
- if( 'sidebar-content' == pinboard_get_option( 'layout' ) )
- $classes[] = 'page-template-template-sidebar-content-php';
- elseif( 'sidebar-content-sidebar' == pinboard_get_option( 'layout' ) )
- $classes[] = 'page-template-template-sidebar-content-sidebar-php';
- elseif( 'content-sidebar-half' == pinboard_get_option( 'layout' ) )
- $classes[] = 'page-template-template-content-sidebar-half-php';
- elseif( 'sidebar-content-half' == pinboard_get_option( 'layout' ) )
- $classes[] = 'page-template-template-sidebar-content-half-php';
- elseif( ( 'no-sidebars' == pinboard_get_option( 'layout' ) ) || ( ! is_active_sidebar( 2 ) && ! is_active_sidebar( 3 ) && ! is_active_sidebar( 4 ) && ! is_active_sidebar( 5 ) ) )
- $classes[] = 'page-template-template-no-sidebars-php';
- elseif( 'full-width' == pinboard_get_option( 'layout' ) )
- $classes[] = 'page-template-template-full-width-php';
- }
- return $classes;
- }
- endif;
- add_filter( 'body_class', 'pinboard_body_class' );
- if ( ! function_exists( 'pinboard_doc_title' ) ) :
- /**
- * Output the <title> tag
- *
- * @since Pinboard 1.0
- */
- function pinboard_doc_title( $doc_title ) {
- global $page, $paged;
- $doc_title = str_replace( '»', '', $doc_title );
- $site_description = get_bloginfo( 'description', 'display' );
- $separator = '#124';
- if ( is_singular() ) {
- if( is_front_page() )
- $doc_title .= get_the_title();
- if ( $paged >= 2 || $page >= 2 )
- $doc_title .= ', ' . __( 'Page', 'pinboard' ) . ' ' . max( $paged, $page );
- } else {
- if( ! is_home() )
- $doc_title .= ' &' . $separator . '; ';
- $doc_title .= get_bloginfo( 'name' );
- if ( $paged >= 2 || $page >= 2 )
- $doc_title .= ', ' . __( 'Page', 'pinboard' ) . ' ' . max( $paged, $page );
- }
- if ( ( is_home() ) && $site_description )
- $doc_title .= ' &' . $separator . '; ' . $site_description;
- return $doc_title;
- }
- endif;
- add_filter( 'wp_title', 'pinboard_doc_title' );
- if ( ! function_exists( 'pinboard_current_location' ) ) :
- /**
- * Highlight current location in the archive
- *
- * @since Pinboard 1.0
- */
- function pinboard_current_location() {
- global $pinboard_page_template;
- if ( ! ( is_home() && ! is_paged() ) && ! is_singular() || isset( $pinboard_page_template ) ) {
- if( is_author() )
- $archive = 'author';
- elseif( is_category() || is_tag() ) {
- $archive = get_queried_object()->taxonomy;
- $archive = str_replace( 'post_', '', $archive );
- } else
- $archive = ''; ?>
- <hgroup id="current-location">
- <h6 class="prefix-text"><?php _e( 'Currently browsing', 'pinboard' ); ?> <?php echo $archive; ?></h6>
- <<?php pinboard_title_tag( 'location' ); ?> class="page-title">
- <?php if( isset( $pinboard_page_template ) ) {
- echo the_title();
- } elseif( is_search() ) {
- __( 'Search results for', 'pinboard' ) . ': "' . get_search_query() . '"';
- } elseif( is_author() ) {
- $author = get_userdata( get_query_var( 'author' ) );
- echo $author->display_name;
- } elseif ( is_year() ) {
- echo get_query_var( 'year' );
- } elseif ( is_month() ) {
- echo get_the_time( 'F Y' );
- } elseif ( is_day() ) {
- echo get_the_time( 'F j, Y' );
- } else {
- single_term_title( '' );
- }
- if( is_paged() ) {
- global $page, $paged;
- if( ! is_home() )
- echo ', ';
- echo sprintf( __( 'Page