'fffff',
'wp-head-callback' => '_custom_background_cb'
);
add_theme_support( 'custom-background', $args );
// Make theme available for translation
// Translations can be filed in the /languages/ directory
load_theme_textdomain( 'agency', get_template_directory() . '/languages' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => __( 'Primary Navigation', 'agency' ),
) );
}
endif;
?>
'',
'default-text-color' => '000000',
'width' => 220,
'height' => 75,
'flex-height' => true,
'wp-head-callback' => 'agency_header_style',
'admin-head-callback' => 'agency_admin_header_style',
'admin-preview-callback' => 'agency_admin_header_image',
);
$args = apply_filters( 'agency_custom_header_args', $args );
if ( function_exists( 'wp_get_theme' ) ) {
add_theme_support( 'custom-header', $args );
} else {
// Compat: Versions of WordPress prior to 3.4.
define( 'HEADER_TEXTCOLOR', $args['default-text-color'] );
define( 'HEADER_IMAGE', $args['default-image'] );
define( 'HEADER_IMAGE_WIDTH', $args['width'] );
define( 'HEADER_IMAGE_HEIGHT', $args['height'] );
add_custom_image_header( $args['wp-head-callback'], $args['admin-head-callback'], $args['admin-preview-callback'] );
}
}
add_action( 'after_setup_theme', 'agency_custom_header_setup' );
/**
* Shiv for get_custom_header().
*
* get_custom_header() was introduced to WordPress
* in version 3.4. To provide backward compatibility
* with previous versions, we will define our own version
* of this function.
*
* @todo Remove this function when WordPress 3.6 is released.
* @return stdClass All properties represent attributes of the curent header image.
*
* @package agency_s
*/
if ( ! function_exists( 'get_custom_header' ) ) {
function get_custom_header() {
return (object) array(
'url' => get_header_image(),
'thumbnail_url' => get_header_image(),
'width' => HEADER_IMAGE_WIDTH,
'height' => HEADER_IMAGE_HEIGHT,
);
}
}
if ( ! function_exists( 'agency_header_style' ) ) :
/**
* Styles the header image and text displayed on the blog
*
* @see _s_custom_header_setup().
*/
function agency_header_style() {
// If no custom options for text are set, let's bail
// get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value
if ( HEADER_TEXTCOLOR == get_header_textcolor() )
return;
// If we get this far, we have custom styles. Let's do this.
?>
Header admin panel.
*
* @see _s_custom_header_setup().
*/
function agency_admin_header_style() {
?>
Header admin panel.
*
* @see agency_s_custom_header_setup().
*/
function agency_admin_header_image() { ?>
id="li-comment-">
__( 'Primary Widget Area', 'agency' ),
'id' => 'primary-widget-area',
'description' => __( 'The primary widget area', 'agency' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 3, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'First Footer Widget Area', 'agency' ),
'id' => 'first-footer-widget-area',
'description' => __( 'The first footer widget area', 'agency' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 4, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'Second Footer Widget Area', 'agency' ),
'id' => 'second-footer-widget-area',
'description' => __( 'The second footer widget area', 'agency' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 5, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'Third Footer Widget Area', 'agency' ),
'id' => 'third-footer-widget-area',
'description' => __( 'The third footer widget area', 'agency' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
// Area 6, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'Fourth Footer Widget Area', 'agency' ),
'id' => 'fourth-footer-widget-area',
'description' => __( 'The fourth footer widget area', 'agency' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
}
if ( ! function_exists( 'agency_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post—date/time and author.
*/
function agency_posted_on() {
printf( __( '%2$s by %3$s', 'agency' ),
'meta-prep meta-prep-author',
sprintf( '%3$s',
get_permalink(),
esc_attr( get_the_time() ),
get_the_date()
),
sprintf( '%3$s',
get_author_posts_url( get_the_author_meta( 'ID' ) ),
sprintf( esc_attr__( 'View all posts by %s', 'agency' ), get_the_author() ),
get_the_author()
)
);
}
endif;
/** Register sidebars by running agency_widgets_init() on the widgets_init hook. */
add_action( 'widgets_init', 'agency_widgets_init' );
/** Excerpt */
function agency_excerpt_length( $length ) {
return 30;
}
add_filter( 'excerpt_length', 'agency_excerpt_length' );
function agency_auto_excerpt_more( $more ) {
return ' …' ;
}
add_filter( 'excerpt_more', 'agency_auto_excerpt_more' );
/*-----------------------------------------------------------------------------------*/
/* Exclude categories from displaying on the "Blog" page template.
/*-----------------------------------------------------------------------------------*/
// Exclude categories on the "Blog" page template.
add_filter( 'agency_blog_template_query_args', 'agency_exclude_categories_blogtemplate' );
function agency_exclude_categories_blogtemplate ( $args ) {
if ( ! function_exists( 'agency_prepare_category_ids_from_option' ) ) { return $args; }
$excluded_cats = array();
// Process the category data and convert all categories to IDs.
$excluded_cats = agency_prepare_category_ids_from_option( 'exclude_cat' );
if ( count( $excluded_cats ) > 0 ) {
// Setup the categories as a string, because "category__not_in" doesn't seem to work
// when using query_posts().
foreach ( $excluded_cats as $k => $v ) { $excluded_cats[$k] = '-' . $v; }
$cats = join( ',', $excluded_cats );
$args['cat'] = $cats;
}
return $args;
}
/*-----------------------------------------------------------------------------------*/
/* agency_prepare_category_ids_from_option()
/*-----------------------------------------------------------------------------------*/
if ( ! function_exists( 'agency_prepare_category_ids_from_option' ) ) {
function agency_prepare_category_ids_from_option ( $option ) {
$cats = array();
$stored_cats = of_get_option( $option );
$cats_raw = explode( ',', $stored_cats );
if ( is_array( $cats_raw ) && ( count( $cats_raw ) > 0 ) ) {
foreach ( $cats_raw as $k => $v ) {
$value = trim( $v );
if ( is_numeric( $value ) ) {
$cats_raw[$k] = $value;
} else {
$cat_obj = get_category_by_slug( $value );
if ( isset( $cat_obj->term_id ) ) {
$cats_raw[$k] = $cat_obj->term_id;
}
}
$cats = $cats_raw;
}
}
return $cats;
}
}
// custom function
function agency_head_css() {
$output = '';
$custom_css = of_get_option('custom_css');
if ($custom_css <> '') {
$output .= $custom_css . "\n";
}
// Output styles
if ($output <> '') {
$output = "\n\n";
echo $output;
}
}
add_action('wp_head', 'agency_head_css');
function agency_date_on() {
printf( __( 'Posted on %2$s', 'agency' ),
'meta-prep meta-prep-author',
sprintf( '%3$s',
get_permalink(),
esc_attr( get_the_time() ),
get_the_date()
)
);
}
/** filter function for wp_title */
function agency_filter_wp_title( $old_title, $sep, $sep_location ){
// add padding to the sep
$ssep = ' ' . $sep . ' ';
// find the type of index page this is
if( is_category() ) $insert = $ssep . 'Category';
elseif( is_tag() ) $insert = $ssep . 'Tag';
elseif( is_author() ) $insert = $ssep . 'Author';
elseif( is_year() || is_month() || is_day() ) $insert = $ssep . 'Archives';
else $insert = NULL;
// get the page number we're on (index)
if( get_query_var( 'paged' ) )
$num = $ssep . 'page ' . get_query_var( 'paged' );
// get the page number we're on (multipage post)
elseif( get_query_var( 'page' ) )
$num = $ssep . 'page ' . get_query_var( 'page' );
// else
else $num = NULL;
// concoct and return new title
return get_bloginfo( 'name' ) . $insert . $old_title . $num;
}
// call our custom wp_title filter, with normal (10) priority, and 3 args
add_filter( 'wp_title', 'agency_filter_wp_title', 10, 3 );
function agency_of_register_js() {
if (!is_admin()) {
wp_register_script('superfish', get_template_directory_uri() . '/js/superfish.js', 'jquery', '1.0', TRUE);
wp_register_script('agency_custom', get_template_directory_uri() . '/js/jquery.custom.js', 'jquery', '1.0', TRUE);
wp_register_script('fitvids', get_template_directory_uri() . '/js/jquery.fitvids.js', 'jquery', '1.0', TRUE);
wp_register_script('selectnav', get_template_directory_uri() . '/js/selectnav.js', 'jquery', '0.1', TRUE);
wp_register_script('flexslider', get_template_directory_uri() . '/js/jquery.flexslider.js', 'jquery', '2.1', TRUE);
wp_register_script('modernizr', get_template_directory_uri() . '/js/modernizr.js', 'jquery', '2.6.1', false);
wp_register_script('responsive', get_template_directory_uri() . '/js/responsive-scripts.js', 'jquery', '1.2.1', TRUE);
wp_enqueue_script('jquery');
wp_enqueue_script('superfish');
wp_enqueue_script('agency_custom');
wp_enqueue_script('fitvids');
wp_enqueue_script('flexslider');
wp_enqueue_script('selectnav');
wp_enqueue_script('modernizr');
wp_enqueue_script('responsive');
}
}
add_action('wp_enqueue_scripts', 'agency_of_register_js');
function agency_of_single_scripts() {
if(is_singular()) wp_enqueue_script( 'comment-reply' ); // loads the javascript required for threaded comments
}
add_action('wp_print_scripts', 'agency_of_single_scripts');
function agency_of_styles() {
wp_register_style( 'superfish', get_template_directory_uri() . '/css/superfish.css' );
wp_register_style( 'flexslider', get_template_directory_uri() . '/css/flexslider.css' );
wp_register_style( 'foundation', get_template_directory_uri() . '/css/foundation.css' );
wp_enqueue_style( 'superfish' );
wp_enqueue_style( 'flexslider' );
wp_enqueue_style( 'foundation' );
}
add_action('wp_enqueue_scripts', 'agency_of_styles');
/** redirect */
// include panel file.
if ( !function_exists( 'optionsframework_init' ) ) {
/*-----------------------------------------------------------------------------------*/
/* Options Framework Theme
/*-----------------------------------------------------------------------------------*/
/* Set the file path based on whether the Options Framework Theme is a parent theme or child theme */
if ( get_stylesheet_directory() == get_template_directory_uri() ) {
define('OPTIONS_FRAMEWORK_URL', get_template_directory() . '/admin/');
define('OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/admin/');
} else {
define('OPTIONS_FRAMEWORK_URL', get_template_directory() . '/admin/');
define('OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/admin/');
}
require_once (OPTIONS_FRAMEWORK_URL . 'options-framework.php');
}