Opis
Potężna, a zarazem przyjazna dla użytkownika wtyczka, która automatycznie tworzy indeks kontekstowy lub spis treści (TOC) dla długich stron (i własnych typów treści). To coś więcej niż tylko wtyczka do spisu treści – ta wtyczka może również generować mapę witryny z listą stron i/lub kategorii w całej witrynie.
Spis treści, zaprojektowany od podstaw z myślą o Wikipedii, domyślnie pojawia się przed pierwszym nagłówkiem na stronie. Pozwala to autorowi na wstawienie treści wprowadzającej, która może podsumować lub wprowadzić resztę strony. Wykorzystuje również unikatowy schemat numeracji, który nie gubi się z powodu różnic w stylach CSS między motywami.
Ta wtyczka doskonale sprawdza się w przypadku witryn o dużej treści, takich jak witryny oparte na systemach zarządzania treścią (CMS). Blogerzy również mogą czerpać z niej korzyści, pisząc długie, ustrukturyzowane artykuły.
Zawiera panel opcji administracyjnych, w którym można dostosować ustawienia, takie jak pozycja wyświetlania, zdefiniować minimalną liczbę nagłówków przed wyświetleniem indeksu, inne ustawienia wyglądu i wiele innych. Zaawansowani użytkownicy mogą rozszerzyć opcje zaawansowane, aby dodatkowo dostosować działanie narzędzia – np. wykluczyć niepożądane poziomy nagłówków, takie jak h5 i h6, wyłączyć dane wyjściowe dołączonego pliku CSS, dostosować przesunięcie górnego wiersza i wiele więcej. Za pomocą krótkich kodów można zastąpić domyślne ustawienia, takie jak specjalne wykluczenia na konkretnej stronie, a nawet całkowicie ukryć spis treści.
Wolisz umieścić indeks na panelu bocznym? Przejdź do Wygląd > Widżety i przeciągnij Spis treści+ na wybrany panel boczny i ustaw go w odpowiedniej pozycji.
Obsługiwane są własne typy treści, jednak automatyczne wstawianie działa tylko wtedy, gdy własny typ treści użył metody the_content(). Każdy typ treści pojawi się w panelu opcji, więc włącz te, które chcesz.
Współpracuj, bierz udział, rozwidlaj tę wtyczkę na Github.
Krótkie kody
Wtyczka została zaprojektowana tak, aby była jak najbardziej płynna i bezproblemowa w obsłudze i nie wymagała wstawiania krótkiego kodu. Jednak użycie krótkiego kodu pozwala na pełną kontrolę położenia spisu treści na stronie. W tej wtyczce dostępne są następujące krótkie kody.
Jeśli atrybuty zostaną pominięte w poniższych krótkich kodach, zostaną one przywrócone do ustawień zdefiniowanych w Ustawieniach > Spis treści+. Szczegółowe informacje na ten temat znajdziesz w karcie Pomoc.
[toc]
Umożliwia wygenerowanie spisu treści w preferowanej pozycji. Przydatne dla witryn, które wymagają spisu treści tylko na kilku stronach. Obsługuje następujące atrybuty:
- „label”: tekst, tytuł spisu treści
- „no_label”: prawda/fałsz, pokazuje lub ukrywa tytuł
- „wrapping”: tekst, „lewy” lub „prawy”
- „heading_levels”: liczby, pozwala wybrać poziomy nagłówków, które mają zostać uwzględnione w spisie treści. Oddzielaj poziomy przecinkami. Przykład: uwzględnij nagłówki 3, 4 i 5, ale wyklucz pozostałe za pomocą
heading_levels="3,4,5" - „class”: tekst, wprowadź klasy CSS, które mają zostać dodane do kontenera. Oddziel kolejne klasy spacją.
- „start”: liczba, wyświetlana, gdy w treści występuje taka liczba nagłówków.
[no_toc]
Umożliwia wyłączenie spisu treści dla bieżącego wpisu, strony lub własnego typu treści.
[sitemap]
Generuje listę wszystkich stron i kategorii w Twojej witrynie. Możesz jej użyć w dowolnym wpisie, na dowolnej stronie, a nawet w widżecie tekstowym. Pamiętaj, że nie będzie ona zawierać indeksu wpisów, więc użyj sitemap_posts, jeśli potrzebujesz tej listy.
[sitemap_pages]
Umożliwia wydrukowanie listy samych stron. Akceptowane są następujące atrybuty:
- „heading”: liczba od 1 do 6, określająca, który nagłówek HTML należy zastosować
- „label”: tekst, tytuł listy
- „no_label”: prawda/fałsz, pokazuje lub ukrywa nagłówek listy
- „exclude”: identyfikatory stron lub kategorii, które chcesz wykluczyć
- „exclude_tree”: identyfikator strony lub kategorii, którą chcesz wykluczyć, wliczając wszystkich jej potomków
- „child_of”: „bieżący” lub identyfikator strony nadrzędnej. Domyślnie 0, co obejmuje wszystkie strony.
[sitemap_categories]
Tak samo jak [sitemap_pages], ale dla kategorii.
[sitemap_posts]
Umożliwia to wydrukowanie indeksu wszystkich opublikowanych wpisów na Twojej witrynie. Domyślnie wpisy są wyświetlane w kolejności alfabetycznej, pogrupowane według pierwszych liter. Akceptowane są następujące atrybuty:
- „order”: tekst, rosnąco lub malejąco
- „orderby”: tekst, popularne opcje to „title”, „date”, „ID” i „rand”. Zobacz WP_Query, aby zobaczyć listę.
- „separate”: prawda/fałsz (domyślnie prawda), po ustawieniu na fałsz listy nie są rozdzielane według pierwszej litery.
Aby dostosować wygląd swojej oferty, użyj następujących klas CSS:
- toc_sitemap_posts_section
- toc_sitemap_posts_letter
- toc_sitemap_posts_list
Autorzy
Ta wtyczka została stworzona i utrzymywana przez wiele lat przez conjur3r. Jesteśmy wdzięczni za całą jego ciężką pracę i z entuzjazmem będziemy ją rozwijać!
Zrzuty ekranu
Instalacja
Obowiązuje standardowy proces instalacji wtyczki, czyli wyszukaj spis treści plus na ekranie wtyczki lub ręcznie:
- Prześlij katalog
table-of-contents-plusdo katalogu/wp-content/plugins/ - Włącz wtyczkę w menu „Wtyczki” w WordPressie
To wszystko! Spis treści pojawi się na stronach z co najmniej czterema nagłówkami.
Możesz zmienić ustawienia domyślne i inne w Ustawieniach > Spis treści+
Recenzje
Kontrybutorzy i deweloperzy
„Spis treści Plus” jest oprogramowaniem open source. Poniższe osoby miały wkład w rozwój wtyczki.
ZaangażowaniWtyczka „Spis treści Plus” została przetłumaczona na 25 języków. Podziękuj tłumaczom za ich wkład.
Przetłumacz wtyczkę “Spis treści Plus” na swój język.
Interesuje cię rozwój wtyczki?
Przeglądaj kod, sprawdź repozytorium SVN lub czytaj dziennik rozwoju przez RSS.
Rejestr zmian
2411.1
- Released: 21 November 2024
- Security hardening reported by WPScan
2411
- Released: 14 November 2024
- Security hardening reported by Patchstack
- Plugin updates for compatibility with Plugin Check
2408
- Released: 14 August 2024
- Redo XSS issue reported by wpscan
2406
- Released: 16 June 2024
- Revert 'Do not output CSS/JS on pages not eligible’ introduced in 2402 as it broke some clever edge cases
- Fixed XSS issue requiring editor or higher privileges for show/hide text (thanks to wpscan)
2402.1
- Released: 22 February 2024
- Fixed check for shortcode use (#164)
2402
- Released: 21 February 2024
- Added option to generate TOC in REST requests, disabled by default (props ballpumpe)
- Composer improvements (props mohjak)
- Do not output CSS/JS on pages not eligible
- Update POT translation file
- Update links to help
2311
- Released: 7 November 2023
- Bump tested WordPress version to 6.4
- Do not trigger on REST requests (props steffenster)
- Update include mechanism in init.php (props maciejmackowiak)
2309
- Released: 19 September 2023
- Bump tested version to 6.3.1
- Added
child_ofproperty to sitemap_pages shortcode (props flagsoft). This lets you output a listing of child pages for a set parent or „current”. Property is optional and defaults to all pages. - Fixed XSS possibility handling nonce while saving options (thanks to Patchstack)
- Updated WordPress Coding Standard to 3.0
2302
- Released: 9 February 2023
- Added
toc_bracketsCSS class to square brackets around show/hide text - Added a filter to the
toc_extract_headingsfunction (props Raymond Radet) - Refactor using WordPress-Extra coding standard
2212
- Released: 16 December 2022
- Bump tested version to 6.1.1
- When using the TOC+ widget, execute shortcodes beforehand (props endcoreCL)
- When using the TOC+ widget, abort early when no post for edge cases (props jonas-hoebenreich)
- Add start property to toc shortcode to override the minimum number of headings needed to display (props woutervanvliet)
- Add no_numbers property to toc shortcode to disable leading heading indexes (props TedAvery)
- Fixed XSS vulnerability in toc shortcode, class property (thanks to wpscan)
- Fixed XSS vulnerabilities in sitemap_pages and sitemap_categories shortcodes, label property
2106
- Released: 23 June 2021
- Add compatibility with Rank Math SEO
- Bump tested WordPress version to 5.7
- Add PHP coding style
- Adhere to majority of coding tips
2002
- Released: 9 February 2020
- Fixed encoding when using %PAGE_TITLE% or %PAGE_NAME%
- Bump tested WordPress version to 5.3
- Removed all local translations as you can find more up to date ones at translate.wordpress.org
- Removed translators links from readme
1601
- Released: 5 January 2016
- Bump tested WordPress version to 4.4
- Add 'enable’ and 'disable’ API functions so a developer can better control the execution.
- Add Brazilian Portuguese translation thanks to Blog de Niterói
- Add Spanish translation thanks to David Saiz
- TOC+ widget now adheres to a blank title if none provided. Thanks to Dirk for the cue.
- Updated jQuery Smooth Scroll 1.5.5 to 1.6.0
- Updated text domain to better support translation packs.
1509
- Released: 4 September 2015
- Added Hebrew translation thanks to Ahrale
- Added Japaense translation thanks to シカマル
- Added Greek translation thanks to Dimitrios Kaisaris
- Updated jQuery Smooth Scroll 1.4.10 to 1.5.5
- Supply both minified and unminified CSS and JS files, use minified versions.
- Convert accented characters to ASCII in anchors.
- Bump tested WordPress version to 4.3
- Fixed: PHP notice introduced in WP 4.3
- Fixed: javascript error with $.browser testing for Internet Explorer 7.
- Plugin has moved to GitHub for better collaboration.
- Help needed: preg_match_all failing with bad UTF8 characters producing no TOC. If you can help, please participate in this issue.
1507
- Released: 5 July 2015
- Added Danish translation courtesy of Cupunu
- Simplified the translation duty by moving the help material to the plugin’s website.
- Updated translation file.
1505
- Released: 2 May 2015
- Huge thanks to Jason for an updated Simplified Chinese translation.
- Added collapse property to the toc shortcode. When set to true, this will hide the table of contents when it loads. Example usage: [toc collapse=”true”]
- Added label_show and label_hide properties to the toc shortcode. This lets you change the „show” and „hide” link text when using the shortcode.
- Bump tested WordPress version to 4.2.1.
1408
- Released: 1 August 2014
- Added a human German translation courtesy Ben
- Added „class” attribute to the TOC shortcode to allow for custom CSS classes to be added to the container. Thanks to Joe for suggesting it
1407
- Released: 5 July 2014
- Added Ukrainian translation courtesy Michael Yunat
- Added French translation courtesy Jean-Michel Duriez
- Empty headings are now ignored, as suggested by archon810
- Removed German translation, may have been machine translated, ref
- Fixed: Special chars in TOC+ > Settings > Exclude Headings no longer get mangled on save. Thanks to N-Z for reporting it.
1404
- Released: 18 April 2014
- Bump WordPress support to 3.9
- Fixed: Strip HTML tags from post titles for sitemap_posts so those items do not appear under a < heading. Thanks to Rose for reporting it.
- Fictitious: This release was powered by three blind mice.
1402
- Released: 19 February 2014
- Added German translation courtesy Cord Peter
- Modify toc_get_index API function to also reset minimum number of headings to 0.
- Removing the TOC+ widget from the sidebar no longer requires you to uncheck the 'Show the table of contents only in the sidebar’ option. It will be reset on removal.
- Delay count of headings until disqualified have been removed. Thanks to Simone di Saintjust for raising it.
- Using the TOC+ widget, you can now limit the display to selected post types. Thanks to Pete Markovic for the idea.
- Updated translation file (extra options added).
1311
- Released: 10 November 2013
- Added third parameter to toc_get_index API function to enable eligibility check (eg apply minimum heading check, is post type enabled, etc). This has been switched off by default and only affects those using the API. Thanks Jonon for your comment.
- Added Dutch translation courtesy Renee
- Apply bullet option to TOC+ widget, thanks to Thomas Pani for the patch.
1308
- Released: 5 August 2013
- Fix javascript issue with minimum jQuery version check (broke smooth scrolling using WordPress 3.6).
- Replaced Slovak translation with a human translated version courtesy Boris Gereg.
- Remove signature from source when using the shortcode but not allowed to print (eg on homepage).
- Add „separate” attribute for sitemap_posts shortcode to not split by letter, thanks DavidMjps for the suggestion.
1303.1
- Released: 22 March 2013
- New: added Polish translation, curtesy Jakub
- Fixed: an issue in 1303 that ignored headings with the opening tag on the first line and the heading text on a new line. Thanks to richardsng for the quick discovery.






