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,'parent');
$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);
}
}
/*** Slideshow ***/
$prefix = 'sgt_';
$meta_box = array(
'id' => 'slide',
'title' => 'Slideshow Options',
'page' => 'post',
'context' => 'side',
'priority' => 'low',
'fields' => array(
array(
'name' => 'Show in slideshow',
'id' => $prefix . 'slide',
'type' => 'checkbox'
)
)
);
add_action('admin_menu', 'sight_add_box');
// Add meta box
function sight_add_box() {
global $meta_box;
add_meta_box($meta_box['id'], $meta_box['title'], 'sight_show_box', $meta_box['page'], $meta_box['context'], $meta_box['priority']);
}
// Callback function to show fields in meta box
function sight_show_box() {
global $meta_box, $post;
// Use nonce for verification
echo '';
echo '
';
}
add_action('save_post', 'sight_save_data');
// Save data from meta box
function sight_save_data($post_id) {
global $meta_box;
// verify nonce
if (!wp_verify_nonce($_POST['sight_meta_box_nonce'], basename(__FILE__))) {
return $post_id;
}
// check autosave
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return $post_id;
}
// check permissions
if ('page' == $_POST['post_type']) {
if (!current_user_can('edit_page', $post_id)) {
return $post_id;
}
} elseif (!current_user_can('edit_post', $post_id)) {
return $post_id;
}
foreach ($meta_box['fields'] as $field) {
$old = get_post_meta($post_id, $field['id'], true);
$new = $_POST[$field['id']];
if ($new && $new != $old) {
update_post_meta($post_id, $field['id'], $new);
} elseif ('' == $new && $old) {
delete_post_meta($post_id, $field['id'], $old);
}
}
}
/*** Options ***/
function options_admin_menu() {
// here's where we add our theme options page link to the dashboard sidebar
add_theme_page("Sight Theme Options", "Theme Options", 'edit_themes', basename(__FILE__), 'options_page');
}
add_action('admin_menu', 'options_admin_menu');
function options_page() {
if ( $_POST['update_options'] == 'true' ) { options_update(); } //check options update
?>
'Site description',
'before_widget' => '',
'after_widget' => '
'
));
register_sidebar(array(
'name'=>'Sidebar',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
));
}
class GetConnected extends WP_Widget {
function GetConnected() {
parent::WP_Widget(false, $name = 'Sight Social Links');
}
function widget($args, $instance) {
extract( $args );
$title = apply_filters('widget_title', $instance['title']);
?>
'; ?>
'; ?>
$rpthumb_qty,
);
$rpthumb_posts = get_posts($q_args);
foreach ( $rpthumb_posts as $post ) :
setup_postdata($post);
?>
>
>
/>
attributes(); //Bis Contain first attribute, It usually is ok or fail in FeedBurner
if ($bis=='ok'){
foreach ($xml->feed as $feed) {
if ($feed->entry[1]['circulation']=='0'){
$burner_count_circulation = $feed->entry[0]['circulation'];
$burner_date = $feed->entry[0]['date'];
} else {
$burner_count_circulation = $feed->entry[1]['circulation'];
$burner_date = $feed->entry[1]['date'];
}
}
}
if ($bis=='fail'){
switch ($xml->err['code']) {
case 1:
$burner_count_circulation = 'Feed Not Found';
break;
case 5:
$burner_count_circulation = 'Missing required parameter (URI)';
break;
case 6:
$burner_count_circulation = 'Malformed parameter (DATES)';
break;
}
$burner_date = $today;
}
}
if ( $bis != 'fail' && $burner_count_circulation != '' ) {
echo ''.$burner_count_circulation.' readers';
} else {
echo ''.$burner_count_circulation.'';
}
}
function twittercount($twitter_url='http://twitter.com/wpshower') {
$twitterid = explode('/', $twitter_url);
$twitterid = end($twitterid);
$xml = @simplexml_load_file("http://twitter.com/users/show.xml?screen_name=$twitterid");
echo $xml[0]->followers_count;
}
function seo_title() {
global $page, $paged;
$sep = " | "; # delimiter
$newtitle = get_bloginfo('name'); # default title
# Single & Page ##################################
if (is_single() || is_page())
$newtitle = single_post_title("", false);
# Category ######################################
if (is_category())
$newtitle = single_cat_title("", false);
# Tag ###########################################
if (is_tag())
$newtitle = single_tag_title("", false);
# Search result ################################
if (is_search())
$newtitle = "Search Result " . $s;
# Taxonomy #######################################
if (is_tax()) {
$curr_tax = get_taxonomy(get_query_var('taxonomy'));
$curr_term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); # current term data
# if it's term
if (!empty($curr_term)) {
$newtitle = $curr_tax->label . $sep . $curr_term->name;
} else {
$newtitle = $curr_tax->label;
}
}
# Page number
if ($paged >= 2 || $page >= 2)
$newtitle .= $sep . sprintf('Page %s', max($paged, $page));
# Home & Front Page ########################################
if (is_home() || is_front_page()) {
$newtitle = get_bloginfo('name') . $sep . get_bloginfo('description');
} else {
$newtitle .= $sep . get_bloginfo('name');
}
return $newtitle;
}
add_filter('wp_title', 'seo_title');
function new_excerpt_length($length) {
return 200;
}
add_filter('excerpt_length', 'new_excerpt_length');
function getTinyUrl($url) {
$tinyurl = file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
return $tinyurl;
}
function smart_excerpt($string, $limit) {
$words = explode(" ",$string);
if ( count($words) >= $limit) $dots = '...';
echo implode(" ",array_splice($words,0,$limit)).$dots;
}
function comments_link_attributes(){
return 'class="comments_popup_link"';
}
add_filter('comments_popup_link_attributes', 'comments_link_attributes');
function next_posts_attributes(){
return 'class="nextpostslink"';
}
add_filter('next_posts_link_attributes', 'next_posts_attributes');
?>