current_component == BP_HOME_BLOG_SLUG && ( !$bp->current_action || 'page' == $bp->current_action ) ) {
unset( $query_string );
if ( ( 'page' == $bp->current_action && $bp->action_variables[0] ) && false === strpos( $query_string, 'paged' ) ) {
$query_string .= '&paged=' . $bp->action_variables[0];
$paged = $bp->action_variables[0];
}
query_posts($query_string);
bp_core_load_template( 'index', true );
}
}
add_action( 'wp', 'bp_dtheme_show_home_blog', 2 );
function bp_dtheme_firstname( $name = false, $echo = false ) {
global $bp;
if ( !$name )
$name = $bp->loggedin_user->fullname;
$fullname = (array)explode( ' ', $name );
if ( $echo )
echo $fullname[0];
else
return $fullname[0];
}
function bp_dtheme_add_blog_comments_js() {
if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
}
add_action( 'template_redirect', 'bp_dtheme_add_blog_comments_js' );
function bp_dtheme_blog_comments( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
$comment_type = get_comment_type();
if ( $comment->user_id )
$userlink = bp_core_get_user_domain( $comment->user_id );
if ( $comment_type == 'comment' ) { ?>
id="comment-">
blogs->slug, 'my-blogs' );
bp_core_remove_subnav_item( $bp->blogs->slug, 'recent-posts' );
bp_core_remove_subnav_item( $bp->blogs->slug, 'recent-comments' );
bp_core_remove_subnav_item( $bp->activity->slug, 'just-me' );
bp_core_remove_subnav_item( $bp->activity->slug, 'my-friends' );
}
add_action( 'init', 'bp_dtheme_remove_redundant' );
function bp_dtheme_show_notice() { ?>
/i', $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$first_img = "http://img138.imageshack.us/img138/5827/40004740.gif";
}
return $first_img;
}
?> 'left-column1',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
)
);
register_sidebars( 1,
array(
'name' => 'center-column1',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
)
);
register_sidebars( 1,
array(
'name' => 'right-column1',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
)
);
register_sidebars( 1,
array(
'name' => 'left-column2',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
)
);
register_sidebars( 1,
array(
'name' => 'center-column2',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
)
);
register_sidebars( 1,
array(
'name' => 'right-column2',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
)
);
register_sidebars( 1,
array(
'name' => 'blog-sidebar1',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
)
);
register_sidebars( 1,
array(
'name' => 'blog-sidebar2',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
)
);
// WP bug workaround to get W3C compliant
remove_filter('term_description','wpautop');
// excerpt
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'custom_trim_excerpt');
function custom_trim_excerpt($text) { // Fakes an excerpt if needed
global $post;
if ( '' == $text ) {
$text = get_the_content('');
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
$text = strip_tags($text);
$excerpt_length = 35;
$words = explode(' ', $text, $excerpt_length + 1);
if (count($words) > $excerpt_length) {
array_pop($words);
array_push($words, '...');
$text = implode(' ', $words);
}
}
return $text;
}
// admin panel
function cp_input( $var, $type, $description = "", $value = "", $selected="", $onchange="" ) {
echo "\n";
switch( $type ){
case "text":
echo "";
echo "$description
";
break;
case "smalltext":
echo "";
echo "
$description
";
break;
case "submit":
echo "";
break;
case "option":
if( $selected == $value ) { $extra = "selected=\"true\""; }
echo "";
break;
case "radio":
if( $selected == $value ) { $extra = "checked=\"true\""; }
echo "
";
break;
case "checkbox":
if( $selected == $value ) { $extra = "checked=\"true\""; }
echo "
";
break;
case "textarea":
echo "";
break;
}
}
function cp_select( $var, $arrValues, $selected, $label ) {
if( $label != "" ) {
echo "";
}
echo "";
}
function cp_multiSelect( $var, $arrValues, $arrSelected, $label, $description ) {
if( $label != "" ) {
echo "";
}
echo "";
echo "$description
";
}
function cp_th( $title ) {
echo "";
echo "| $title | ";
echo "";
}
function cp_cth() {
echo " | ";
echo "
";
}
// Theme Administration Panel
function cp_addThemePage() {
global $ThemeName;
if ( $_GET['page'] == basename(__FILE__) ) {
// save settings
if ( 'save' == $_REQUEST['action'] ) {
check_admin_referer( 'save-theme-properties' );
// text input
update_option( 'cp_feedlinkURL', $_REQUEST[ 'cp_feedlinkURL' ] );
update_option( 'cp_feedlinkComments', $_REQUEST[ 'cp_feedlinkComments' ] );
update_option( 'cp_analytics', $_REQUEST[ 'cp_analytics' ] );
update_option( 'cp_twitter', $_REQUEST[ 'cp_twitter' ] );
update_option( 'cp_twitteruser', $_REQUEST[ 'cp_twitteruser' ] );
update_option( 'cp_face', $_REQUEST[ 'cp_face' ] );
update_option( 'cp_feed', $_REQUEST[ 'cp_feed' ] );
update_option( 'cp_feed2', $_REQUEST[ 'cp_feed2' ] );
update_option( 'top', $_REQUEST[ 'top' ] );
update_option( 'featured', $_REQUEST[ 'featured' ] );
update_option( 'slider', $_REQUEST[ 'slider' ] );
update_option( 'recently', $_REQUEST[ 'recently' ] );
update_option( 'other', $_REQUEST[ 'other'] );
update_option( 'sbar', $_REQUEST[ 'sbar' ] );
// goto theme edit page
header("Location: themes.php?page=functions.php&saved=true");
die;
// reset settings
} else if( 'reset' == $_REQUEST['action'] ) {
delete_option( 'cp_feedlinkURL' );
delete_option( 'cp_feedlinkComments' );
delete_option( 'cp_analytics' );
delete_option( 'cp_twitter' );
delete_option( 'cp_twitteruser' );
delete_option( 'cp_face' );
delete_option( 'cp_feed' );
delete_option( 'cp_feed2' );
delete_option( 'top' );
delete_option( 'featured' );
delete_option( 'slider' );
delete_option( 'recently' );
delete_option( 'other' );
delete_option( 'sbar' );
// goto theme edit page
header("Location: themes.php?page=functions.php&reset=true");
die;
}
}
add_theme_page( $ThemeName . ' Theme Options', $ThemeName . ' Options', 'edit_themes', basename(__FILE__), 'cp_themePage' );
}
function cp_themePage() {
global $ThemeName;
if ( $_REQUEST[ 'saved' ] ) echo '';
if ( $_REQUEST[ 'reset' ] ) echo '';
?>
Theme Configuration
Preview (updated when options are saved)
cat_ID == $id ) {
return $bC;
exit;
}
}
}
// Plugin by Steve Smith - http://orderedlist.com/wordpress-plugins/feedburner-plugin/ and feedburner - http://www.feedburner.com/fb/a/help/wordpress_quickstart
function feed_redirect() {
global $wp, $feed, $withcomments;
$newURL1 = trim( get_settings( "cp_feedlinkURL" ) );
$newURL2 = trim( get_settings( "cp_feedlinkComments" ) );
if( is_feed() ) {
if ( $feed != 'comments-rss2'
&& !is_single()
&& $wp->query_vars[ 'category_name' ] == ''
&& !is_author()
&& ( $withcomments != 1 )
&& $newURL1 != '' ) {
if ( function_exists( 'status_header' ) ) { status_header( 302 ); }
header( "Location:" . $newURL1 );
header( "HTTP/1.1 302 Temporary Redirect" );
exit();
} elseif ( ( $feed == 'comments-rss2' || $withcomments == 1 ) && $newURL2 != '' ) {
if ( function_exists( 'status_header' ) ) { status_header( 302 ); }
header( "Location:" . $newURL2 );
header( "HTTP/1.1 302 Temporary Redirect" );
exit();
}
}
}
function feed_check_url() {
switch ( basename( $_SERVER[ 'PHP_SELF' ] ) ) {
case 'wp-rss.php':
case 'wp-rss2.php':
case 'wp-atom.php':
case 'wp-rdf.php':
$newURL = trim( get_settings( "cp_feedlinkURL" ) );
if ( $newURL != '' ) {
if ( function_exists('status_header') ) { status_header( 302 ); }
header( "Location:" . $newURL );
header( "HTTP/1.1 302 Temporary Redirect" );
exit();
}
break;
case 'wp-commentsrss2.php':
$newURL = trim( get_settings( "cp_feedlinkComments" ) );
if ( $newURL != '' ) {
if ( function_exists('status_header') ) { status_header( 302 ); }
header( "Location:" . $newURL );
header( "HTTP/1.1 302 Temporary Redirect" );
exit();
}
break;
}
}
if (!preg_match("/feedburner|feedvalidator/i", $_SERVER['HTTP_USER_AGENT'])) {
add_action('template_redirect', 'feed_redirect');
add_action('init','feed_check_url');
}
add_action( 'admin_menu', 'cp_addThemePage' );
?>