Skip to content

Commit

Permalink
grand cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nstaeger committed Sep 3, 2015
1 parent 4a3860b commit 8d9a57b
Show file tree
Hide file tree
Showing 21 changed files with 141 additions and 196 deletions.
67 changes: 31 additions & 36 deletions comments.php
Original file line number Diff line number Diff line change
@@ -1,83 +1,78 @@
<?php
/**
* Template for displaying comments and the comment-form
*
* @author nstaeger
* @since 2014-10-04
*/

/*
* If the current post is protected by a password and the visitor has not yet
* entered the password we will return early without loading the comments.
*/
// If the current post is protected by a password and the visitor has not yet
// entered the password we will return early without loading the comments.
if (post_password_required()) {
return;
return;
}

/**
* Settings for the Comment-Form
*/
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$required = ( $req ? ' aria-required="true" required' : '' );
$req = get_option('require_name_email');
$required = ($req ? ' aria-required="true" required' : '');

$form_args = array(
'fields' => apply_filters('comment_form_default_fields', array(
'fields' => apply_filters('comment_form_default_fields', array(
'author' =>
'<div class="comment-form-author uk-form-row">'
. '<label for="author" class="uk-form-label">'
. __( 'Name', 'domainreference' )
. ( $req ? ' <span class="required">*</span>' : '' )
. __('Name', 'domainreference')
. ($req ? ' <span class="required">*</span>' : '')
. '</label>'
. '<div class="uk-form-controls">'
. '<input id="author" class="uk-width-1-1" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $required . ' />'
. '<input id="author" class="uk-width-1-1" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $required . ' />'
. '</div>'
. '</div>',
'email' =>
'email' =>
'<div class="comment-form-email uk-form-row">'
. '<label for="email" class="uk-form-label">'
. __( 'Email', 'domainreference' )
. ( $req ? ' <span class="required">*</span>' : '' )
. __('Email', 'domainreference')
. ($req ? ' <span class="required">*</span>' : '')
. '</label>'
. '<div class="uk-form-controls">'
. '<input id="email" class="uk-width-1-1" name="email" type="email" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $required . ' />'
. '<input id="email" class="uk-width-1-1" name="email" type="email" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $required . ' />'
. '</div>'
. '</div>',
'url' =>
'url' =>
'<div class="comment-form-url uk-form-row">'
. '<label for="url" class="uk-form-label">'
. __( 'Website', 'domainreference' )
. __('Website', 'domainreference')
. '</label>'
. '<div class="uk-form-controls">'
. '<input id="url" class="uk-width-1-1" name="url" type="url" value="' . esc_attr($commenter['comment_author_url']) . '" size="30" />'
. '<input id="url" class="uk-width-1-1" name="url" type="url" value="' . esc_attr($commenter['comment_author_url']) . '" size="30" />'
. '</div>'
. '</div>',
)),
'comment_field' =>
'comment_field' =>
'<div class="comment-form-comment uk-form-row">'
. '<label for="comment" class="uk-form-label">'
. _x( 'Comment', 'noun' )
. ' <span class="required">*</span>'
. _x('Comment', 'noun')
. ' <span class="required">*</span>'
. '</label>'
. '<div class="uk-form-controls">'
. '<textarea id="comment" class="uk-width-1-1" name="comment" cols="45" rows="8" aria-required="true" required ></textarea>'
. '<textarea id="comment" class="uk-width-1-1" name="comment" cols="45" rows="8" aria-required="true" required ></textarea>'
. '</div>'
. '</div>',
'comment_notes_after' =>
'<p class="form-allowed-tags">'
. sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), ' <pre><code>' . allowed_tags() . '</code></pre>' )
. sprintf(__('You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s'), ' <pre><code>' . allowed_tags() . '</code></pre>')
. '</p>'
);

?>

<section id="comments" class="comments-area">

<?php if ( have_comments() ) : ?>
<?php if (have_comments()) : ?>

<h2 class="nst-comments-title">Comments</h2>

<?php if (get_comment_pages_count() > 1 && get_option( 'page_comments' )) : ?>
<?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : ?>
<nav class="nst-comments-navigation">
<h3 class="uk-hidden">Comment Navigation</h3>
<ul class="uk-pagination">
Expand All @@ -89,16 +84,16 @@

<ul class="uk-comment-list">
<?php
wp_list_comments(array(
'style' => 'ul',
'short_ping' => true,
'avatar_size'=> 56,
'walker' => new WordpressUikitCommentsWalker()
));
wp_list_comments(array(
'style' => 'ul',
'short_ping' => true,
'avatar_size' => 56,
'walker' => new WordpressUikitCommentsWalker()
));
?>
</ul>

<?php if (get_comment_pages_count() > 1 && get_option( 'page_comments' )) : ?>
<?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : ?>
<nav class="nst-comments-navigation">
<h3 class="uk-hidden">Comment Navigation</h3>
<ul class="uk-pagination">
Expand All @@ -108,7 +103,7 @@
</nav>
<?php endif; ?>

<?php if ( ! comments_open() ) : ?>
<?php if (!comments_open()) : ?>
<p>Comments are closed.</p>
<?php endif; ?>

Expand Down
14 changes: 8 additions & 6 deletions elements/base-footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

$nav_footer = wp_nav_menu(array(
'theme_location' => 'footer',
'menu_class' => 'uk-subnav uk-subnav-line',
'depth' => 1,
'walker' => new WordpressUikitMenuWalker('inline'),
'echo' => false,
'fallback_cb' => false
'menu_class' => 'uk-subnav uk-subnav-line',
'depth' => 1,
'walker' => new WordpressUikitMenuWalker('inline'),
'echo' => false,
'fallback_cb' => false
));

