LuckyWP Table of Contents - Version 2.1.2

Version Description

2020-05-08 = + Added hook filter lwptoc_title_tag.

Download this release

Release Info

Developer theluckywp
Plugin Icon 128x128 LuckyWP Table of Contents
Version 2.1.2
Comparing to
See all releases

Code changes from version 2.1.1 to 2.1.2

front/Toc.php CHANGED
@@ -308,6 +308,7 @@ class Toc
308
  static::$currentOutputDepth = -1;
309
  return Core::$plugin->front->render('body', [
310
  'title' => ArrayHelper::getValue($attrs, 'title', Core::$plugin->settings->getGeneralTitle()),
 
311
  'toggle' => $toggle,
312
  'labelShow' => $labelShow,
313
  'labelHide' => $labelHide,
308
  static::$currentOutputDepth = -1;
309
  return Core::$plugin->front->render('body', [
310
  'title' => ArrayHelper::getValue($attrs, 'title', Core::$plugin->settings->getGeneralTitle()),
311
+ 'titleTag' => apply_filters('lwptoc_title_tag', 'b'),
312
  'toggle' => $toggle,
313
  'labelShow' => $labelShow,
314
  'labelHide' => $labelHide,
front/views/body.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
  /**
3
  * @var $title string
 
4
  * @var $toggle bool
5
  * @var $labelShow string
6
  * @var $labelHide string
@@ -21,7 +22,14 @@ echo $before . Html::beginTag('div', $containerOptions) . Html::beginTag('div',
21
  ?>
22
  <?php if ($toggle || $title) { ?>
23
  <div class="lwptoc_header"<?= $headerStyles ? ' style="' . implode('', $headerStyles) . '"' : '' ?>>
24
- <?= $title ? '<b class="lwptoc_title"' . ($titleStyles ? ' style="' . implode('', $titleStyles) . '"' : '') . '>' . $title . '</b>' : '' ?>
 
 
 
 
 
 
 
25
  <?php if ($toggle) { ?>
26
  <span class="lwptoc_toggle">
27
  <a href="#" class="lwptoc_toggle_label" data-label="<?= $hideItems ? $labelHide : $labelShow ?>"><?= $hideItems ? $labelShow : $labelHide ?></a>
@@ -29,7 +37,7 @@ echo $before . Html::beginTag('div', $containerOptions) . Html::beginTag('div',
29
  <?php } ?>
30
  </div>
31
  <?php } ?>
32
- <div class="lwptoc_items<?= $hideItems ? '' : ' lwptoc_items-visible'?>"<?= $itemsStyles ? ' style="' . implode('', $itemsStyles) . '"' : '' ?>>
33
  <?php lwptoc_items($items) ?>
34
  </div>
35
  <?= '</div></div>' . $after ?>
1
  <?php
2
  /**
3
  * @var $title string
4
+ * @var $titleTag string
5
  * @var $toggle bool
6
  * @var $labelShow string
7
  * @var $labelHide string
22
  ?>
23
  <?php if ($toggle || $title) { ?>
24
  <div class="lwptoc_header"<?= $headerStyles ? ' style="' . implode('', $headerStyles) . '"' : '' ?>>
25
+ <?php
26
+ if ($title) {
27
+ echo Html::tag($titleTag, $title, [
28
+ 'class' => 'lwptoc_title',
29
+ 'style' => $titleStyles ? implode('', $titleStyles) : null,
30
+ ]);
31
+ }
32
+ ?>
33
  <?php if ($toggle) { ?>
34
  <span class="lwptoc_toggle">
35
  <a href="#" class="lwptoc_toggle_label" data-label="<?= $hideItems ? $labelHide : $labelShow ?>"><?= $hideItems ? $labelShow : $labelHide ?></a>
37
  <?php } ?>
38
  </div>
39
  <?php } ?>
40
+ <div class="lwptoc_items<?= $hideItems ? '' : ' lwptoc_items-visible' ?>"<?= $itemsStyles ? ' style="' . implode('', $itemsStyles) . '"' : '' ?>>
41
  <?php lwptoc_items($items) ?>
42
  </div>
43
  <?= '</div></div>' . $after ?>
luckywp-table-of-contents.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: LuckyWP Table of Contents
4
  Plugin URI: https://theluckywp.com/product/table-of-contents/
5
  Description: Creates a table of contents for your posts/pages. Works automatically or manually (via shortcode, Gutenberg block or widget).
6
- Version: 2.1.1
7
  Author: LuckyWP
8
  Author URI: https://theluckywp.com/
9
  Text Domain: luckywp-table-of-contents
@@ -47,6 +47,6 @@ $lwptocAutoloader->register();
47
  $lwptocAutoloader->addNamespace('luckywp\tableOfContents', __DIR__);
48
 
49
  $config = require(__DIR__ . '/config/plugin.php');
50
- (new \luckywp\tableOfContents\plugin\Plugin($config))->run('2.1.1', __FILE__, 'lwptoc_');
51
 
52
  require_once __DIR__ . '/functions.php';
3
  Plugin Name: LuckyWP Table of Contents
4
  Plugin URI: https://theluckywp.com/product/table-of-contents/
5
  Description: Creates a table of contents for your posts/pages. Works automatically or manually (via shortcode, Gutenberg block or widget).
6
+ Version: 2.1.2
7
  Author: LuckyWP
8
  Author URI: https://theluckywp.com/
9
  Text Domain: luckywp-table-of-contents
47
  $lwptocAutoloader->addNamespace('luckywp\tableOfContents', __DIR__);
48
 
49
  $config = require(__DIR__ . '/config/plugin.php');
50
+ (new \luckywp\tableOfContents\plugin\Plugin($config))->run('2.1.2', __FILE__, 'lwptoc_');
51
 
52
  require_once __DIR__ . '/functions.php';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://theluckywp.com/product/table-of-contents/
4
  Tags: table of contents, toc, navigation, links, seo
5
  Requires at least: 4.7
6
  Tested up to: 5.4
7
- Stable tag: 2.1.1
8
  Requires PHP: 5.6.20
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -160,6 +160,9 @@ For non-English websites it is recommended to enable the `Intl` PHP extension.
160
 
161
  == Changelog ==
162
 
 
 
 
163
  = 2.1.1 — 2020-03-15 =
164
  * In heading ID duplicate hyphens are replaced with one.
165
  * Fixed: content of tags `<style>` and `<script>` was included in heading label.
4
  Tags: table of contents, toc, navigation, links, seo
5
  Requires at least: 4.7
6
  Tested up to: 5.4
7
+ Stable tag: 2.1.2
8
  Requires PHP: 5.6.20
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
160
 
161
  == Changelog ==
162
 
163
+ = 2.1.2 — 2020-05-08 =
164
+ + Added hook filter `lwptoc_title_tag`.
165
+
166
  = 2.1.1 — 2020-03-15 =
167
  * In heading ID duplicate hyphens are replaced with one.
168
  * Fixed: content of tags `<style>` and `<script>` was included in heading label.