Skip to content
Permalink
Browse files

= 1.3 =

* tested up WordPress 4.6.9
* added: option `hidecount` that disable displaying posts amount in category name
* added filter hooks:
 * `hierarchicalsitemap_category_title_html`
 * `hierarchicalsitemap_posts_list_html`
 * `hierarchicalsitemap_pages_list_html`
  • Loading branch information...
avovkdesign committed Jun 16, 2018
1 parent 466ccf0 commit fe7487eaec59a5f42d2f634f36ac4c6b6b80a124
@@ -1,8 +1,7 @@
# Hierarchical HTML Sitemap
**Contributors:** egolacrima, wppuzzle
**Tags:** html sitemap, seo, sitemap, hierarchical, posts, posts list, pages, pages list, shortcode
**Tags:** sitemap, html sitemap, seo, hierarchical sitemap, posts, posts list, pages, pages list, shortcode
**Donate link:** https://www.liqpay.com/ru/checkout/card/avovkdesin

**Requires at least:** 3.0
**Tested up to:** 4.9.6
**Stable tag:** 1.3
@@ -13,15 +12,13 @@ A lightweight and simple HTML sitemap for your WordPress blog.

## Description


Hierarchical HTML Sitemap offers visitors an easy and intuitive navigation across your blog.

This plugin generates HTML Sitemap of your WordPress blog. It displays a list of posts, grouped by hierarchically sorted categories. By using a shortcode you can easily and quickly display sitemap on a page, or anywhere where shortcodes work, e.g. in a widget.

The output does not include any CSS or JavaScript files - it is pure HTML, ready for you to style as you want it.

