some fixes and new body classes

Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
Philip M. Hofer (Frumph) 2009-09-02 12:54:50 -07:00
parent 248a04de78
commit ce8793db96
3 changed files with 49 additions and 27 deletions

View File

@ -1,11 +1,12 @@
<?php
/**
* Check Browser
* function browser_body_class
* Body Classes
* function function comicpress_body_class
*
* This has two functions, the first being it adds the browser type as a class
* in the <body> tag where you can then do .ie #page and do things specific
* for each browser type.
* for each browser type as well as a few other classes that the normal body_class
* does not yet support.
*
* The second is you can write code specific for a particular browser.
*
@ -15,10 +16,10 @@
*
*/
add_filter('body_class','browser_body_class');
add_filter('body_class','comicpress_body_class');
function browser_body_class($classes = '') {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
function comicpress_body_class($classes = '') {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone, $post, $wp_query;
if($is_lynx) $classes[] = 'lynx';
elseif($is_gecko) $classes[] = 'gecko';
@ -28,10 +29,31 @@ function browser_body_class($classes = '') {
elseif($is_chrome) $classes[] = 'chrome';
elseif($is_IE) $classes[] = 'ie';
else $classes[] = 'unknown';
if($is_iphone) $classes[] = 'iphone';
// Hijacked from the hybrid theme, http://themehybrid.com/
if (is_single()) {
foreach ( (array)get_the_category( $wp_query->post->ID ) as $cat ) :
$classes[] = 'single-category-' . sanitize_html_class( $cat->slug, $cat->term_id );
endforeach;
$classes[] = 'single-author-' . get_the_author_meta( 'user_nicename', $wp_query->post->post_author );
}
if ( is_sticky( $wp_query->post->ID ) ) {
$classes[] = 'single-sticky';
}
if ( is_attachment() ) {
$classes[] = 'attachment attachment-' . $wp_query->post->ID;
$mime_type = explode( '/', get_post_mime_type() );
foreach ( $mime_type as $type ) :
$classes[] = 'attachment-' . $type;
endforeach;
}
return $classes;
}
?>

View File

@ -377,11 +377,9 @@ h3, h3 a {
border: 1px solid #999;
text-align: center;
z-index: 100;
padding: 5px;
}
#comic img {
margin: 5px;
}
#comic-foot {
padding-bottom: 5px;

View File

@ -14,6 +14,7 @@ global $wpmu_version; ?>
<ul>
<?php if (!is_user_logged_in()) { ?>
<li>
<?php if ( get_option('users_can_register') ) { ?>
<form action="<?php bloginfo('url') ?>/wp-login.php" method="post">
UserName:<br />
<input type="text" name="log" id="sname" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="22" /><br /><br />
@ -30,6 +31,7 @@ global $wpmu_version; ?>
<?php } else { ?>
<a href="<?php bloginfo('url') ?>/wp-register.php">Register</a><br />
<?php } ?>
<?php } ?>
<a href="<?php bloginfo('url') ?>/wp-login.php?action=lostpassword">Recover password</a>
<?php } else { ?>
<?php $redirect = '&amp;redirect_to='.urlencode(wp_make_link_relative(get_option('siteurl')));