__( 'Blog', 'themeofwp' ),
'id' => 'sidebar',
'description' => __( 'Widgets in this area will be shown blogs on right side.', 'themeofwp' ),
'before_title' => '
',
'after_title' => '
',
'before_widget' => '
',
'after_widget' => '
'
)
);
register_sidebar(array(
'name' => __( 'Footer', 'themeofwp' ),
'id' => 'bottom',
'description' => __( 'Widgets in this area will be shown before footer area.' , 'themeofwp'),
'before_title' => '
',
'after_title' => '
',
'before_widget' => ''
)
);
register_sidebar(array(
'name' => __( 'Header Social', 'themeofwp' ),
'id' => 'header-social',
'description' => __( 'Widgets in this area will be shown on hader social area.' , 'themeofwp'),
'before_title' => '',
'after_title' => '',
'before_widget' => '',
'after_widget' => ''
)
);
register_sidebar(array(
'name' => __( 'Header Contact', 'themeofwp' ),
'id' => 'header-contact',
'description' => __( 'Widgets in this area will be shown on hader contact area.' , 'themeofwp'),
'before_title' => '',
'after_title' => '',
'before_widget' => '',
'after_widget' => ''
)
);
register_sidebar(array(
'name' => __( 'Works', 'themeofwp' ),
'id' => 'works',
'description' => __( 'Widgets in this area will be shown on portfolio / works page' , 'themeofwp'),
'before_title' => '
',
'after_title' => '
',
'before_widget' => '
',
'after_widget' => '
'
)
);
register_sidebar(array(
'name' => __( 'Pages', 'themeofwp' ),
'id' => 'page',
'description' => __( 'Widgets in this area will be shown on pages' , 'themeofwp'),
'before_title' => '
',
'after_title' => '
',
'before_widget' => '
',
'after_widget' => '
'
)
);
register_sidebar(array(
'name' => __( 'Contact', 'themeofwp' ),
'id' => 'contact',
'description' => __( 'Widgets in this area will be shown on contact page' , 'themeofwp'),
'before_title' => '
',
'after_title' => '
',
'before_widget' => '
',
'after_widget' => '
'
)
);
// Remove the annoying: added in the header
function remove_recent_comment_style() {
global $wp_widget_factory;
remove_action(
'wp_head',
array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' )
);
}
add_action( 'widgets_init', 'remove_recent_comment_style' );
/*-----------------------------------------------------------------------------------------------------------------------*/
/* Wp Mu Image Support*/
/*-----------------------------------------------------------------------------------------------------------------------*/
function get_image_url() {
$theImageSrc = wp_get_attachment_url(get_post_thumbnail_id($post_id));
global $blog_id;
if (isset($blog_id) && $blog_id > 0) {
$imageParts = explode('/files/', $theImageSrc);
if (isset($imageParts[1])) {
$theImageSrc = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
}
}
echo $theImageSrc;
}
/*-----------------------------------------------------------------------------------------------------------------------*/
/* Wp Mu Custom Meta Image Support*/
/*-----------------------------------------------------------------------------------------------------------------------*/
function get_image_path($cutommeta_image) {
$theImageSrc1 = $cutommeta_image;
global $blog_id;
if (isset($blog_id) && $blog_id > 0) {
$imageParts = explode('/files/', $theImageSrc1);
if (isset($imageParts[1])) {
$theImageSrc1 = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
}
}
return $theImageSrc1;
}
//Comment form
if( ! function_exists('themeofwp_comment_form') ){
function themeofwp_comment_form($args = array(), $post_id = null ){
if ( null === $post_id )
$post_id = get_the_ID();
else
$id = $post_id;
$commenter = wp_get_current_commenter();
$user = wp_get_current_user();
$user_identity = $user->exists() ? $user->display_name : '';
if ( ! isset( $args['format'] ) )
$args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml';
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' );
$html5 = 'html5' === $args['format'];
$fields = array(
'author' => '
'
. sprintf( __( 'You must be logged in to post a comment.', 'themeofwp' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) )
. '
';
return $o;
}
add_filter( 'the_password_form', 'themeofwp_post_password_form' );
}
if ( ! function_exists( 'themeofwp_the_attached_image' ) ) {
/**
* Prints the attached image with a link to the next attached image.
*
*
* @return void
*/
function themeofwp_the_attached_image() {
$post = get_post();
$attachment_size = array( 724, 724 );
$next_attachment_url = wp_get_attachment_url();
/**
* Grab the IDs of all the image attachments in a gallery so we can get the URL
* of the next adjacent image in a gallery, or the first image (if we're
* looking at the last image in a gallery), or, in a gallery of one, just the
* link to that image file.
*/
$attachment_ids = get_posts( array(
'post_parent' => $post->post_parent,
'fields' => 'ids',
'numberposts' => -1,
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC',
'orderby' => 'menu_order ID'
) );
// If there is more than 1 attachment in a gallery...
if ( count( $attachment_ids ) > 1 ) {
foreach ( $attachment_ids as $attachment_id ) {
if ( $attachment_id == $post->ID ) {
$next_id = current( $attachment_ids );
break;
}
}
// get the URL of the next image attachment...
if ( $next_id )
$next_attachment_url = get_attachment_link( $next_id );
// or get the URL of the first image attachment.
else
$next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );
}
printf( '%3$s',
esc_url( $next_attachment_url ),
the_title_attribute( array( 'echo' => false ) ),
wp_get_attachment_image( $post->ID, $attachment_size )
);
}
}