*Полное руководство по установке и использованию плагина на **русском языке** доступны на [блоге автора](http://avovkdesign.com/plugin-hierarchical-html-sitemap.html "Руководство по установке и настройке плагина Hierarchical HTML Sitemap").*



### Features:

@@ -36,8 +33,16 @@ The output does not include any CSS or JavaScript files - it is pure HTML, ready
* No ads nor author links.


### PRO Features

[Hierarchical HTML Sitemap Pro](https://wp-puzzle.com/hierarchical-html-sitemap/) allow:

### Options:
1. Extended sitemap settings
1. Shortcode generator
1. Qualified support


### Usage & Options:

The plugin’s shortcode `[htmlmap]` accepts several optional parameters:

@@ -91,10 +96,19 @@ Several parameters could be used in the same shortcode. For example:





## Changelog

### 1.3
* tested up WordPress 4.6.9
* tested up WordPress 4.6.9
* added: option `hidecount` that disable displaying posts amount in category name
* added filter hooks:
`hierarchicalsitemap_category_title_html`
`hierarchicalsitemap_posts_list_html`
`hierarchicalsitemap_pages_list_html`

### 1.2
* tested up to WordPress 4.7

### 1.1
* Fix: displaying empty categories (those without children posts but having non-empty sub-categories)
@@ -3,12 +3,31 @@
* Plugin Name: Hierarchical HTML Sitemap
* Description: Generates hierarchical HTML sitemap wich displays hierarchically sorted categories with posts links. You need add <code>[htmlmap]</code> shortcode at any page. It's working easy and fast. Super lightweight PHP code, without external CSS/JS files.
* Plugin URI: https://wp-puzzle.com/hierarchical-html-sitemap/
* Donate link: https://www.liqpay.com/ru/checkout/card/avovkdesin
* Author: Alexandra Vovk & WP Puzzle
* Version: 1.3
* Author URI: http://wp-puzzle.com/
* Donate link: https://www.liqpay.com/ru/checkout/card/avovkdesin
* Text Domain: hierarchical-html-sitemap
* Domain Path: /languages
* ==================================================================================================== */
__( "Hierarchical HTML Sitemap", 'hierarchical-html-sitemap' );
__( "Generates hierarchical HTML sitemap wich displays hierarchically sorted categories with posts links. You need add <code>[htmlmap]</code> shortcode at any page. It's working easy and fast. Super lightweight PHP code, without external CSS/JS files.", 'hierarchical-html-sitemap' );
/**
* Load textdomain
*
*/
function hierarchicalsitemap_load_textdomain() {
load_plugin_textdomain( 'hierarchical-html-sitemap', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
}
add_action( 'plugins_loaded', 'hierarchicalsitemap_load_textdomain' );
/**
*
@@ -22,37 +41,34 @@
*/
function hierarchicalsitemap_shortcode_htmlmap( $atts, $content = null ) {
// var_dump( $atts );
// defaults shortcode attributes
// $defaults = array(
// 'hidecloud' => false,
// 'showpages' => false,
// 'showdescription' => false,
// 'hidedate' => false,
// 'exclude' => '',
// 'exclude_cat' => '',
// );
// $atts = wp_parse_args( $atts, $defaults );
$hidecloud = ( '' != $atts && in_array( 'hidecloud', $atts ) ) ? 1 : 0;
$showpages = ( '' != $atts && in_array( 'showpages', $atts ) ) ? 1 : 0;
/* new params - showdescription, hidedate
/**
* new params - showdescription, hidedate
* @since v.1.1
*/
$showdescription = ( '' != $atts && in_array( 'showdescription', $atts ) ) ? 1 : 0;
$hidedate = ( '' != $atts && in_array( 'hidedate', $atts ) ) ? 1 : 0;
$hidecount = ( '' != $atts && in_array( 'hidecount', $atts ) ) ? 1 : 0;
/**
* @var string $exclude
* @var string $exclude_cat
* @var string $max_per_page
*/
extract( shortcode_atts( array( 'exclude' => '', 'exclude_cat' => '' ), $atts ) );
extract(
shortcode_atts(
array(
'exclude' => '',
'exclude_cat' => '',
),
$atts
)
);
$exclude = ( $exclude ) ? '&exclude=' . $exclude : '';
$exclude_cat = ( $exclude_cat ) ? '&exclude=' . $exclude_cat : '';
//$html = hierarchicalsitemap_hierarchical_category_tree( 0, $exclude, $exclude_cat, $hidecloud );
$html = hierarchicalsitemap_hierarchical_category_tree(
0,
$exclude,
@@ -61,11 +77,22 @@ function hierarchicalsitemap_shortcode_htmlmap( $atts, $content = null ) {
'hidecloud' => $hidecloud,
'showdescription' => $showdescription,
'hidedate' => $hidedate,
'hidecount' => $hidecount,
)
);
$out = ( $hidecloud ) ? "" : "<p id=\"htmlmap_cats\">" . substr( $html['cloud'], 2 ) . "</p>";
$out .= "<div id=\"htmlmap_posts\">" . $html['posts'] . "</div>";
$out .= ( $showpages ) ? hierarchicalsitemap_get_pages_list( $exclude ) : "";
/**
* Filters the posts list HTML.
*
* @since 1.3
*
* @param string $out Full posts list HTML code
*/
$out = apply_filters( 'hierarchicalsitemap_posts_list_html', $out );
$out .= ( $showpages ) ? hierarchicalsitemap_get_pages_list( $exclude ) : "";
return $out;
}
@@ -100,6 +127,7 @@ function hierarchicalsitemap_hierarchical_category_tree(
'hidecloud' => 1,
'showdescription' => 0,
'hidedate' => 0,
'hidecount' => 0,
),
$out = array( 'cloud' => '', 'posts' => '' )
) {
@@ -108,23 +136,41 @@ function hierarchicalsitemap_hierarchical_category_tree(
if ( $categories ) :
foreach ( $categories as $cat ) :
$out['cloud'] .= ', <span class="cat"><a href="#cat_' . $cat->term_id . '">$cat->name</a> <small>[' . $cat->count . ']</small></span>';
$out['cloud'] .= ', <span class="cat"><a href="#cat_' . $cat->term_id . '">' . $cat->name . '</a> <small>[' . $cat->count . ']</small></span>';
$tocloudlink = ( $arg['hidecloud'] ) ? "" : " <a href='#htmlmap_cats'>&uarr;</a>";
$tag = ( 0 == $cid ) ? "h2" : "h3";
$out['posts'] .= "\n<$tag id='cat_$cat->term_id'>" . $cat->name . " <small>[" . $cat->count . "]</small>" . $tocloudlink . "</$tag>\n";
$out['posts'] .= ( "" != $cat->category_description && $arg['showdescription'] ) ? "<p><i>" . $cat->category_description . "</i></p>\n" : '';
$out['posts'] .= "<ul>\n";
$tag = ( 0 == $cid ) ? "h2" : "h3";
$count_html = ( $arg['hidecount'] ) ? '' : " <small>[" . $cat->count . "]</small>";
$posts = get_posts( 'posts_per_page=-1&orderby=post_date&order=DESC&category__in=' . $cat->term_id . $ex );
/**
* Filters the category title html.
*
* @since 1.3
*
* @param string $cat ->name Category title.
* @param WP_Term $cat Category term object.
*/
$out['posts'] .= apply_filters(
'hierarchicalsitemap_category_title_html',
"\n<$tag id='cat_$cat->term_id'>" . $cat->name . $count_html . $tocloudlink . "</$tag>\n",
$cat->name,
$cat
);
$out['posts'] .= ( "" != $cat->category_description && $arg['showdescription'] ) ? "<p><i>" . $cat->category_description . "</i></p>\n" : '';
$out['posts'] .= "<ul>\n";
if ( count( $posts ) > 0 ) {
$cnt = 0;
foreach ( $posts as $post ) {
$cnt ++;
$date = explode( " ", $post->post_date );
$out['posts'] .= ( $arg['hidedate'] ) ? "<li>" : "<li><small>$date[0]</small>&nbsp;";
$out['posts'] .= "<a href=\"" . get_permalink( $post->ID ) . "\">$post->post_title</a>";
if ( $cnt == count( $posts ) ) {
$out = hierarchicalsitemap_hierarchical_category_tree(
$cat->term_id,
@@ -134,10 +180,13 @@ function hierarchicalsitemap_hierarchical_category_tree(
$out
);
}
$out['posts'] .= "</li>\n";
}
} // check empty category for all childrens and show it
else if ( 0 == count( $posts ) ) {
} else if ( 0 == count( $posts ) ) {
// check empty category for all childrens and show it
$out['posts'] .= '<li class="null" style="list-style:none">';
$out = hierarchicalsitemap_hierarchical_category_tree(
$cat->term_id,
@@ -150,6 +199,7 @@ function hierarchicalsitemap_hierarchical_category_tree(
}
$out['posts'] .= "</ul>\n";
endforeach;
endif;
@@ -162,20 +212,38 @@ function hierarchicalsitemap_hierarchical_category_tree(
/**
* get html pages list
*
* */
* @param $exclude
*
* @return string
*/
function hierarchicalsitemap_get_pages_list( $exclude ) {
$html = "<ul id=\"htmlmap_pages\">";
$pages = get_pages( $exclude );
foreach ( $pages as $page ) {
$id = $page->ID;
$title = $page->post_title;
$link = apply_filters( 'the_permalink', get_permalink( $id ) );
$html .= "<li><a href=\"$link\" title=\"$title\">$title</a></li>";
}
$html .= "</ul>";
return "<h2>" . __( "All Pages" ) . "</h2>" . $html;
/**
* Filters the pages list HTML.
*
* @since 1.3
*
* @param string $out Full pages list HTML code
*/
$html = apply_filters(
'hierarchicalsitemap_pages_list_html',
"<h2>" . __( "All Pages", 'hierarchical-html-sitemap' ) . "</h2>" . $html
);
return $html;
}
Binary file not shown.
@@ -0,0 +1,39 @@
msgid ""
msgstr ""
"Project-Id-Version: Hierarchical HTML Sitemap\n"
"POT-Creation-Date: 2018-06-16 06:58+0300\n"
"PO-Revision-Date: 2018-06-16 07:00+0300\n"
"Last-Translator: Alexandra Vovk <avovkdesign@gmail.com>\n"
"Language-Team: WP Puzzle <wppuzzle@gmail.com>\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.8\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
"X-Poedit-KeywordsList: __;_e;_x;_\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-SearchPath-0: ..\n"

#: ../hierarchical-sitemap.php:14
msgid "Hierarchical HTML Sitemap"
msgstr "Иерархическая HTML карта сайта"

#: ../hierarchical-sitemap.php:15
msgid ""
"Generates hierarchical HTML sitemap wich displays hierarchically sorted "
"categories with posts links. You need add <code>[htmlmap]</code> shortcode "
"at any page. It's working easy and fast. Super lightweight PHP code, without "
"external CSS/JS files."
msgstr ""
"Генерирует HTML карту сайта, которая выводит список записей, разбитых по "
"рубрикам и отсортированных с учётом вложенности (иерархии). Добавьте карту "
"сайта на любой странице шорткодом <code>[htmlmap]</code>. Плагин работает "
"быстро, имеет невероятно простой PHP код, не подключает никаких внешних CSS/"
"JS фалов."

#: ../hierarchical-sitemap.php:223
msgid "All Pages"
msgstr "Все страницы"
Binary file not shown.
@@ -0,0 +1,38 @@
msgid ""
msgstr ""
"Project-Id-Version: Hierarchical HTML Sitemap\n"
"POT-Creation-Date: 2018-06-16 06:58+0300\n"
"PO-Revision-Date: 2018-06-16 06:59+0300\n"
"Last-Translator: Alexandra Vovk <avovkdesign@gmail.com>\n"
"Language-Team: WP Puzzle <wppuzzle@gmail.com>\n"
"Language: uk\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.8\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
"X-Poedit-KeywordsList: __;_e;_x;_\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-SearchPath-0: ..\n"

#: ../hierarchical-sitemap.php:14
msgid "Hierarchical HTML Sitemap"
msgstr "Ієрархічна HTML карта сайту"

#: ../hierarchical-sitemap.php:15
msgid ""
"Generates hierarchical HTML sitemap wich displays hierarchically sorted "
"categories with posts links. You need add <code>[htmlmap]</code> shortcode "
"at any page. It's working easy and fast. Super lightweight PHP code, without "
"external CSS/JS files."
msgstr ""
"Генерує HTML карту сайту, яка виводить список записів, розбитих за рубриками "
"і відсортованих з урахуванням вкладеності (ієрархії). Додайте карту сайту на "
"будь-якій сторінці шорткодом <code>[htmlmap]</code>. Плагін працює швидко, "
"має неймовірно простий PHP код, не підключає ніяких зовнішніх CSS/JS фалів."

#: ../hierarchical-sitemap.php:223
msgid "All Pages"
msgstr "Всі сторінки"

0 comments on commit fe7487e

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