__( 'Primary Menu', 'buffercode' ),) );
// Post Thumbnail
add_filter( 'post_thumbnail_html', 'buffercode_post_thumbnail', 10, 3 );
function buffercode_post_thumbnail( $html, $post_id, $post_image_id ) {
$html = '' . $html . ' ';
return $html;
}
//disabling toolbar for all users
show_admin_bar(false);
// Banner ads starts
add_action('admin_menu', 'buffercode_theme_custom_options');
function buffercode_theme_custom_options() {
add_theme_page('Top Banner Ads', 'Top Banner Ads', 'edit_theme_options', 'buffercode-top-banner', 'buffercode_theme_custom_options_function');
add_theme_page('Custom Settings', 'Custom Settings', 'edit_theme_options', 'buffercode-custom-settings', 'buffercode_theme_social_function');
}
function buffercode_theme_custom_options_function(){
if (!current_user_can('manage_options'))
{
wp_die( __('You do not have sufficient permissions to access this page.', 'buffercode' ) );
}
if( isset($_POST[ 'hidden_field_name' ]) && $_POST[ 'hidden_field_name' ] == 'Y' ) {
if(!empty($_POST['buffercode_TC_banner_728x80']) && !empty($_POST['buffercode_TC_banner_script']))
{
echo'
Please add any one ads type, either upload banner or past script
';
}
else{
if(!empty($_POST['buffercode_TC_banner_728x80'])){
$buffercode_TC_banner_728x80 = htmlentities( stripslashes( $_POST['buffercode_TC_banner_728x80'] ) , ENT_COMPAT );
$buffercode_TC_banner_728x80_url = htmlentities( stripslashes( $_POST['buffercode_TC_banner_728x80_url'] ) , ENT_COMPAT );
update_option('buffercode_banner_option_value', 1);
update_option('buffercode_TC_banner_728x80', $buffercode_TC_banner_728x80);
update_option('buffercode_TC_banner_728x80_url', $buffercode_TC_banner_728x80_url);
update_option('buffercode_TC_banner_script','');
echo' Banner Image Added Successfully...
';
}
elseif( !empty($_POST['buffercode_TC_banner_script'])){
update_option('buffercode_banner_option_value', 2);
$buffercode_TC_banner_script = htmlentities( stripslashes( $_POST['buffercode_TC_banner_script'] ) , ENT_COMPAT );
update_option('buffercode_TC_banner_script', $buffercode_TC_banner_script);
update_option('buffercode_TC_banner_728x80', '');
update_option('buffercode_TC_banner_728x80_url','');
echo' Banner Script Added Successfully...
';
}
else{
update_option('buffercode_banner_option_value', 0);
update_option('buffercode_TC_banner_728x80', '');
update_option('buffercode_TC_banner_728x80_url','');
update_option('buffercode_TC_banner_script','');
echo' Settings Saved... But neither Image nor script added
';
}
}
}
?>
Updated Successfully...
';
}
?>
Custom Setting Page
1 ) {
$buffercode_comments = $buffercode_number_comments . __(' Comments', 'buffercode' );
} else {
$buffercode_comments = __('1 Comment', 'buffercode' );
}
$buffercode_output_comments = ''. $buffercode_comments.' ';
} else {
$buffercode_output_comments = __('Comments are off for this post.', 'buffercode' );
}
return $buffercode_output_comments;
}
#Buffercode - Comment List
function buffercode_comment_list(){
$buffercode_comment_list_args = array(
'walker' => null,
'max_depth' => '',
'style' => '',
'callback' => null,
'end-callback' => null,
'type' => 'all',
'reply_text' => 'Reply',
'page' => '',
'per_page' => '20',
'avatar_size' => 32,
'reverse_top_level' => null,
'reverse_children' => '',
'format' => 'xhtml', //or html5 @since 3.6
'short_ping' => false // @since 3.6
);
?>
'Right Sidebar',
'id' => 'buffercode_right_sidebar',
'before_widget' => '',
'before_title' => '
',
'after_title' => ' ',
) );
register_sidebar( array(
'name' => 'Left Footer',
'id' => 'buffercode_left_footer',
'before_widget' => '',
'before_title' => '
',
'after_title' => ' ',
) );
register_sidebar( array(
'name' => 'Center Footer',
'id' => 'buffercode_center_footer',
'before_widget' => '',
'before_title' => '
',
'after_title' => ' ',
) );
register_sidebar( array(
'name' => 'Right Footer',
'id' => 'buffercode_right_footer',
'before_widget' => '',
'before_title' => '
',
'after_title' => ' ',
) );
register_sidebar( array(
'name' => 'Social Network',
'id' => 'buffercode_social_netw',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
'after_title' => '',
) );
}
add_action( 'widgets_init', 'buffercode_widgets' );
//Comments
add_filter( 'comment_form_default_fields', 'buffercode_comment_form_fields' );
function buffercode_comment_form_fields( $fields ) {
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' );
$html5 = current_theme_supports( 'html5', 'comment-form' ) ? 1 : 0;
$fields = array(
'author' => '',
'email' => '',
'url' => '',
);
return $fields;
}
add_filter( 'comment_form_defaults', 'buffercode_comment_form_textarea' );
function buffercode_comment_form_textarea( $args ) {
$args['comment_field'] = '';
return $args;
}
add_action('comment_form', 'buffercode_comment_button' );
function buffercode_comment_button() {
echo '
' . __( 'Submit', 'buffercode' ) . ' ';
}
//Title
add_filter( 'wp_title', 'buffercode_header_title', 10, 3 );
function buffercode_header_title( $title, $sep, $seplocation )
{
global $page, $paged;
// Don't affect in feeds.
if ( is_feed() )
return $title;
// Add the blog name
if ( 'right' == $seplocation )
$title .= get_bloginfo( 'name' );
else
$title = get_bloginfo( 'name' ) . $title;
// 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', 'buffercode' ), max( $paged, $page ) );
return $title;
}
//Author Social Information Starts
add_action( 'show_user_profile', 'buffercode_show_profile' );
add_action( 'edit_user_profile', 'buffercode_show_profile' );
function buffercode_show_profile( $user ) { ?>
Author Social Information