Skip to content
Permalink
Browse files

Reduce WP Coding Standards Part 6 new

the changes in widgets removed
  • Loading branch information...
kniebremser committed Jun 12, 2019
1 parent 17ebb13 commit 3482f62842cdef348bc936e632d036b72ef170e1
@@ -23,16 +23,16 @@ function comicpress_body_class( $classes = array() ) {
if ( comicpress_is_signup() ) $classes[] = 'signup';
if ( $is_lynx ) $classes[] = 'lynx';
elseif ( $is_gecko ) $classes[] = 'gecko';
elseif ( $is_opera ) $classes[] = 'opera';
elseif ( $is_NS4 ) $classes[] = 'ns4';
elseif ( $is_safari ) $classes[] = 'safari';
elseif ( $is_chrome ) $classes[] = 'chrome';
elseif ( $is_IE ) $classes[] = 'ie';
else $classes[] = 'unknown';
if ( $is_iphone ) $classes[] = 'iphone';
if ( wp_is_mobile() ) $classes[] = 'is-mobile';
if ( $is_lynx ) $classes[] = 'lynx';
elseif ( $is_gecko ) $classes[] = 'gecko';
elseif ( $is_opera ) $classes[] = 'opera';
elseif ( $is_NS4 ) $classes[] = 'ns4';
elseif ( $is_safari ) $classes[] = 'safari';
elseif ( $is_chrome ) $classes[] = 'chrome';
elseif ( $is_IE ) $classes[] = 'ie';
else $classes[] = 'unknown';
if ( $is_iphone ) $classes[] = 'iphone';
if ( wp_is_mobile() ) $classes[] = 'is-mobile';
// Hijacked from the hybrid theme, http://themehybrid.com/ .
@@ -43,8 +43,8 @@ function comicpress_body_class( $classes = array() ) {
$classes[] = 'single-author-' . get_the_author_meta( 'user_nicename', $wp_query->post->post_author );
}
if (is_page()) {
if ( isset($wp_query->query_vars['pagename']) )
if ( is_page()) {
if ( isset( $wp_query->query_vars['pagename'] ) )
$classes[] = 'page-' . $wp_query->query_vars['pagename'];
}
@@ -54,7 +54,7 @@ function comicpress_body_class( $classes = array() ) {
// NOT hijacked from anything, doi! people should do this.
$timestamp = current_time( 'timestamp' );
$rightnow = (int) date( 'Gi',$timestamp );
$rightnow = (int) date( 'Gi', $timestamp );
$ampm = date( 'a', $timestamp );
$classes[] = $ampm;
// $classes[] = 'time-'.$rightnow;
@@ -95,7 +95,7 @@ function comicpress_post_class( $classes = '' ) {
'entry_tax' => array(
'category',
'post_tag',
)
),
);
/* Microformats. */
@@ -105,7 +105,7 @@ function comicpress_post_class( $classes = '' ) {
$classes[] = 'postonpage-' . ++$post_alt;
if ( $post_alt % 2 )
$classes[] = 'odd';
$classes[] = 'odd';
else $classes[] = 'even';
/* Sticky class (only on home/blog page). */
@@ -67,7 +67,7 @@ function comicpress_copyright_dates() {
if ( $copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate ) {
$copyright .= '-' . $copyright_dates[0]->lastdate;
}
$output = $copyright;
$output = $copyright;
}
return apply_filters( 'comicpress_copyright_dates', $output );
}
@@ -1,20 +1,21 @@
<?php
$custom_header_args = array(
'default-text-color' => 'B00',
'flex-width' => true,
'width' => get_theme_mod('comicpress-customize-range-site-width', '980'),
'flex-height' => true,
'height' => '110',
'header-text' => false,
'wp-head-callback' => 'comicpress_header_style',
'admin-head-callback' => 'comicpress_admin_header_style',
'admin-preview-callback' => 'comicpress_admin_header_style'
);
'default-text-color' => 'B00',
'flex-width' => true,
'width' => get_theme_mod('comicpress-customize-range-site-width', '980'),
'flex-height' => true,
'height' => '110',
'header-text' => false,
'wp-head-callback' => 'comicpress_header_style',
'admin-head-callback' => 'comicpress_admin_header_style',
'admin-preview-callback' => 'comicpress_admin_header_style',
);
add_theme_support( 'custom-header', $custom_header_args );
function comicpress_admin_header_style() { ?>
function comicpress_admin_header_style() {
?>
<style type="text/css">
#headimg { width: <?php echo get_custom_header()->width; ?>px; height: <?php echo get_custom_header()->height; ?>px; background: url(<?php header_image(); ?>) top center no-repeat; }
<?php if (!display_header_text()) { ?>
@@ -7,17 +7,17 @@ function comicpress_latest_blog_post_jump() {
$catnum = 0;
if ( isset( $_GET['latestblogpost'] ) ) $catnum = (int) esc_attr( $_GET['latestblogpost'] );
if ( ! empty( $catnum ) ) {
$args = array(
$args = array(
'numberposts' => 1,
'post_type' => 'post',
'orderby' => 'post_date',
'order' => 'DESC',
'post_status' => 'publish',
'category__in' => array($catnum),
'category__in' => array( $catnum ),
);
$qposts = get_posts( $args );
} else {
$args = array(
$args = array(
'numberposts' => 1,
'post_type' => 'post',
'orderby' => 'post_date',
@@ -41,23 +41,23 @@ function comicpress_display_post_title() {
global $post, $wp_query;
$get_post_title = '';
if ( ( $post->post_type == 'page' ) && is_front_page() ) return; // Don't display the title on static home pages.
if ( ( comicpress_themeinfo( 'disable_page_titles' ) && is_page() ) || ( comicpress_themeinfo( 'disable_post_titles' ) && ! is_page() ) || (is_page( 'chat' ) || is_page( 'forum' ) ) ) return;
if ( is_page() ) {
if ( ( comicpress_themeinfo( 'disable_page_titles' ) && is_page() ) || ( comicpress_themeinfo( 'disable_post_titles' ) && ! is_page() ) || ( is_page( 'chat' ) || is_page( 'forum' ) ) ) return;
if ( is_page() ) {
$post_title = "<h2 class=\"page-title\">";
} else {
$post_title = "<h2 class=\"post-title\">";
}
if ( ( is_page_template( 'blog.php' ) || is_home() || is_front_page() || is_archive() || is_search() ) && ( $post->post_type != 'page') ) $post_title .= "<a href=\"".get_permalink()."\">";
if ( ( is_page_template( 'blog.php' ) || is_home() || is_front_page() || is_archive() || is_search() ) && ( $post->post_type != 'page' ) ) $post_title .= "<a href=\"" . get_permalink() . "\">";
$get_post_title .= get_the_title();
if ( ! $get_post_title ) $get_post_title = '( No Title )';
$post_title .= $get_post_title;
if ( ( is_page_template('blog.php') || is_home() || is_front_page() || is_archive() || is_search() ) && ( $post->post_type != 'page') ) $post_title .= "</a>";
if ( ( is_page_template( 'blog.php' ) || is_home() || is_front_page() || is_archive() || is_search() ) && ( $post->post_type != 'page' ) ) $post_title .= "</a>";
$post_title .= "</h2>\r\n";
echo apply_filters( 'comicpress_display_post_title ', $post_title );
echo apply_filters( 'comicpress_display_post_title', $post_title );
}
}
if ( ! function_exists('comicpress_display_post_thumbnail' ) ) {
if ( ! function_exists( 'comicpress_display_post_thumbnail' ) ) {
function comicpress_display_post_thumbnail( $size = 'thumbnail' ) {
global $post, $wp_query;
if ( $post->post_type == 'post' ) {
@@ -66,11 +66,10 @@ function comicpress_display_post_thumbnail( $size = 'thumbnail' ) {
if ( empty( $link ) ) $link = get_permalink();
if ( has_post_thumbnail() ) {
if ( is_home() ) {
$post_thumbnail = '<div class="post-image"><center><a href="'.$link.'" rel="featured-image" title="Link to ' . get_the_title() . '">' . get_the_post_thumbnail( $post->ID, $size ) . '</a></center></div>'."\r\n";
} else
$post_thumbnail = '<div class="post-image"><center>' . get_the_post_thumbnail( $post->ID, $size ) . '</center></div>'."\r\n";
$post_thumbnail = '<div class="post-image"><center><a href="'.$link.'" rel="featured-image" title="Link to ' . get_the_title() . '">' . get_the_post_thumbnail( $post->ID, $size ) . '</a></center></div>' . "\r\n";
} else $post_thumbnail = '<div class="post-image"><center>' . get_the_post_thumbnail( $post->ID, $size ) . '</center></div>' . "\r\n";
} else {
$url_image = get_post_meta($post->ID, 'featured-image', true);
$url_image = get_post_meta ($post->ID, 'featured-image', true );
if ( ! empty( $url_image ) ) $post_thumbnail = '<div class="post-image"><center><a href="' . $link . '" rel="featured-image" title="Link to "' . get_the_title() . '"><img src="' . $url_image . '" title="' . get_the_title() .'" alt="' . get_the_title() . '"></a></center></div>' . "\r\n";
}
echo apply_filters( 'comicpress_display_post_thumbnail', $post_thumbnail );
@@ -91,11 +90,11 @@ function comicpress_display_author_gravatar() {
}
}
if ( ! function_exists('comicpress_display_post_calendar' ) ) {
if ( ! function_exists( 'comicpress_display_post_calendar' ) ) {
function comicpress_display_post_calendar() {
global $post, $wp_query;
if ( is_page() ) return;
if ( comicpress_themeinfo( 'enable_post_calendar') ) {
if ( comicpress_themeinfo( 'enable_post_calendar' ) ) {
$post_calendar = "<div class=\"post-calendar-date\"><div class=\"calendar-date\"><span>" . get_the_time(' M' ) . "</span>" . get_the_time( 'd' ) . "</div></div>\r\n";
echo apply_filters( 'comicpress_display_post_calendar', $post_calendar );
}
@@ -151,7 +150,7 @@ function comicpress_display_modified_date_time() {
function comicpress_display_post_category() {
global $post;
$post_category = '';
if ( ! comicpress_is_bbpress() && ! comicpress_themeinfo( 'disable_categories_in_posts' ) && !is_attachment() && ( $post->post_type == 'post' ) ) {
if ( ! comicpress_is_bbpress() && ! comicpress_themeinfo( 'disable_categories_in_posts' ) && ! is_attachment() && ( $post->post_type == 'post' ) ) {
$post_category = "<div class=\"post-cat\">" . __( 'Posted In:', 'comicpress' ) . ' ' . get_the_category_list( ', ' ) . "</div>\r\n";
}
echo apply_filters( 'comicpress_display_post_category', $post_category );
@@ -185,8 +184,8 @@ function comicpress_display_comment_link() {
function comicpress_display_blog_navigation() {
global $post, $wp_query;
if ( comicpress_themeinfo( 'enable_comments_on_homepage' ) && ( comicpress_themeinfo( 'home_post_count' ) == '1' ) ) {
$temp_single = $wp_query -> is_single;
$wp_query -> is_single = true;
$temp_single = $wp_query -> is_single;
$wp_query->is_single = true;
}
if ( is_single() && ! is_page() && ! is_archive() && ! is_search() && ( $post->post_type == 'post' ) ) {
?>
@@ -198,7 +197,7 @@ function comicpress_display_blog_navigation() {
<?php
}
if ( comicpress_themeinfo( 'enable_comments_on_homepage' ) && ( comicpress_themeinfo( 'home_post_count' ) == '1') ) {
$wp_query -> is_single = $temp_single;
$wp_query->is_single = $temp_single;
}
}
}
@@ -234,9 +233,9 @@ function comicpress_display_post() {
<div class="post-content">
<div class="post-info">
<?php
if ( ! comicpress_is_bbpress() ) comicpress_display_author_gravatar();
if ( ! comicpress_is_bbpress() ) comicpress_display_post_calendar();
if ( is_sticky() ) {
if ( ! comicpress_is_bbpress() ) comicpress_display_author_gravatar();
if ( ! comicpress_is_bbpress() ) comicpress_display_post_calendar();
if ( is_sticky() ) {
?>
<div class="sticky-image">Featured Post</div>
<?php
@@ -295,7 +294,11 @@ function comicpress_display_post() {
?>
</div>
<div class="post-foot">
<?php do_action('comic-post-foot'); ?><?php do_action('comicpress-post-foot'); ?></div>
<?php
do_action('comic-post-foot');
do_action('comicpress-post-foot');
?>
</div>
</div>
<?php
do_action( 'comic-post-extras' );
@@ -74,9 +74,9 @@ function comicpress_showmood_edit_post() {
}
$count = 0;
$count = count( $results = glob( get_stylesheet_directory() . '/images/moods/' . $moods_directory . '/*') );
$count = count( $results = glob( get_stylesheet_directory() . '/images/moods/' . $moods_directory . '/*' ) );
if ( ! $count ) {
$count = count( $results = glob(get_template_directory() . '/images/moods/' . $moods_directory . '/*') );
$count = count( $results = glob( get_template_directory() . '/images/moods/' . $moods_directory . '/*' ) );
$moods_uri = get_template_directory_uri();
} else {
$moods_uri = get_stylesheet_directory_uri();
@@ -25,7 +25,7 @@ function comicpress_add_page_editor_meta_box() {
}
function comicpress_save_page_editor_options( $post_id ) {
if ( isset( $_POST['comicpress-update-page-options']) && ! wp_verify_nonce( $_POST['comicpress-update-page-options'], 'comicpress_post_options-' . $post_id ) ) {
if ( isset( $_POST['comicpress-update-page-options'] ) && ! wp_verify_nonce( $_POST['comicpress-update-page-options'], 'comicpress_post_options-' . $post_id ) ) {
return $post_id;
}
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
@@ -8,10 +8,10 @@ function comicpress_pagination() {
?>
<div id="pagenav">
<div class="pagenav-right">
<?php previous_posts_link(__( 'Newer Entries &uarr;', 'comicpress' )) ?>
<?php previous_posts_link( __( 'Newer Entries &uarr;', 'comicpress' ) ) ?>
</div>
<div class="pagenav-left">
<?php next_posts_link(__( '&darr; Previous Entries', 'comicpress' )) ?>
<?php next_posts_link( __( '&darr; Previous Entries', 'comicpress' ) ) ?>
</div>
<div class="clear"></div>
</div>
@@ -32,7 +32,7 @@ function comicpress_remove_unwanted_contactmethods( $contactmethods ) {
* Sites that you could be on but not exactly the same reference for an author page.
* When activated, this must be integrated into author.php in table 'user-contacts'.
*/
function add_new_contactmethods( $methods ){
function add_new_contactmethods( $methods ) {
// Default contact methods.
$methods['twitter'] = 'Twitter (url)';
$methods['facebook'] = 'Facebook (url)';
@@ -4,15 +4,15 @@
* Protect global $post and $wp_query.
* @param object $use_this_post If provided, after saving the current post, set up this post for template tag use.
*/
function Protect ($use_this_post = null) {
function Protect ( $use_this_post = null ) {
global $post, $wp_query, $__post, $__wp_query;
if ( ! empty( $post) ) {
if ( ! empty( $post ) ) {
$__post = $post;
}
if ( ! empty( $wp_query) ) {
if ( ! empty( $wp_query ) ) {
$__wp_query = $wp_query;
}
if ( ! is_null( $use_this_post) ) {
if ( ! is_null( $use_this_post ) ) {
$post = $use_this_post;
setup_postdata( $post );
}
@@ -35,7 +35,7 @@ function Unprotect() {
if ( ! empty( $__post) ) {
$post = $__post;
}
if ( ! empty( $__wp_query) ) {
if ( ! empty( $__wp_query ) ) {
$wp_query = $__wp_query;
}
@@ -18,7 +18,7 @@ function comicpress_include_custom_post_types_in_rss( $query ) {
$operator = 'and';
$post_types = get_post_types( $args , $output , $operator );
// Remove 'pages' from the RSS.
$post_types = array_merge( $post_types, array( 'post' ) ) ;
$post_types = array_merge( $post_types, array( 'post' ) );
$query->set( 'post_type' , $post_types );
}
return $query;
@@ -9,20 +9,24 @@
*/
function comicpress_menubar() {
if (file_exists(get_stylesheet_directory() . '/custom-menubar.php')) {
get_template_part('custom-menubar');
} else { ?>
if ( file_exists(get_stylesheet_directory() . '/custom-menubar.php') ) {
get_template_part( 'custom-menubar' );
} else {
?>
<div id="menubar-wrapper">
<div class="menu-container">
<?php do_action('comicpress-menubar-before'); ?>
<?php
// dont mess with the pre_get_posts for the wp_nav_menu()
wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_class' => 'menu', 'theme_location' => 'Primary' ) );
do_action('comicpress-menubar-after');
do_action('comic-mini-navigation');
wp_nav_menu( array(
'sort_column' => 'menu_order',
'container_class' => 'menu',
'theme_location' => 'Primary' ) );
do_action( 'comicpress-menubar-after' );
do_action( 'comic-mini-navigation' );
?>
<div class="menunav">
<?php if (comicpress_themeinfo('enable_search_in_menubar')) { ?>
<?php if ( comicpress_themeinfo( 'enable_search_in_menubar' ) ) { ?>
<div class="menunav-search">
<?php get_search_form(); ?>
</div>
@@ -34,7 +38,8 @@ function comicpress_menubar() {
</div>
<div class="clear"></div>
</div>
<?php }
<?php
}
}
/**
@@ -61,11 +66,11 @@ function __construct() {
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance) {
public function widget( $args, $instance) {
global $post;
extract($args, EXTR_SKIP);
extract ($args, EXTR_SKIP );
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
$title = empty( $instance['title'] ) ? '' : apply_filters('widget_title', $instance['title']);
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
comicpress_menubar();
echo $after_widget;
@@ -108,4 +113,4 @@ function comicpress_menubar_widget_init() {
register_widget('comicpress_menubar_widget');
}
add_action( 'widgets_init', 'comicpress_menubar_widget_init');
add_action( 'widgets_init', 'comicpress_menubar_widget_init');

0 comments on commit 3482f62

Please sign in to comment.
You can’t perform that action at this time.