Skip to content
Browse files

Converting to WP coding standards

  • Loading branch information...
1 parent 4f2ab9b commit e147eb41537fd2119c2ac936ce80dd5c4d681997 @GeertDD committed Feb 12, 2013
Showing with 29 additions and 30 deletions.
  1. +1 −1 footer.php
  2. +24 −25 functions.php
  3. +2 −2 header.php
  4. +1 −1 home.php
  5. +1 −1 index.php
View
2 footer.php
@@ -1,7 +1,7 @@
<footer>
<p>I’m hosting the custom WordPress theme for this site on <a href="https://github.com/GeertDD/wp-theme-geertdd">GitHub</a>.</p>
- <p>© Copyright 1984–<?php echo date('Y') ?> Geert De Deckere</p>
+ <p>© Copyright 1984–<?php echo date( 'Y' ) ?> Geert De Deckere</p>
</footer>
<?php wp_footer() ?>
View
49 functions.php
@@ -1,46 +1,45 @@
<?php
-if (WP_DEBUG && ! defined('SAVEQUERIES'))
+// Additional debug info
+if ( WP_DEBUG && ! defined( 'SAVEQUERIES' ) )
{
- define('SAVEQUERIES', TRUE);
+ define( 'SAVEQUERIES', true );
}
new WP_Theme_GeertDD;
class WP_Theme_GeertDD {
- public function __construct()
- {
- add_action('after_setup_theme', array($this, 'setup'));
- add_action('init', array($this, 'clean_up_head'));
- add_action('wp_enqueue_scripts', array($this, 'load_styles_and_scripts'));
+ public function __construct() {
+ add_action( 'after_setup_theme', array( $this, 'setup' ) );
+ add_action( 'init', array( $this, 'clean_up_head' ) );
+ add_action( 'wp_enqueue_scripts', array( $this, 'load_styles_and_scripts' ) );
}
- public function setup()
- {
+ public function setup() {
// register nav, sidebar, etc.
}
- public function load_styles_and_scripts()
- {
- // Register all stylesheets and JavaScript files
- wp_register_style('geertdd', get_stylesheet_directory_uri().'/css/geertdd.css', NULL, NULL);
- wp_register_script('modernizr', get_stylesheet_directory_uri().'/js/modernizr.min.js', NULL, NULL);
- wp_register_script('geertdd', get_stylesheet_directory_uri().'/js/geertdd.js', array('modernizr', 'jquery'), NULL, TRUE);
- wp_localize_script('geertdd', 'GEERTDD', array(
+ public function load_styles_and_scripts() {
+ // Register all stylesheets
+ wp_register_style( 'geertdd', get_stylesheet_directory_uri() . '/css/geertdd.css', null, null );
+
+ // Register all JavaScript files
+ wp_register_script( 'modernizr', get_stylesheet_directory_uri() . '/js/modernizr.min.js', null, null );
+ wp_register_script( 'geertdd', get_stylesheet_directory_uri() . '/js/geertdd.js', array( 'modernizr', 'jquery' ), null, true );
+ wp_localize_script( 'geertdd', 'GEERTDD', array(
'theme_url' => get_stylesheet_directory_uri(),
- ));
+ ) );
- // Now load the ones I need
- wp_enqueue_style('geertdd');
- wp_enqueue_script('geertdd');
+ // Now load whatever needed
+ wp_enqueue_style( 'geertdd' );
+ wp_enqueue_script( 'geertdd' );
}
- public function clean_up_head()
- {
- remove_action('wp_head', 'wp_generator');
- remove_action('wp_head', 'rsd_link');
- remove_action('wp_head', 'wlwmanifest_link');
+ public function clean_up_head() {
+ remove_action( 'wp_head', 'wp_generator' );
+ remove_action( 'wp_head', 'rsd_link' );
+ remove_action( 'wp_head', 'wlwmanifest_link' );
}
}
View
4 header.php
@@ -11,9 +11,9 @@
<body <?php body_class() ?>>
<header>
- <?php if (is_front_page()) { ?>
+ <?php if ( is_front_page() ) { ?>
<h1>GeertDeDeckere.be</h1>
<?php } else { ?>
- <p><a href="<?php bloginfo('url') ?>">GeertDeDeckere.be</a></p>
+ <p><a href="<?php bloginfo( 'url' ) ?>">GeertDeDeckere.be</a></p>
<?php } ?>
</header>
View
2 home.php
@@ -1,6 +1,6 @@
<?php get_header() ?>
-<?php while (have_posts()) { the_post(); ?>
+<?php while ( have_posts() ) { the_post(); ?>
<ul>
<li><a href="<?php the_permalink() ?>"><?php the_title() ?></a></li>
View
2 index.php
@@ -1,6 +1,6 @@
<?php get_header() ?>
-<?php while (have_posts()) { the_post(); ?>
+<?php while ( have_posts() ) { the_post(); ?>
<article <?php post_class() ?>>
<h1><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h1>

0 comments on commit e147eb4

Please sign in to comment.
Something went wrong with that request. Please try again.