Skip to content

Commit

Permalink
Version 1.2.5
Browse files Browse the repository at this point in the history
* Further improvements in the codebase (replaced custom functions with WordPress build-in alternatives)
  • Loading branch information
chemiker committed Jan 2, 2021
1 parent 4e2a3f3 commit 9b66e49
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 172 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

[![Maintainability](https://api.codeclimate.com/v1/badges/767420930abd5ede9110/maintainability)](https://codeclimate.com/github/chemiker/e.nigma-2015/maintainability) [![Build Status](https://travis-ci.com/chemiker/e.nigma-2015.svg?branch=master)](https://travis-ci.com/chemiker/e.nigma-2015)

![e.nigma 2015](https://github.com/chemiker/e.nigma-2015/raw/master/src/theme/screenshot.png)

## Installation

1. Download or clone the repository
Expand All @@ -21,6 +23,9 @@

## Changelog

### 1.2.5
* Further improvements in the codebase (replaced custom functions with WordPress build-in alternatives)

### 1.2.4
* Improved support for WordPress/Gutenberg blocks
* Improved sanitizing outputs
Expand Down
6 changes: 4 additions & 2 deletions src/sass/form.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* -------------------------------- Search & Form Elements */

input,
textarea {
textarea,
button {
font: 20px/1.5 $sans;
color: $darkbeige;
padding: 5px 10px 5px 10px;
Expand Down Expand Up @@ -31,7 +32,8 @@ input[type=search] {
-webkit-appearance: none;
}

input[type=submit] {
input[type=submit],
button {
cursor: pointer;
color: #7a7a7a;

Expand Down
43 changes: 22 additions & 21 deletions src/sass/navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,18 @@ header {
}
}

div.pagebar {
div.nav-links {
margin-top: -66px;
}

div.pagebar,
div.nav-links {
color: $darkbeige;
text-align: center;
padding: 80px 0 100px 0;
font-size: 0.8em;
border-top: 7px solid $darkbeige;
background-color: $beige;
margin-top: -66px;

&.sitepages {
margin-top: 0px;
Expand All @@ -119,16 +123,14 @@ div.pagebar {
display: inline-block;
}

span.page-numbers,
a.page-numbers {
font-size: 1.3em;
margin-right: 5px;
}

span.page-numbers {
color: $navigationbackground;
background-color: $darkbeige;
background-color: $beige;
border: 3px solid $navigationbackground;

&.dots {
border-width: 0px;
}
}

&.comment {
Expand All @@ -154,11 +156,17 @@ div.pagebar {
color: $beige;
background-color: $navigationbackground;
border: 3px solid $beige;

&:hover {
color: $navigationbackground;
border-color: $navigationbackground;
background-color: $beige;
}
}

&:hover,
&.active,
&.active:visited,
.active,
.active:visited,
&.page:hover,
&.page:focus,
&.next.page-numbers,
Expand All @@ -168,26 +176,19 @@ div.pagebar {
background-color: $beige;
}

&.page-numbers,
&.page-numbers:visited {
margin-right: 5px;
background-color: $darkbeige;
}

&.next.page-numbers,
&.prev.page-numbers {
font-size: 1.3em;
border: none;
display: inline;
font-weight: normal;
color: $beige;
background-color: $darkbeige;
color: $darkbeige;
background-color: none;
}
}
}

span.pagebar-category {
top: -30px !important;
top: 5px !important;
}

span.pagebar-category,
Expand Down
3 changes: 2 additions & 1 deletion src/theme/comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@
</ol>
</div>
</aside>
<?php endif;
<?php
endif;
16 changes: 6 additions & 10 deletions src/theme/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/

require 'functions/class-content.php';
require 'functions/class-helper.php';
require 'functions/class-widgets.php';
require 'functions/class-customizer.php';

Expand Down Expand Up @@ -130,23 +129,20 @@ function ( $return, $data, $url ) {
3
);

// Add next and number option to wp_link_pages().
add_filter( 'wp_link_pages_args', '\enigma\Helper::add_next_and_number' );

add_action(
'wp_enqueue_scripts',
function () {
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array( 'jquery' ), '1.2.4', true );
wp_enqueue_script( 'jquery-scrollupformenu', get_template_directory_uri() . '/js/jquery.scrollupformenu.min.js', array( 'jquery' ), '1.2.4', true );
wp_enqueue_script( 'jquery-enigma', get_template_directory_uri() . '/js/jquery.enigma.min.js', array( 'jquery' ), '1.2.4', true );
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array( 'jquery' ), '1.2.5', false );
wp_enqueue_script( 'jquery-scrollupformenu', get_template_directory_uri() . '/js/jquery.scrollupformenu.min.js', array( 'jquery' ), '1.2.5', false );
wp_enqueue_script( 'jquery-enigma', get_template_directory_uri() . '/js/jquery.enigma.min.js', array( 'jquery' ), '1.2.5', false );
}
);

add_action(
'wp_enqueue_scripts',
function () {
wp_enqueue_style( 'style', get_template_directory_uri() . '/css/screen.min.css', array( 'dashicons' ), '1.2.4', 'screen' );
wp_enqueue_style( 'style-print', get_template_directory_uri() . '/css/print.min.css', array( 'dashicons' ), '1.2.4', 'print' );
wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Raleway:100%7CRoboto+Slab:400,700%7COpen+Sans:400italic,400,700', array(), '1.2.4' );
wp_enqueue_style( 'style', get_template_directory_uri() . '/css/screen.min.css', array( 'dashicons' ), '1.2.5', 'screen' );
wp_enqueue_style( 'style-print', get_template_directory_uri() . '/css/print.min.css', array( 'dashicons' ), '1.2.5', 'print' );
wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Raleway:100%7CRoboto+Slab:400,700%7COpen+Sans:400italic,400,700', array(), '1.2.5' );
}
);
74 changes: 7 additions & 67 deletions src/theme/functions/class-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,75 +15,11 @@
* Prefetches content and provides it to the theme templates.
*/
class Content {
/**
* Pagebar Clone, originally created by [Sergej Müller](https://sergejmueller.github.io).
*
* @param integer $displayedpages Number of displayed pages.
*/
public static function pagebar( $displayedpages = 6 ) {
global $wp_query;
$max_num_pages = $wp_query->max_num_pages;

if ( $max_num_pages <= 1 ) {
return;
}

$page = (int) get_query_var( 'paged' );
$roundedrange = ceil( $displayedpages / 2 );

if ( ! $page ) {
$page = 1;
}

if ( $max_num_pages > $displayedpages ) {
if ( $page <= $displayedpages ) {
$min = 1;
$max = $displayedpages + 1;
} elseif ( $page >= ( $max_num_pages - $roundedrange ) ) {
$min = $max_num_pages - $displayedpages;
$max = $max_num_pages;
} elseif ( $page >= $displayedpages && $page < ( $max_num_pages - $roundedrange ) ) {
$min = $page - $roundedrange;
$max = $page + $roundedrange;
}
} else {
$min = 1;
$max = $max_num_pages;
}

if ( ! empty( $min ) && ! empty( $max ) ) {
for ( $i = $min; $i <= $max; $i++ ) {
echo sprintf(
' <a href="%s" %s>%d</a>',
get_pagenum_link( $i ),
( $i === $page ? 'class="page active"' : 'class="page"' ),
$i
);
}
}
}

/**
* Get_categories() fetches the post categories and provides them to the theme templates.
*/
public static function get_categories() {
$thecategories = get_the_category();
$numberofcategories = count( $thecategories );
$categories = '';

foreach ( $thecategories as $categorienumber => $category ) {
if ( $categorienumber === $numberofcategories - 1 ) {
$spacer = '';
} else {
$spacer = ', ';
}
$categories .= sprintf(
'<a href="%s">%s</a>%s',
get_category_link( $category->term_id ),
$category->name,
$spacer
);
}
$categories = get_the_category_list( ', ' );

if ( ! empty( $categories ) ) {
$categories = sprintf(
Expand Down Expand Up @@ -228,7 +164,9 @@ private static function get_content( $format ) {
return ( $oembed ? $oembed : get_post_meta( get_the_ID(), '_format_' . $format . '_embed', true ) ) . $content;
}

if ( 'image' === $format && $featured_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' ) ) {
$featured_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );

if ( $featured_image && 'image' === $format ) {
return '<img class="hide" src="' . $featured_image[0] . '" alt="' . get_the_title() . '" />' . $content;
}

Expand Down Expand Up @@ -258,7 +196,9 @@ private static function get_class( $format, $class = '' ) {
* @return string
*/
private static function get_css( $format, $css = '' ) {
if ( 'image' === $format && $featured_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' ) ) {
$featured_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );

if ( $featured_image && 'image' === $format ) {
$css = "style=\"background-image: url( '" . $featured_image[0] . "' )\"";
}

Expand Down
4 changes: 3 additions & 1 deletion src/theme/functions/class-customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ public static function register( $wp_customize ) {
array(
'default' => __( 'Welcome to my blog', 'e.nigma-2015' ),
'type' => 'theme_mod',
'sanitize_callback' => function ( $input ) { return wp_kses_post( $input ); }
'sanitize_callback' => function ( $input ) {
return wp_kses_post( $input );
},
)
);

Expand Down
49 changes: 0 additions & 49 deletions src/theme/functions/class-helper.php

This file was deleted.

16 changes: 9 additions & 7 deletions src/theme/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@
if ( $wp_query->max_num_pages > 1 ) :
?>
<span class="category pagebar-category enigma-icon" data-icon="&#62256;"></span>
<div class="pagebar">
<?php
previous_posts_link();
\enigma\Content::Pagebar();
next_posts_link();
?>
</div>
<?php
the_posts_pagination(
array(
'type' => 'plain',
'prev_text' => '&laquo; ' . esc_html__( 'Previous page', 'e.nigma-2015' ),
'next_text' => esc_html__( 'Next page', 'e.nigma-2015' ) . ' &raquo;',
)
);
?>
<?php
endif;
?>
Expand Down
3 changes: 3 additions & 0 deletions src/theme/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ If using the "image" post-type it is recommended to set the image you want to sh

## Changelog

### 1.2.5
* Further improvements in the codebase (replaced custom functions with WordPress build-in alternatives)

### 1.2.4
* Improved support for WordPress/Gutenberg blocks
* Improved sanitizing outputs
Expand Down
14 changes: 1 addition & 13 deletions src/theme/single.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,7 @@
<?php echo apply_filters( 'the_content', $post_vars['content'] ); ?>
<?php if ( $numpages > 1 ) : ?>
<div class="pagebar sitepages">
<?php
wp_link_pages(
array(
'before' => '',
'after' => '',
'nextpagelink' => esc_html__( 'Next Page &raquo;', 'e.nigma-2015' ),
'previouspagelink' => esc_html__( '&laquo; Previous Page', 'e.nigma-2015' ),
'next_or_number' => 'next_and_number',
'pagelink' => '%',
'echo' => 1,
)
);
?>
<?php wp_link_pages(); ?>
</div>
<?php endif; ?>
<div class="post-meta">
Expand Down
2 changes: 1 addition & 1 deletion src/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Theme Name: e.nigma 2015
Description: e.nigma 2015 is a light-weight, modern and simple WordPress theme. It is thought to be used with WordPress posts formats.
Author: Alexander Lüken
Version: 1.2.4
Version: 1.2.5
Theme URI: https://sciolism.de/projects/e.nigma-2015/
Author URI: https://sciolism.de
Tested up to: 5.6
Expand Down

0 comments on commit 9b66e49

Please sign in to comment.