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 calorii_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', 'calorii' ), max( $paged, $page ) );
}
return $title;
}
add_filter( 'wp_title', 'calorii_wp_title', 10, 2 );
// Mark Posts/Pages as Untiled when no title is used
add_filter( 'the_title', 'calorii_title' );
function calorii_title( $title ) {
if ( $title == '' ) {
return 'Untitled';
} else {
return $title;
}
}
/**
* Sets the authordata global when viewing an author archive.
*
* This provides backwards compatibility with
* http://core.trac.wordpress.org/changeset/25574
*
* It removes the need to call the_post() and rewind_posts() in an author
* template to print information about the author.
*
* @global WP_Query $wp_query WordPress Query object.
* @return void
*/
function calorii_setup_author() {
global $wp_query;
if ( $wp_query->is_author() && isset( $wp_query->post ) ) {
$GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author );
}
}
add_action( 'wp', 'calorii_setup_author' );
/************* search form *****************/
// Search Form
function calorii_wpsearch( $form ) {
$form = '
';
return $form;
} // don't remove this bracket!
/****************** password protected post form *****/
add_filter( 'the_password_form', 'custom_password_form' );
function custom_password_form() {
global $post;
$label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
$o = '';
return $o;
}
// Add Bootstrap classes for table
add_filter( 'the_content', 'calorii_add_custom_table_class' );
function calorii_add_custom_table_class( $content ) {
return str_replace( '
';
}
}
endif;
if ( ! function_exists( 'calorii_featured_slider' ) ) :
/**
* Featured image slider, displayed on front page for static page and blog
*/
function calorii_featured_slider() {
if ( is_front_page() && of_get_option( 'calorii_slider_checkbox' ) == 1 ) {
echo '
';
echo '
';
$count = of_get_option( 'calorii_slide_number' );
$slidecat =of_get_option( 'calorii_slide_categories' );
$query = new WP_Query( array( 'cat' =>$slidecat,'posts_per_page' =>$count ) );
if ($query->have_posts()) :
while ($query->have_posts()) : $query->the_post();
echo '
';
}
}
endif;
/**
* function to show the footer info, copyright information
*/
function calorii_footer_info() {
global $calorii_footer_info;
printf( __( '%1$s powered by %2$s', 'calorii' ) , 'Calorii', 'WordPress');
}
if ( ! function_exists( 'get_calorii_theme_options' ) ) {
/**
* Get information from Theme Options and add it into wp_head
*/
function get_calorii_theme_options(){
echo '';
}
}
add_action( 'wp_head', 'get_calorii_theme_options', 10 );
// Theme Options sidebar
add_action( 'optionsframework_after', 'calorii_options_display_sidebar' );
function calorii_options_display_sidebar() { ?>
and
*
* @link http://justintadlock.com/archives/2011/07/01/captions-in-wordpress
*/
function calorii_caption($output, $attr, $content) {
if (is_feed()) {
return $output;
}
$defaults = array(
'id' => '',
'align' => 'alignnone',
'width' => '',
'caption' => ''
);
$attr = shortcode_atts($defaults, $attr);
// If the width is less than 1 or there is no caption, return the content wrapped between the [caption] tags
if ($attr['width'] < 1 || empty($attr['caption'])) {
return $content;
}
// Set up the attributes for the caption
$attributes = (!empty($attr['id']) ? ' id="' . esc_attr($attr['id']) . '"' : '' );
$attributes .= ' class="thumbnail wp-caption ' . esc_attr($attr['align']) . '"';
$attributes .= ' style="width: ' . (esc_attr($attr['width']) + 10) . 'px"';
$output = '';
$output .= do_shortcode($content);
$output .= '' . $attr['caption'] . '';
$output .= '';
return $output;
}
add_filter('img_caption_shortcode', 'calorii_caption', 10, 3);
/**
* Skype URI support for social media icons
*/
function calorii_allow_skype_protocol( $protocols ){
$protocols[] = 'skype';
return $protocols;
}
add_filter( 'kses_allowed_protocols' , 'calorii_allow_skype_protocol' );
/*
* This one shows/hides the an option when a checkbox is clicked.
*/
add_action( 'optionsframework_custom_scripts', 'optionsframework_custom_scripts' );
function optionsframework_custom_scripts() { ?>