<?php
$themename = "Breath";
$adminmenuname = "Breath";
$shortname = "am";
define('SHORTNAME','am');
locate_template(array('backend/setup.php'), true, true);
locate_template(array('inc/tweaks.php'), true, true);
locate_template(array('inc/sidebar-generator.php'), true, true);
locate_template(array('inc/posts_type.php'), true, true);
locate_template(array('inc/sliders_type.php'), true, true);
locate_template(array('inc/portfolios_type.php'), true, true);
locate_template(array('inc/portfolios_tax.php'), true, true);
locate_template(array('inc/breadcrumbs.php'), true, true);
locate_template(array('inc/widgets.php'), true, true);
locate_template(array('inc/twitter.php'), true, true);
locate_template(array('inc/shortcodes.php'), true, true);
//
load_theme_textdomain( 'breath', get_template_directory() );
//
if ( function_exists('wp_nav_menu') ) {
add_theme_support( 'menus' );
function register_th_menus() {
register_nav_menus(
array(
'header-menu' => __( 'Header Menu', 'breath' ),
'footer-menu' => __( 'Footer Menu', 'breath' )
)
);
}
add_action( 'init', 'register_th_menus' );
}
//
add_theme_support('post-thumbnails');
//
add_theme_support( 'automatic-feed-links' );
//
add_editor_style();
//
add_filter('widget_text', 'do_shortcode');
//
if ( ! isset( $content_width ) ) $content_width = 920;
//
register_sidebar(array(
'id' => 'default-sidebar',
'description' => __( 'The default sidebar!', 'breath'),
'name' => 'Default sidebar',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>',
));
register_sidebar(array(
'id' => 'footer-1',
'name' => 'Footer Column 1',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
register_sidebar(array(
'id' => 'footer-2',
'name' => 'Footer Column 2',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
register_sidebar(array(
'id' => 'footer-3',
'name' => 'Footer Column 3',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
register_sidebar(array(
'id' => 'footer-4',
'name' => 'Footer Column 4',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
register_sidebar(array(
'id' => 'footer-additional-1',
'name' => 'Footer Additional Line Column 1',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
register_sidebar(array(
'id' => 'footer-additional-2',
'name' => 'Footer Additional Line Column 2',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
register_sidebar(array(
'id' => 'footer-additional-3',
'name' => 'Footer Additional Line Column 3',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
register_sidebar(array(
'id' => 'footer-additional-4',
'name' => 'Footer Additional Line Column 4',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
//print scripts
add_action('init', 'am_register_scripts');
add_action('wp_footer', 'am_print_scripts');
function am_register_scripts() {
wp_register_script('modernizer', get_template_directory_uri() .'/js/modernizr.min.js', array('jquery'), null);
wp_register_script('validate', get_template_directory_uri() .'/js/validate/jquery.validate.min.js', array('jquery'), null, true);
wp_register_script('jui', get_template_directory_uri() .'/js/jquery-ui.min.js', array('jquery'), null, true);
wp_register_script('jcycle', get_template_directory_uri() .'/js/jcycle/jquery.cycle.all.js', array('jquery'), null,true);
wp_register_script('superfish', get_template_directory_uri() .'/js/superfish/superfish.js', array('jquery'), null,true);
wp_register_script('prettyphoto', get_template_directory_uri() .'/js/prettyphoto/js/jquery.prettyPhoto.php', array('jquery'), null,true);
wp_register_script('isotope', get_template_directory_uri() .'/js/isotope/jquery.isotope.min.js', array('jquery'), null,true);
wp_register_script('th_scripts', get_template_directory_uri() .'/js/script.php', array('jquery'), null,true);
wp_register_script('preview', get_template_directory_uri() .'/js/preview.php', array('jquery'), null,true);
wp_register_script('th-colorpicker', get_template_directory_uri() .'/backend/js/mColorPicker/javascripts/mColorPicker.php', array('jquery'), null, true);
if(!is_admin() && !in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) )){
wp_enqueue_script('modernizer');
wp_enqueue_script('superfish');
wp_enqueue_script('prettyphoto');
if( get_option(SHORTNAME."_preview") != '') {
wp_enqueue_script('preview');
wp_enqueue_script('th-colorpicker');
}
}
}
function am_print_scripts() {
global $am_carousel, $am_isotope, $am_validate, $am_jcycle, $am_tabs;
if ( $am_jcycle ) { wp_print_scripts('jcycle'); }
if ( $am_isotope ) { wp_print_scripts('isotope'); }
if ( $am_validate ) { wp_print_scripts('validate'); }
if ( $am_tabs ) { wp_print_scripts('jui'); }
wp_print_scripts('th_scripts');
}
function am_add_styles() {
global $gfont;
if(!is_admin()){
wp_enqueue_style( 'main', get_template_directory_uri() .'/css/main.css','',null, 'all');
wp_enqueue_style( 'skin', get_template_directory_uri() .'/css/styles.php','',null, 'all');
wp_enqueue_style( 'prettyphoto', get_template_directory_uri() .'/js/prettyphoto/css/prettyPhoto.css','',null, 'screen');
}
}
add_action('wp_print_styles', 'am_add_styles');
//
function imgsrc_original() {
global $post;
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
$image_attributes = wp_get_attachment_image_src($post_thumbnail_id, 'full');
$imgsrc = $image_attributes[0];
echo $imgsrc;
}
//
define('ICL_AFFILIATE_ID', 7410);
define('ICL_AFFILIATE_KEY', '52286484063b643175cdfd8e743f1448');
include "wpml-integration.php";
wpml_register_string('breath', 'copyright', stripslashes(get_option(SHORTNAME."_copyright")));
wpml_register_string('breath', 'maptitle', stripslashes(get_option(SHORTNAME."_maptitle")));
wpml_register_string('breath', 'formtitle', stripslashes(get_option(SHORTNAME."_formtitle")));
wpml_register_string('breath', 'contact_form_add1', get_option(SHORTNAME."_formadd1"));
wpml_register_string('breath', 'contact_form_add2', get_option(SHORTNAME."_formadd2"));
wpml_register_string('breath', 'contact_form_add3', get_option(SHORTNAME."_formadd3"));
wpml_register_string('breath', 'contact_form_add4', get_option(SHORTNAME."_formadd4"));
wpml_register_string('breath', 'contact_form_add5', get_option(SHORTNAME."_formadd5"));
wpml_register_string('breath', 'teaser_readmore_1', get_option(SHORTNAME."_teaser_readmore_1"));
wpml_register_string('breath', 'teaser_readmore_2', get_option(SHORTNAME."_teaser_readmore_1"));
wpml_register_string('breath', 'teaser_readmore_3', get_option(SHORTNAME."_teaser_readmore_1"));
wpml_register_string('breath', 'teaser_readmore_4', get_option(SHORTNAME."_teaser_readmore_1"));
function language_selector_flags(){
if(function_exists('icl_get_languages')) {
$languages = icl_get_languages('skip_missing=0');
if(!empty($languages)){ ?>
<ul class="languages">
<?php
foreach($languages as $l){
if($l['active']) echo '<li>';
if(!$l['active']) echo '<li><a href="'.$l['url'].'">';
echo '<img src="'.$l['country_flag_url'].'" alt="'.$l['language_code'].'" title="'.$l['native_name'].'" />';
if(!$l['active']) echo '</a></li>';
if($l['active']) echo '</li>';
}
?> </ul> <?php
}
}
}
function wpml_page_id($id){
if(function_exists('icl_object_id')) {
return icl_object_id($id,'page',true);
} else {
return $id;
}
}
function wpml_post_id($id){
if(function_exists('icl_object_id')) {
return icl_object_id($id,'post',true);
} else {
return $id;
}
}
function wpml_cat_id($id){
if(function_exists('icl_object_id')) {
return icl_object_id($id,'category',true);
} else {
return $id;
}
}
//
function list_comments($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
<div id="comment-<?php comment_ID(); ?>" class="comment-body">
<div class="avatars"><?php echo get_avatar($comment,$size='75'); ?></div>
<div class="comment-text">
<div class="comment-meta">
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
<?php printf('<cite class="fn">%s</cite>', get_comment_author_link()) ?>
<span><?php printf(__('Posted on %1$s at %2$s', 'breath'), get_comment_date(), get_comment_time()) ?></span> <span>|</span> <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>" class="comment-date"><?php _e('Permalink', 'breath') ?></a>
</div>
<?php comment_text() ?>
<?php if ($comment->comment_approved == '0') : ?>
<em><?php _e('Your comment is awaiting moderation.', 'breath') ?></em>
<?php endif; ?>
</div>
</div>
<?php }
//
function skin_body_class($classes) {
if( get_option(SHORTNAME."_colorskin") != '') { $stylecolor = get_option(SHORTNAME."_colorskin"); } else {$stylecolor = "blue"; }
$classes[] = $stylecolor;
return $classes;
}
add_filter('body_class', 'skin_body_class');
// Menu walker
class Sub_Menu_Walker extends Walker_Nav_Menu{
function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) {
if ( !$element )
return;
$id_field = $this->db_fields['id'];
//display this element
if ( is_array( $args[0] ) )
$args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] );
//Adds the 'parent' class to the current item if it has children
if( ! empty( $children_elements[$element->$id_field] ) )
array_push($element->classes,'dropdown');
$cb_args = array_merge( array(&$output, $element, $depth), $args);
call_user_func_array(array(&$this, 'start_el'), $cb_args);
$id = $element->$id_field;
// descend only when the depth is right and there are childrens for this element
if ( ($max_depth == 0 || $max_depth > $depth+1 ) && isset( $children_elements[$id]) ) {
foreach( $children_elements[ $id ] as $child ){
if ( !isset($newlevel) ) {
$newlevel = true;
//start the child delimiter
$cb_args = array_merge( array(&$output, $depth), $args);
call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
}
$this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
}
unset( $children_elements[ $id ] );
}
if ( isset($newlevel) && $newlevel ){
//end the child delimiter
$cb_args = array_merge( array(&$output, $depth), $args);
call_user_func_array(array(&$this, 'end_lvl'), $cb_args);
}
//end this element
$cb_args = array_merge( array(&$output, $element, $depth), $args);
call_user_func_array(array(&$this, 'end_el'), $cb_args);
}
}
//thumbnails
add_image_size('related', 75, 75, true);
add_image_size('recent_posts', 70, 45, true);
add_image_size('portfolio_widget', 110, 110, true);
add_image_size('portfolio_small_sidebar', 177, 158, true);
add_image_size('portfolio_small', 204, 158, true);
add_image_size('portfolio_medium', 284, 158, true);
add_image_size('portfolio_big_sidebar', 324, 248, true);
add_image_size('carousel_image', 524, 295, true);
add_image_size('portfolio_item_sidebar', 604, 390, true);
add_image_size('post_thumbnail', 604, 180, true);
add_image_size('portfolio_big', 634, 248, true);
add_image_size('portfolio_item', 924, 390, true);
add_image_size('post_thumbnail_full', 924, 275, true);
//default sizes
add_image_size('thumbnail', 150, 150, true);
add_image_size('medium', 604, 0);
add_image_size('large', 924, 0);
//
if( !is_admin() ){
add_action( 'pre_get_posts', 'set_per_page' );
}
function set_per_page( $query ) {
global $wp_the_query;
if($query->is_tax('th_portfolios_cat')&&($query === $wp_the_query)){
$query->set( 'posts_per_page', 1);
}
return $query;
}
?>