ID,'_wp_page_template',true); if (($layoutTemplate=='page-1col.php') || ($layoutTemplate=='page-2col-right.php') || ($layoutTemplate=='page-2col-left.php') || ($layoutTemplate=='page-3col.php') || ($layoutTemplate=='page-3col-left.php') || ($layoutTemplate=='page-3col-right.php')) return true; return false; } // from sandbox theme // Generates semantic classes for BODY element function mystique_body_class( $print = true ) { global $wp_query, $current_user; // Generic semantic classes for what type of content is displayed is_front_page() ? $c[] = 'home' : null; // For the front page, if set is_home() ? $c[] = 'blog' : null; // For the blog posts page, if set is_archive() ? $c[] = 'archive' : null; is_date() ? $c[] = 'date' : null; is_search() ? $c[] = 'search' : null; is_attachment() ? $c[] = 'attachment' : null; is_404() ? $c[] = 'not-found' : null; // CSS does not allow a digit as first character // Special classes for BODY element when a single post if ( is_single() ) { $postID = $wp_query->post->ID; the_post(); // Adds 'single' class and class with the post ID $c[] = 'single-post postid-' . $postID; // Adds category classes for each category on single posts if ( $cats = get_the_category() ) foreach ( $cats as $cat ) $c[] = 'category-' . $cat->slug; // Adds tag classes for each tags on single posts if ( $tags = get_the_tags() ) foreach ( $tags as $tag ) $c[] = 'tag-' . $tag->slug; // Adds author class for the post author $c[] = 'author-' . sanitize_title_with_dashes(strtolower(get_the_author_login())); rewind_posts(); } // Author name classes for BODY on author archives elseif ( is_author() ) { $author = $wp_query->get_queried_object(); $c[] = 'author'; $c[] = 'author-' . $author->user_nicename; } // Category name classes for BODY on category archvies elseif ( is_category() ) { $cat = $wp_query->get_queried_object(); $c[] = 'category'; $c[] = 'category-' . $cat->slug; } // Tag name classes for BODY on tag archives elseif ( is_tag() ) { $tags = $wp_query->get_queried_object(); $c[] = 'tag'; $c[] = 'tag-' . $tags->slug; } // Page author for BODY on 'pages' elseif ( is_page() ) { $pageID = $wp_query->post->ID; $page_children = wp_list_pages("child_of=$pageID&echo=0"); the_post(); $c[] = 'single-page pageid-' . $pageID; $c[] = 'author-' . sanitize_title_with_dashes(strtolower(get_the_author('login'))); // Checks to see if the page has children and/or is a child page; props to Adam if ( $page_children ) $c[] = 'page-parent'; if ( $wp_query->post->post_parent ) $c[] = 'page-child'; rewind_posts(); } // Search classes for results or no results elseif ( is_search() ) { the_post(); if ( have_posts() ) { $c[] = 'search-results'; } else { $c[] = 'search-no-results'; } rewind_posts(); } $layout = get_mystique_option('layout'); // layout if (is_page_template('page-1col.php') || (!isLayoutTemplate() && $layout=="col-1")) $c[] = 'col-1'; if (is_page_template('page-2col-left.php') || (!isLayoutTemplate() && $layout=='col-2-left')) $c[] = 'col-2-left'; if (is_page_template('page-2col-right.php') || (!isLayoutTemplate() && $layout=='col-2-right')) $c[] = 'col-2-right'; if (is_page_template('page-3col.php') || (!isLayoutTemplate() && $layout=='col-3')) $c[] = 'col-3'; if (is_page_template('page-3col-left.php') || (!isLayoutTemplate() && $layout=='col-3-left')) $c[] = 'col-3-left'; if (is_page_template('page-3col-right.php') || (!isLayoutTemplate() && $layout=='col-3-right')) $c[] = 'col-3-right'; // For when a visitor is logged in while browsing if ( $current_user->ID ) $c[] = 'loggedin'; // Separates classes with a single space, collates classes for BODY $c = join( ' ', apply_filters( 'body_class', $c ) ); // Available filter: body_class // And tada! return $print ? print($c) : $c; } function strip_content($content, $limit) { $content = apply_filters('the_content', $content); $content = strip_tags($content); $content = str_replace(']]>', ']]>', $content); $words = explode(' ', $content, ($limit + 1)); if(count($words) > $limit) { array_pop($words); //add a ... at last article when more than limit word count return implode(' ', $words) . '...'; } else { //otherwise return implode(' ', $words); } } function get_first_image() { global $post, $posts; $first_img = ''; $output = preg_match_all('//i', $post->post_content, $matches); $first_img = $matches [1][0]; return $first_img; } function canonical_for_comments() { global $cpage, $post; if ( $cpage > 1 ) : print "\n"; print "\n"; endif; } if(get_mystique_option('seo')) add_action( 'wp_head', 'canonical_for_comments' ); // check if sidebar has widgets function is_sidebar_active($index = 1) { global $wp_registered_sidebars; if (is_int($index)): $index = "sidebar-$index"; else : $index = sanitize_title($index); foreach ((array) $wp_registered_sidebars as $key => $value): if ( sanitize_title($value['name']) == $index): $index = $key; break; endif; endforeach; endif; $sidebars_widgets = wp_get_sidebars_widgets(); if (empty($wp_registered_sidebars[$index]) || !array_key_exists($index, $sidebars_widgets) || !is_array($sidebars_widgets[$index]) || empty($sidebars_widgets[$index])) return false; else return true; } // set up widget areas if ( function_exists('register_sidebar')) { register_sidebar(array( 'name' => 'Default sidebar', 'id' => 'sidebar-1', 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ' )); register_sidebar(array( 'name' => 'Secondary sidebar', 'id' => 'sidebar-2', 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ' )); register_sidebar(array( 'name' => 'Footer', 'id' => 'footer-1', 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ' )); register_sidebar(array( 'name' => 'Footer (slide 2)', 'id' => 'footer-2', 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ' )); register_sidebar(array( 'name' => 'Footer (slide 3)', 'id' => 'footer-3', 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ' )); register_sidebar(array( 'name' => 'Footer (slide 4)', 'id' => 'footer-4', 'before_widget' => '
  • ', 'after_widget' => '
  • ', 'before_title' => '

    ', 'after_title' => '

    ' )); } function shareThis(){ ?>
  • is added by WP // list comments function list_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; global $commentcount; if(!$commentcount) { $commentcount = 0; } ?>
  • id="comment-">
    '.get_comment_author().''; else $authorlink=''.get_comment_author().''; ?>#'.++$commentcount.'', $authorlink); ?>
    'comment-reply', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => __('Reply','mystique').$my_comment_count))); ?>
    comment_approved == '0'): ?>

    is added by WP } ?>