Skip to content

Commit

Permalink
Font awesome updated to FA5, New pagination methos. version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitT committed Apr 28, 2018
1 parent 94b607c commit 712e60b
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 173 deletions.
4 changes: 2 additions & 2 deletions archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@

// End while

if (function_exists('emm_paginate')) {
if (function_exists('podium_pagination')) {

emm_paginate();
podium_pagination();

}

Expand Down
6 changes: 5 additions & 1 deletion assets/styles/_includes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@
//--------------------------------------------------------------
//# Font Awesome
//--------------------------------------------------------------
@import '../../node_modules/font-awesome/scss/font-awesome';
@import '../../node_modules/@fortawesome/fontawesome-free-webfonts/scss/fontawesome';
@import '../../node_modules/@fortawesome/fontawesome-free-webfonts/scss/fa-brands';
@import '../../node_modules/@fortawesome/fontawesome-free-webfonts/scss/fa-regular';
@import '../../node_modules/@fortawesome/fontawesome-free-webfonts/scss/fa-solid.scss';

//--------------------------------------------------------------
//# Common
Expand All @@ -78,6 +81,7 @@
//--------------------------------------------------------------
//# Pages
//--------------------------------------------------------------
@import 'pages/archive';
@import 'pages/front-page';
@import 'pages/contact';
@import 'pages/post';
Expand Down
11 changes: 11 additions & 0 deletions assets/styles/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -866,3 +866,14 @@ $grid-padding-gutters: $grid-margin-gutters;
$grid-container-padding: $grid-padding-gutters;
$grid-container-max: $global-width;
$xy-block-grid-max: 8;

// Font Awesome 5 Variables
// --------------------------

$fa-font-path: "../fonts";
$fa-font-size-base: $global-font-size;
// $fa-css-prefix: fa;
// $fa-version: "5.0.10";
// $fa-border-color: #eee;
// $fa-inverse: #fff;
// $fa-li-width: 2em;
17 changes: 17 additions & 0 deletions assets/styles/pages/_archive.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.pagination {
display: block;
.page-numbers{

}
ul{

}
li{
display: inline-block;
}
}


.pagination > a:hover, span.current {

}
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ GULP.task( 'images-min', function ( ) {
} );

const FONT_FILES = [
'node_modules/font-awesome/fonts/*',
'node_modules/@fortawesome/fontawesome-free-webfonts/webfonts/*',
'assets/fonts/**/*'
];

Expand Down
187 changes: 27 additions & 160 deletions inc/pagination.php
Original file line number Diff line number Diff line change
@@ -1,165 +1,32 @@
<?php
/*******************************
PAGINATION
********************************
* Retrieve or display pagination code.
* http://www.ericmmartin.com/pagination-function-for-wordpress/
*
* The defaults for overwriting are:
* 'page' - Default is null (int). The current page. This function will
* automatically determine the value.
* 'pages' - Default is null (int). The total number of pages. This function will
* automatically determine the value.
* 'range' - Default is 3 (int). The number of page links to show before and after
* the current page.
* 'gap' - Default is 3 (int). The minimum number of pages before a gap is
* replaced with ellipses (...).
* 'anchor' - Default is 1 (int). The number of links to always show at begining
* and end of pagination
* 'before' - Default is '<div class="emm-paginate">' (string). The html or text
* to add before the pagination links.
* 'after' - Default is '</div>' (string). The html or text to add after the
* pagination links.
* 'title' - Default is '__('Pages:')' (string). The text to display before the
* pagination links.
* 'next_page' - Default is '__('&raquo;')' (string). The text to use for the
* next page link.
* 'previous_page' - Default is '__('&laquo')' (string). The text to use for the
* previous page link.
* 'echo' - Default is 1 (int). To return the code instead of echo'ing, set this
* to 0 (zero).
*
* @author Eric Martin <[email protected]>
* @copyright Copyright (c) 2009, Eric Martin
* @version 1.0
*
* @param array|string $args Optional. Override default arguments.
* @return string HTML content, if not displaying.
*/

/**
* @param $args
* @return mixed
*/
function emm_paginate($args = null)
function podium_pagination()
{
$defaults = [
'page' => null, 'pages' => null,
'range' => 3, 'gap' => 3, 'anchor' => 1,
'before' => '<div class="emm-paginate">', 'after' => '</div>',
'title' => '',
'nextpage' => __('&raquo;'), 'previouspage' => __('&laquo'),
'echo' => 1
];

$r = wp_parse_args($args, $defaults);
extract($r, EXTR_SKIP);

if (!$page && !$pages) {

global $wp_query;

$page = get_query_var('paged');
$page = !empty($page) ? intval($page) : 1;

$posts_per_page = intval(get_query_var('posts_per_page'));
$pages = intval(ceil($wp_query->found_posts / $posts_per_page));

}

$output = '';

if ($pages > 1) {

$output .= "$before";
$ellipsis = "<span class='emm-gap'>...</span>";

if ($page > 1 && !empty($previouspage)) {

$output .= "<a href='" . get_pagenum_link($page - 1) . "' class='emm-prev'>$previouspage</a>";

}

$min_links = $range * 2 + 1;
$block_min = min($page - $range, $pages - $min_links);
$block_high = max($page + $range, $min_links);
$left_gap = (($block_min - $anchor - $gap) > 0) ? true : false;
$right_gap = (($block_high + $anchor + $gap) < $pages) ? true : false;

if ($left_gap && !$right_gap) {

$output .= sprintf('%s%s%s',
emm_paginate_loop(1, $anchor),
$ellipsis,
emm_paginate_loop($block_min, $pages, $page)
);

} elseif ($left_gap && $right_gap) {

$output .= sprintf('%s%s%s%s%s',
emm_paginate_loop(1, $anchor),
$ellipsis,
emm_paginate_loop($block_min, $block_high, $page),
$ellipsis,
emm_paginate_loop(($pages - $anchor + 1), $pages)
);

} elseif ($right_gap && !$left_gap) {

$output .= sprintf('%s%s%s',
emm_paginate_loop(1, $block_high, $page),
$ellipsis,
emm_paginate_loop(($pages - $anchor + 1), $pages)
);

} else {

$output .= emm_paginate_loop(1, $pages, $page);

}

if ($page < $pages && !empty($nextpage)) {

$output .= "<a href='" . get_pagenum_link($page + 1) . "' class='emm-next'>$nextpage</a>";

}

$output .= $after;
}

if ($echo) {

echo $output;

}

return $output;
}

/**
* Helper function for pagination which builds the page links.
*
* @access private
*
* @version 1.0
* @author Eric Martin <[email protected]>
* @copyright Copyright (c) 2009, Eric Martin
*
* @param int $start The first link page.
* @param int $max The last link page.
* @return int $page Optional, default is 0. The current page.
*/
function emm_paginate_loop($start, $max, $page = 0)
{
$output = '';

for ($i = $start; $i <= $max; $i++) {

$output .= (intval($i) === $page)
? "<span class='emm-page emm-current'>$i</span>"
: "<a href='" . get_pagenum_link($i) . "' class='emm-page'>$i</a>";

global $wp_query;

$next_arrow = is_rtl() ? '<i title="Next Posts" class="fas fa-chevron-left"></i>' : '<i title="Next Posts" class="fas fa-chevron-right"></i>';
$prev_arrow = is_rtl() ? '<i title="Previous Posts" class="fas fa-chevron-right"></i>' : '<i title="Previous Posts" class="fas fa-chevron-left"></i>';

$total = $wp_query->max_num_pages;

$big = 999999999; // This neeFds to be an unlikely integer

// For more options and info view the docs for paginate_links()
// http://codex.wordpress.org/Function_Reference/paginate_links
$paginate_links = paginate_links([
'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
'current' => max(1, get_query_var('paged')),
'total' => $total,
'show_all' => false,
'prev_text' => $prev_arrow,
'next_text' => $next_arrow,
'type' => 'list'
]);

// Display the pagination if more than one page is found
if ($paginate_links) {
echo '<div class="pagination">';
echo $paginate_links;
echo '</div>';
}

return $output;
}
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@

}

if (function_exists('emm_paginate')) {
if (function_exists('podium_pagination')) {

emm_paginate();
podium_pagination();

}

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "podium",
"version": "1.9.6",
"version": "1.9.8",
"author": "Amit Tal",
"homepage": "https://github.com/AmitT/podium/",
"private": true,
Expand All @@ -25,7 +25,7 @@
"build:production": "gulp production"
},
"dependencies": {
"font-awesome": "~4.7.0",
"@fortawesome/fontawesome-free-webfonts": "^1.0.6",
"foundation-sites": "~6.4.3"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions search.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@

}

if (function_exists('emm_paginate')) {
if (function_exists('podium_pagination')) {

emm_paginate();
podium_pagination();

}

Expand Down
10 changes: 7 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# yarn lockfile v1


"@fortawesome/fontawesome-free-webfonts@^1.0.6":
version "1.0.6"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free-webfonts/-/fontawesome-free-webfonts-1.0.6.tgz#3dd13aa1a7466bff8fb0a401e1771c011ef2ca14"

"@gulp-sourcemaps/[email protected]":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@gulp-sourcemaps/identity-map/-/identity-map-1.0.1.tgz#cfa23bc5840f9104ce32a65e74db7e7a974bbee1"
Expand Down Expand Up @@ -2493,9 +2497,9 @@ form-data@~2.3.1:
combined-stream "1.0.6"
mime-types "^2.1.12"

foundation-sites@~6.4.4-rc1:
version "6.4.4-rc1"
resolved "https://registry.yarnpkg.com/foundation-sites/-/foundation-sites-6.4.4-rc1.tgz#8b645679d6f8e59717b22abea14accc4e32eefea"
foundation-sites@~6.4.3:
version "6.4.3"
resolved "https://registry.yarnpkg.com/foundation-sites/-/foundation-sites-6.4.3.tgz#ea89eb599badf6f03dd526c51f00bdb942a844f6"
dependencies:
jquery ">=3.0.0"
what-input "^4.1.3"
Expand Down

0 comments on commit 712e60b

Please sign in to comment.