?>
Expand All @@ -25,7 +25,9 @@

<div class="uk-margin-bottom uk-text-center uk-text-muted">
<div class="uk-panel">
<p>uikit-starter theme made by <a href="http://www.nstaeger.de/" class="uk-link-reset" target="_blank">nstaeger.de</a></p>
<p>uikit-starter theme made by
<a href="http://www.nstaeger.de/" class="uk-link-reset" target="_blank">nstaeger.de</a>
</p>
</div>
</div>
</div>
Expand Down
23 changes: 10 additions & 13 deletions elements/base-navigation.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
<?php
/**
* element for navigation and offcanvas navigation
*
* @author nstaeger
* @since 2014-08-31
*/

$nav = wp_nav_menu(array(
'theme_location' => 'main',
'menu_class' => 'uk-navbar-nav uk-hidden-small',
'depth' => 2,
'walker' => new WordpressUikitMenuWalker('navbar'),
'echo' => false,
'fallback_cb' => false
'menu_class' => 'uk-navbar-nav uk-hidden-small',
'depth' => 2,
'walker' => new WordpressUikitMenuWalker('navbar'),
'echo' => false,
'fallback_cb' => false
));

$nav_offcanvas = wp_nav_menu(array(
'theme_location' => 'main',
'menu_class' => 'uk-nav uk-nav-offcanvas',
'depth' => 2,
'walker' => new WordpressUikitMenuWalker('navbar'),
'echo' => false,
'fallback_cb' => false
'menu_class' => 'uk-nav uk-nav-offcanvas',
'depth' => 2,
'walker' => new WordpressUikitMenuWalker('navbar'),
'echo' => false,
'fallback_cb' => false
));

?>
Expand Down
3 changes: 0 additions & 3 deletions elements/base-postcontent.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
* should be rendered directly after the dynamic content
* handles displaying of the sidebar (or no sidebar)
* must be opend via the element precontent
*
* @author nstaeger
* @since 2014-10-24
*/
?>

Expand Down
3 changes: 0 additions & 3 deletions elements/base-precontent.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
* should be rendered directly before the dynamic content
* handles displaying of the sidebar (or no sidebar)
* must be closed via the element postcontent
*
* @author nstaeger
* @since 2014-10-24
*/
?>

Expand Down
8 changes: 2 additions & 6 deletions elements/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@
*
* Used for both single and index/archive/search.
*
* TODOs
* - Categories: only print if any set
* - Localize
*
* @author nstaeger
* @since 2014-08-31
* TODO Categories: only print if any set
* TODO Localize
*/
?>

Expand Down
3 changes: 0 additions & 3 deletions footer.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?php
/**
* The Footer template
*
* @author nstaeger
* @since 2014-08-31
*/
?>
<?php wp_footer(); ?>
Expand Down
4 changes: 2 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
/**
* Theme setup function
*/
if (!function_exists('wp_uikit_starter_setup'))
{
if (!function_exists('wp_uikit_starter_setup')) {
function wp_uikit_starter_setup()
{
global $theme;
$theme = new Theme();
}

add_action('after_setup_theme', 'wp_uikit_starter_setup');
}
11 changes: 4 additions & 7 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
*
* Displays all of the <head> section and everything up till
* and the opening body-tag
*
* @author nstaeger
* @since 2014-08-31
*/


Expand All @@ -21,16 +18,16 @@
<html <?php language_attributes(); ?> class="uk-height-1-1">
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta charset="<?php bloginfo('charset'); ?>"/>
<meta name="viewport" content="width=device-width, initial-scale=1">

<title><?php wp_title('-', true, 'right'); ?></title>

<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/main.css" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>"/>
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/main.css"/>

<script src="<?php echo get_template_directory_uri(); ?>/js/all.min.js"></script>

<?php wp_head(); ?>
</head>

Expand Down
31 changes: 11 additions & 20 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
<?php
/**
* The main template file
*
* @author nstaeger
* @since 2014-08-31
*/

get_header();
get_template_part('elements/base', 'header');
get_template_part('elements/base', 'navigation');
?>

get_template_part('elements/base', 'precontent');

<?php
get_template_part('elements/base', 'precontent');
if (have_posts()) {
while (have_posts()) {
the_post();
get_template_part('elements/content'/*, get_post_format()*/);
}

// Previous/next page navigation.
echo $theme->helpers->getPostsPagination();
if (have_posts()) {
while (have_posts()) {
the_post();
get_template_part('elements/content'/*, get_post_format()*/);
}
else {
echo '<p>Nothing found here. Sorry!</p>';
}
get_template_part('elements/base', 'postcontent');
?>

// Previous/next page navigation.
echo $theme->helpers->getPostsPagination();
} else {
echo '<p>Nothing found here. Sorry!</p>';
}

<?php
get_template_part('elements/base', 'postcontent');

get_template_part('elements/base', 'footer');
get_footer();
3 changes: 1 addition & 2 deletions php/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@

/**
* This class is responsible for setting up all theme-specific stuff.
*
* @author Nicolai Stäger
*/
class Theme
{

public $filters;
public $helpers;
public $menus;
Expand Down
12 changes: 4 additions & 8 deletions php/ThemeFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

/**
* Manages all filter-related modifications.
*
* @author Nicolai Stäger
*/
class ThemeFilters
{
Expand All @@ -17,12 +15,10 @@ public function __construct()
/**
* Create custom title element
*
* @param string $title
* Default title text for current view.
* @param string $sep
* Optional separator.
* @return string
* The filtered title.
* @param string $title Default title text for current view.
* @param string $sep Optional separator.
*
* @return string The filtered title.
*/
public function titleFilter($title, $sep)
{
Expand Down
Loading

0 comments on commit 8d9a57b

Please sign in to comment.