array(
'url' => '%s/images/slideshow/001.jpg',
'thumbnail_url' => '%s/images/slideshow/001-thumb.png',
/* translators: header image description */
'description' => __( 'Sea', TEXTDOMAIN )
),
'flowers' => array(
'url' => '%s/images/slideshow/002.jpg',
'thumbnail_url' => '%s/images/slideshow/002-thumb.png',
/* translators: header image description */
'description' => __( 'Flowers', TEXTDOMAIN )
),
'portrait' => array(
'url' => '%s/images/slideshow/003.jpg',
'thumbnail_url' => '%s/images/slideshow/003-thumb.png',
/* translators: header image description */
'description' => __( 'Portrait', TEXTDOMAIN )
),
'hearth' => array(
'url' => '%s/images/slideshow/004.jpg',
'thumbnail_url' => '%s/images/slideshow/004-thumb.png',
/* translators: header image description */
'description' => __( 'Heart', TEXTDOMAIN )
),
'black-white' => array(
'url' => '%s/images/slideshow/031.jpg',
'thumbnail_url' => '%s/images/slideshow/031-thumb.png',
/* translators: header image description */
'description' => __( 'Black & White', TEXTDOMAIN )
)
) );
$locale = get_locale();
$locale_file = TEMPLATEPATH . "/languages/$locale.php";
if ( is_readable( $locale_file ) )
require_once( $locale_file );
// This theme uses wp_nav_menu() in more locations.
register_nav_menus(
array(
'nav' => __( 'Navigation' )
)
);
// images size
add_image_size( 'team-thumb', 100, 100 );
add_image_size( 'thumb-recentposts', 55, 55, true ); // for shortcode
add_image_size( 'portfolio-thumb', 280, 149 );
add_image_size( 'portfolio-thumb-slider', 193, 118, true );
add_image_size( 'portfolio-thumb-gallery', 179, 179, true );
// sidebars registers
register_sidebar( sidebar_args( 'Blog Sidebar', __( 'The sidebar showed on page with Blog template', TEXTDOMAIN ) ) );
register_sidebar( sidebar_args( 'Home Row', __( 'The row below home content.', TEXTDOMAIN ), 'one-third', 'h2' ) );
// add sidebar created from plugin
if( get_option( 'bl_sidebars' ) )
{
$sidebars = unserialize( get_option( 'bl_sidebars' ) );
foreach( $sidebars AS $sidebar )
{
register_sidebar( sidebar_args( $sidebar, '', 'widget', 'h2' ) );
}
}
// add custom style
add_action( 'wp_head', 'yiw_custom_style', 999 );
// add custom js
add_action( 'wp_footer', 'yiw_custom_js', 999 );
}
add_action( 'after_setup_theme', 'beauty_setup' );
/**
* Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
*
* To override this in a child theme, remove the filter and optionally add
* your own function tied to the wp_page_menu_args filter hook.
*
* @since Twenty Ten 1.0
*/
function yiw_page_menu_args( $args ) {
$args['show_home'] = true;
$args['menu_class'] = 'menu';
return $args;
}
add_filter( 'wp_page_menu_args', 'yiw_page_menu_args' );
$theme_modules = array(
STYLESHEETPATH . '/includes/colors.php',
STYLESHEETPATH . '/includes/fonts.php',
STYLESHEETPATH . '/admin-options/yiw_panel.php',
//STYLESHEETPATH . '/admin-options/notify_update.php';,
STYLESHEETPATH . '/admin-options/backend.php',
STYLESHEETPATH . '/admin-options/metaboxes.php',
//STYLESHEETPATH . '/admin-options/tinymce/tinymce.php',
STYLESHEETPATH . '/includes/widgets/widgets.php',
STYLESHEETPATH . '/includes/shortcodes.php',
STYLESHEETPATH . '/includes/sendemail.php'
);
function yiw_custom_style()
{
string_( '' );
}
function yiw_custom_js()
{
string_( '' );
}
function sidebar_args( $name, $description = '', $widget_class = 'widget', $title = 'h3' )
{
$id = strtolower( str_replace( ' ', '-', $name ) );
return array(
'name' => $name,
'id' => $id,
'description' => $description,
'before_widget' => '',
'after_widget' => '
',
'before_title' => '<' . $title . '>',
'after_title' => '' . $title . '>',
);
}
if ( ! function_exists( 'yiw_admin_header_style' ) ) :
/**
* Styles the header image displayed on the Appearance > Header admin panel.
*
* Referenced via add_custom_image_header() in twentyten_setup().
*
* @since Twenty Ten 1.0
*/
function yiw_admin_header_style() {
?>
$v)
{
$b[$k] = strtolower( $v[$subkey] );
}
asort($b);
foreach($b as $key => $val)
{
$c[] = $a[$key];
}
return $c;
}
return $a;
}
$message = '';
// set of icons
$icons_name = array(
'bag', 'box', 'bubble', 'bulb',
'calendar', 'cart', 'chart', 'clipboard', 'coffee',
'diagram', 'doodles',
'gear', 'gift', 'globe',
'info',
'label', 'letter',
'moleskine', 'monitor', 'mphone',
'new',
'open',
'pc', 'pencil', 'phone', 'pictures', 'postit',
'qmark',
'refresh',
'shopbag', 'statistics',
'testimonial', 'tick',
'bag-grey', 'card-grey', 'cart-grey', 'mail-grey', 'pencil-grey', 'phone-grey', 'users-grey'
);
// tags for text
$tags_allowed = array(
'name_site' => get_bloginfo('name'),
'description_site' => get_bloginfo('description'),
'site_url' => site_url()
);
// include theme modules
foreach ( $theme_modules as $module )
if ( file_exists( $module ) )
include_once $module;
unset( $module );
function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('//i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$first_img = get_stylesheet_directory_uri()."/images/default.gif";
}
return $first_img;
}
if ( ! function_exists( 'bolder_comment' ) ) :
/**
* Template for comments and pingbacks.
*
* To override this walker in a child theme without modifying the comments template
* simply create your own twentyten_comment(), and that function will be used instead.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*
* @since Twenty Ten 1.0
*/
function bolder_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
if( !isset( $GLOBALS['count'] ) )
$GLOBALS['count'] = 0;
$GLOBALS['count'] = $GLOBALS['count']+1;
switch ( $comment->comment_type ) :
case '' :
?>
id="li-comment-">
ID;
}
function get_current_pagename()
{
global $post;
return $post->post_name;
}
function plugin_is_activated( $plugin )
{
return in_array( $plugin, (array) get_option( 'active_plugins', array() ) );
}
function get_exclude_categories()
{
$cats = get_option('bl_blog_cats_exclude_1');
$cats = str_replace(" ", "", $cats); // tolgo gli spazi che l'utente inserisce
$cats = explode(",", $cats); // divido le categorie tramite le virgole inserite
$temp = array();
foreach($cats as $cat)
{
$temp[] = $cat; // metto tutte le categorie in un array temporaneo
}
// genero una nuova stringa con l'esclusione delle categorie passate in parametro, aggiugendo un meno davanti ad ogni numero (-1,-4,-7,ecc...)
$i = 0; $query = '';
foreach($temp as $c)
{
if($i != 0) $query .= ','; // aggiunge la virgola, soltanto se non è il primo elemento processato
$query .= "-$c";
$i++;
}
return $query;
}
//------------------------------------------------------------------------------
// CHECK EMAIL
//------------------------------------------------------------------------------
function checkMail($m) {
$r = "([A-z0-9]+[\._\-]?){1,3}([A-z0-9])*";
$r = "/(?i)^{$r}\@{$r}\.[A-z]{2,6}$/";
return preg_match($r, $m);
}
//------------------------------------------------------------------------------
// CHECK GENERIC
//------------------------------------------------------------------------------
Function checkGeneric($str) {
// if (!preg_match("/^[a-z0-9 '-\^]+$/i", $str)) {
// Return False;
// }
If (strlen($str) <= 2) {
return False;
} else {
Return True;
}
}
//------------------------------------------------------------------------------------------------
// CHECK TEL
//-----------------------------------------------------------------------------------
Function checktel($str) {
if ($str == "") {
$str = 0;
}
if (!is_numeric($str)) {
Return False;
}
If (strlen($str) >= 18) {
return False;
} else {
Return True;
}
}
//------------------------------------------------------------------------------
// CHECK GENERIC
//------------------------------------------------------------------------------
function get_convertTags($str, $class = '', $after = '')
{
global $tags_allowed;
if( $class != '' )
$class = ' class="' . $class . '"';
$str = str_replace('[', '', $str);
$str = str_replace(']', '', $str);
foreach( $tags_allowed as $tag => $value )
$str = str_replace( "%$tag%", $value, $str );
return $str . $after;
}
function convertTags($str, $class = '', $after = '')
{
echo get_convertTags($str, $class, $after);
}
add_filter( 'widget_title', 'get_convertTags' );
add_filter( 'bloginfo', 'get_convertTags' );
function get_favicon()
{
$favicon = unserialize( get_option('bl_favicon') );
echo $favicon['url'];
}
function get_logo()
{
$logo = unserialize( get_option('bl_logo') );
echo $logo['url'];
}
// adjust logo
function add_dynamic_logo_size()
{
$_show_logo = get_option( 'bl_show_logo' );
$custom_width = get_option( 'bl_logo_width', '' );
$custom_height = get_option( 'bl_logo_height', '' );
$margin = 20;
if( get_option( 'bl_show_logo' ) AND $custom_width != '' AND $custom_height != '' )
{
?>
";
$i++;
}
if($n AND $i > $n) break;
}
closedir($handle);
}
// $html = '';
// for($i = 0; $i < get_option('nums_images_slideshow_home_f'); $i++)
// {
// $html .= "
";
// }
echo $html;
}
function get_url_icon($icon, $size = 32)
{
global $icons_name;
$path = "/images/icons/{$icon}{$size}.png";
if( file_exists( STYLESHEETPATH . $path ) )
return get_template_directory_uri() . "/images/icons/{$icon}{$size}.png";
else
return get_template_directory_uri() . "/images/icons/{$icon}.png";
}
function list_icons( $selected = false, $echo = TRUE )
{
global $icons_name;
$html = '';
foreach($icons_name as $icon)
{
$option_select = '';
if( $selected != FALSE AND $selected == $icon )
$option_select = ' selected="selected"';
$html .= ''."\n";
}
if($echo) echo $html;
return $html;
}
// convert a string of categories into excluded categories
function exclude_categories($cats)
{
$excluded_cats = '-9999';
$cats = explode(",", $cats);
foreach ($cats as $cat)
{
$excluded_cats .= ',-' . $cat;
}
return $excluded_cats;
}
// print the option from db, using do_shortcode, to convert the shortcodes
function option_theme($option)
{
echo do_shortcode(stripslashes(get_option($option)));
}
/**
* Add "first" and "last" CSS classes to dynamic sidebar widgets. Also adds numeric index class for each widget (widget-1, widget-2, etc.)
*/
function widget_first_last_classes($params) {
global $my_widget_num; // Global a counter array
$this_id = $params[0]['id']; // Get the id for the current sidebar we're processing
$arr_registered_widgets = wp_get_sidebars_widgets(); // Get an array of ALL registered widgets
if(!$my_widget_num) {// If the counter array doesn't exist, create it
$my_widget_num = array();
}
if(!isset($arr_registered_widgets[$this_id]) || !is_array($arr_registered_widgets[$this_id])) { // Check if the current sidebar has no widgets
return $params; // No widgets in this sidebar... bail early.
}
if(isset($my_widget_num[$this_id])) { // See if the counter array has an entry for this sidebar
$my_widget_num[$this_id] ++;
} else { // If not, create it starting with 1
$my_widget_num[$this_id] = 1;
}
$class = 'class="widget-' . $my_widget_num[$this_id] . ' '; // Add a widget number class for additional styling options
if($my_widget_num[$this_id] == 1) { // If this is the first widget
$class .= 'widget-first ';
} elseif($my_widget_num[$this_id] == count($arr_registered_widgets[$this_id])) { // If this is the last widget
$class .= 'widget-last ';
}
$params[0]['before_widget'] = str_replace('class="', $class, $params[0]['before_widget']); // Insert our new classes into "before widget"
return $params;
}
add_filter('dynamic_sidebar_params','widget_first_last_classes');
function get_links_sliders( &$a, &$url, $slide )
{
switch( $slide['link_type'] )
{
case 'page':
$a = TRUE;
$url = get_permalink( $slide['link_page'] );
break;
case 'category':
$a = TRUE;
$theCatId = get_category_by_slug( $slide['link_category'] );
$url = get_category_link( $theCatId->term_id );
break;
case 'url':
$a = TRUE;
$url = $slide['link_url'];
break;
case 'none':
$a = FALSE;
$url = '';
break;
}
}
function featured_content( $slide, $before = '', $after = '', $container = true )
{
global $link;
switch( $slide['content_type'] ) {
case 'image' : ?>
max_num_pages;
if( !$pages )
$pages = 1;
}
if( 1 != $pages ) {
echo "\n";
}
}
function echo_list_option( $option = array(), $value_select = false, $echo = true )
{
if( empty( $option ) )
return;
foreach( $option as $key => $value )
{
$selected = '';
if( $value_select != FALSE AND $key == $value_select )
$selected = ' selected="selected"';
$html .= "\n";
}
if( $echo )
echo $html;
return $html;
}
function get_pageID_by_pagename( $page_name )
{
global $wpdb;
return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$page_name'");
}
function yiw_get_slides( $key = false )
{
$return = array();
if( $post_types = get_option( 'bl_accordion_sliders' ) )
{
foreach( unserialize( $post_types ) as $id => $value )
{
switch( $key )
{
case 'name' :
$return[] = $value;
break;
case 'slug' :
$return[] = strtolower( str_replace( ' ', '_', $value ) );
break;
case FALSE :
$return[$id]['name'] = $value;
$return[$id]['slug'] = strtolower( str_replace( ' ', '_', $value ) );
break;
}
}
}
else
{
$return = array();
}
return $return;
}
function url_to_pathname( $url )
{
return str_replace( 'http://' . $_SERVER['SERVER_NAME'], $_SERVER['DOCUMENT_ROOT'], $url );
}
// lenghts
function excerpt_length_testimonials_slider()
{
return get_option( 'bl_testimonial_slider_words_split', 13 );
}
function excerpt_more_testimonials_slider()
{
return '...';
}
?>