Warning: you seem to be using an old version of Internet Explorer (or a browser in compatibility mode). Please upgrade to IE 8 or later for maximum site compatibility!

'); } } function ttw_is_oldIE() { $browser = $_SERVER['HTTP_USER_AGENT']; return (false !== strpos($browser, 'MSIE 5') || false !== strpos($browser, 'MSIE 6') || false !== strpos($browser, 'MSIE 7')); } function ttw_setup_post_args($args) { /* setup WP_Query arg list */ $cats = ttw_get_page_categories(); if (!empty($cats)) $args['cat'] = $cats; $tags = ttw_get_page_tags(); if (!empty($tags)) $args['tag'] = $tags; $onepost = ttw_get_page_onepost(); if (!empty($onepost)) $args['name'] = $onepost; $orderby = ttw_get_page_orderby(); if (!empty($orderby)) $args['orderby'] = $orderby; $order = ttw_get_page_order(); if (!empty($order)) $args['order'] = $order; $author_name = ttw_get_page_author(); if (!empty($author_name)) $args['author_name'] = $author_name; $posts_per_page = ttw_get_page_posts_per(); if (!empty($posts_per_page)) $args['posts_per_page'] = $posts_per_page; // if (ttw_is_checked_page_opt('ttw_hide_sticky')) $args['caller_get_posts'] = false; /* doesn't seem to work... */ return $args; } function ttw_get_page_categories() { $cats = ttw_get_per_page_value('ttw_category'); if (empty($cats)) return ''; // now convert slugs to ids return ttw_cat_slugs_to_ids($cats); } function ttw_cat_slugs_to_ids($cats) { if (empty($cats)) return ''; // now convert slugs to numbers $clist = explode(',',$cats); // break into a list $cat_list = ''; foreach ($clist as $slug) { $neg = 1; // not negative if ($slug[0] == '-') { $slug = substr($slug,1); // zap the - $neg = -1; } $cur_cat = get_category_by_slug($slug); if ($cur_cat) { $cat_id = $neg * (int)$cur_cat->cat_ID; if ($cat_list == '') $cat_list = strval($cat_id); else $cat_list .= ','.strval($cat_id); } } return $cat_list; } function ttw_get_page_tags() { $tags = ttw_get_per_page_value('ttw_tag'); if (empty($tags)) return ''; return $tags; } function ttw_get_page_onepost() { $the_post = ttw_get_per_page_value('ttw_onepost'); if (empty($the_post)) return ''; return $the_post; } function ttw_get_page_orderby() { $orderby = ttw_get_per_page_value('ttw_orderby'); if (empty($orderby)) return ''; if ($orderby == 'author' || $orderby == 'date' || $orderby == 'title' || $orderby == 'rand') return $orderby; ttw_page_posts_error('orderby must be author, date, title, or rand. You used: '. $orderby); return ''; } function ttw_get_page_order() { $order = ttw_get_per_page_value('ttw_order'); if (empty($order)) return ''; if ($order == 'ASC' || $order == 'DESC') return $order; ttw_page_posts_error('order value must be ASC or DESC. You used: '. $order); return ''; } function ttw_get_page_posts_per() { $ppp = ttw_get_per_page_value('ttw_posts_per_page'); if (empty($ppp)) return ''; // now convert slugs to numbers return $ppp; } function ttw_get_page_author() { $author = ttw_get_per_page_value('ttw_author'); if (empty($author)) return ''; return $adv; } function ttw_get_per_page_value($name) { global $ttw_cur_page_id; return get_post_meta($ttw_cur_page_id,$name,true); } function ttw_is_checked_page_opt($meta_name) { // the standard is to check options to hide things global $ttw_cur_page_id; $val = get_post_meta($ttw_cur_page_id,$meta_name,true); // retrieve meta value if (!empty($val)) return true; // value exists - 'on' return false; } function ttw_html_br() { echo ('
'); } function ttw_help_link($link, $info) { $t_dir = get_template_directory_uri(); $pp_help = '' . ''; echo($pp_help); } function ttw_is_checked_post_opt($meta_name) { // the standard is to check options to hide things global $ttw_cur_post_id; $val = get_post_meta($ttw_cur_post_id,$meta_name,true); // retrieve meta value if (!empty($val)) return true; // value exists - 'on' return false; } function ttw_page_posts_error($info='') { echo('

WARNING: error defining Custom Field on Page with Posts.

'); if (strlen($info) > 0) echo('More info: '.$info.'
'); } function ttw_add_q($q, $item, $tag='') { if ($item == '') return $q; if (!empty($q)) return $q . '&' . $tag . $item; else return $tag . $item; } function ttw_multi_col($content){ // layout content into two colums, multiple rows using to split for 2 col template // derived from: http://www.robsearles.com/2009/07/05/wordpress-multiple-content-columns/ $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); // the first "more" is converted to a span with ID $columns = preg_split('/(<\/span>)|()<\/p>/', $content); $col_count = count($columns); if($col_count > 1) { for($i=0; $i < $col_count; $i++) { // check to see if there is a final

, if not add it if(!preg_match('/<\/p>\s?$/', $columns[$i]) ) { $columns[$i] .= '

'; } // check to see if there is an appending

, if there is, remove $columns[$i] = preg_replace('/^\s?<\/p>/', '', $columns[$i]); // now add the div wrapper if ((int)($i % 2) == 0) $coldiv = 'left'; else $coldiv = 'right'; if ($coldiv == 'right' && ($i+1) < $col_count) { $break_cols ='
'; } else { $break_cols = ''; } $columns[$i] = '
'.$columns[$i] .'
' . $break_cols ; } $content = join($columns, "\n").'
'; } else { // this page does not have dynamic columns $content = wpautop($content); } // remove any left over empty

tags $content = str_replace('

', '', $content); return $content; } function ttw_put_area($name) { // for the extra code areas between major divs $area_name = 'ttw_' . $name . '_insert'; $hide_front = 'ttw_hide_front_' . $name; $hide_rest = 'ttw_hide_rest_' . $name; if (ttw_getopt($area_name)) { /* area insert defined? */ if (is_front_page()) { if (!ttw_getopt($hide_front)) echo (do_shortcode(str_replace("\\", "", ttw_getopt($area_name)))); } else if (!ttw_getopt($hide_rest)) { echo (do_shortcode(str_replace("\\", "", ttw_getopt($area_name)))); } } } function ttw_is_gallery($postID) { $is_gallery = false; if (function_exists('get_post_format')) { // for 3.1 if (get_post_format($postID) == 'gallery') $is_gallery = true; } return (in_category( _x('gallery', 'gallery category slug', TTW_TRANS) ) || $is_gallery); } function ttw_put_page_title($tag, $style=null) { if (ttw_is_checked_page_opt('ttw-hide-page-title')) return; echo ("<$tag class=\"entry-title\" $style >"); the_title(); echo("\n"); } function ttw_put_perpage_widgetarea() { global $ttw_cur_page_id; $extra = trim(get_post_meta($ttw_cur_page_id,'ttw_show_extra_areas',true)); $area = 'per-page-' . $extra; // retrieve meta value if (strlen($extra) > 0) { // want to display some areas if (!ttw_check_perpage_exists($area,'per-page-widget')) return; if ( !is_active_sidebar($area)) return; ob_start(); /* let's use output buffering to allow use of Dynamic Widgets plugin and not have empty sidebar */ $success = dynamic_sidebar($area); $content = ob_get_clean(); if ($success) { ?> 0) { // want to display some areas if (!ttw_check_perpage_exists($area,'primary')) return true; // must be true so we don't get double area ids if ( !is_active_sidebar($area)) return false; ob_start(); /* let's use output buffering to allow use of Dynamic Widgets plugin and not have empty sidebar */ $success = dynamic_sidebar($area); $content = ob_get_clean(); if ($success) { ?> 0) { // want to display some areas if (!ttw_check_perpage_exists($area,'secondary')) return true; // must be true so we don't get double area ids if ( !is_active_sidebar($area)) return false; ob_start(); /* let's use output buffering to allow use of Dynamic Widgets plugin and not have empty sidebar */ $success = dynamic_sidebar($area); $content = ob_get_clean(); if ($success) { ?> $msg<*******************
\n"); } } ?>