'Topbar',
'header' => 'Header',
'footer' => 'Footer',
) );
}
add_action( 'after_setup_theme', 'hueman_setup' );
/* Register sidebars
/* ------------------------------------ */
function hueman_sidebars() {
register_sidebar( array(
'name' => 'Primary',
'id' => 'primary',
'description' => "Normal full width sidebar",
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => 'Secondary',
'id' => 'secondary',
'description' => "Normal full width sidebar",
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => 'Footer 1',
'id' => 'footer-1',
'description' => "Widgetized footer",
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => 'Footer 2',
'id' => 'footer-2',
'description' => "Widgetized footer",
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => 'Footer 3',
'id' => 'footer-3',
'description' => "Widgetized footer",
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => 'Footer 4',
'id' => 'footer-4',
'description' => "Widgetized footer",
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
}
add_action( 'widgets_init', 'hueman_sidebars' );
/* Enqueue javascript
/* ------------------------------------ */
function hueman_scripts() {
wp_enqueue_script( 'flexslider', get_template_directory_uri() . '/js/jquery.flexslider.min.js', array( 'jquery' ), '2.2.0', false );
wp_enqueue_script( 'scripts', get_template_directory_uri() . '/js/scripts.js', array( 'jquery' ), '1.3.6', true );
if ( is_singular() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'hueman_scripts' );
/* Enqueue css
/* ------------------------------------ */
function hueman_styles() {
wp_enqueue_style( 'style', get_stylesheet_uri() );
wp_enqueue_style( 'responsive', get_template_directory_uri().'/responsive.css' );
wp_enqueue_style( 'font-awesome', get_template_directory_uri().'/fonts/font-awesome.min.css' );
}
add_action( 'wp_enqueue_scripts', 'hueman_styles' );
/* ------------------------------------------------------------------------- *
* Template functions
/* ------------------------------------------------------------------------- */
/* Layout class
/* ------------------------------------ */
function hueman_layout_class() {
// Default layout
$layout = 'col-3cm';
// @todo: Set up layout option
$layout = get_theme_mod( 'hueman_layout', $layout );
// Return layout class
return $layout;
}
/* Social links
/* ------------------------------------ */
function hueman_social_links() {}
/* Page title
/* ------------------------------------ */
function hueman_page_title() {
global $post;
$heading = get_post_meta( $post->ID, '_heading', true );
$subheading = get_post_meta( $post->ID, '_subheading', true );
$title = $heading? $heading: the_title();
if ( $subheading ) {
$title = $title.' '.$subheading.'';
}
return $title;
}
/* Blog title
/* ------------------------------------ */
function hueman_blog_title() {
global $post;
// @todo: think about this
$title = get_bloginfo('name');
$title .= ' '. get_bloginfo('description') .'';
return $title;
}
/* Get images attached to post
/* ------------------------------------ */
function hueman_post_images( $args=array() ) {
global $post;
$defaults = array(
'numberposts' => -1,
'order' => 'ASC',
'orderby' => 'menu_order',
'post_mime_type' => 'image',
'post_parent' => $post->ID,
'post_type' => 'attachment',
);
$args = wp_parse_args( $args, $defaults );
return get_posts( $args );
}
/**
* Prints HTML with meta information for the current post author.
*/
function hueman_posted_by() {
printf(
__( 'by %1$s', 'hueman' ),
sprintf( '%2$s',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_html( get_the_author() )
)
);
}
/**
* Generate a class for use in CSS, depending on number of active footer widget areas.
*/
function hueman_get_footer_class(){
$total = 0;
if ( is_active_sidebar( 'footer-1' ) ){
$total++;
}
if ( is_active_sidebar( 'footer-2' ) ){
$total++;
}
if ( is_active_sidebar( 'footer-3' ) ){
$total++;
}
if ( is_active_sidebar( 'footer-4' ) ){
$total++;
}
if ( $total == 1) {
$class = 'one-full';
} elseif ( $total == 2) {
$class = 'one-half';
} elseif ( $total == 3) {
$class = 'one-third';
} elseif ( $total == 4) {
$class = 'one-fourth';
} else {
$class = 'hide-footer';
}
return $class;
}
/* ------------------------------------------------------------------------- *
* Filters
/* ------------------------------------------------------------------------- */
/* Body class
/* ------------------------------------ */
function hueman_body_class( $classes ) {
$classes[] = hueman_layout_class();
if ( has_nav_menu( 'topbar' ) ) {
$classes[] = 'topbar-enabled';
}
return $classes;
}
add_filter( 'body_class', 'hueman_body_class' );
/**
* Filters wp_title to print a neat tag based on what is being viewed.
*
* @param string $title Default title text for current view.
* @param string $sep Optional separator.
* @return string The filtered title.
*/
function hueman_wp_title( $title, $sep ) {
global $page, $paged;
if ( is_feed() ) {
return $title;
}
// Add the blog name
$title .= get_bloginfo( 'name' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) ) {
$title .= " $sep $site_description";
}
// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 ) {
$title .= " $sep " . sprintf( __( 'Page %s', 'hueman' ), max( $paged, $page ) );
}
return $title;
}
add_filter( 'wp_title', 'hueman_wp_title', 10, 2 );
/* Excerpt ending
/* ------------------------------------ */
function hueman_excerpt_more( $more ) {
return '…';
}
add_filter( 'excerpt_more', 'hueman_excerpt_more' );
/* Add wmode transparent to media embeds
/* ------------------------------------ */
function hueman_embed_wmode_transparent( $html, $url, $attr ) {
if ( strpos( $html, "