Kocuj Sitemap plugin adds shortcode [KocujSitemap] that puts the sitemap in the place where it is located. This allows you to display links to all of your posts, pages, menu items, authors, tags and custom types entries anywhere on your website – even within the article. There is also a PHP function that allows you to place the sitemap anywhere....
Kocuj Sitemap plugin adds shortcode [KocujSitemap]
that puts the sitemap in the place where it is located. This allows you to display links to all of your posts, pages, menu items, authors, tags and custom types entries anywhere on your website – even within the article. There is also a PHP function that allows you to place the sitemap anywhere on the website. There is also possibility to use the widget to place a sitemap anywhere in the sidebar.
This plugin supports multilingual websites. If you have installed the plugin compatible with Kocuj Sitemap plugin (currently it is qTranslate X), the plugin will generate a sitemap on your website in accordance with the currently selected language. If you do not have the plugin that supports multilingualism, Kocuj Sitemap plugin will display a sitemap for the default language defined for your WordPress installation.
The sitemap is automatically generated and stored in the cache, which is used in the sitemap to avoid using the database when loading your website, after each change of any element in the administration panel (for example, when you change a post). This process speeds up the loading of the sitemap on your website.
The Kocuj Sitemap plugin can be used in standard or in multisite WordPress installation.
Features
- Compatibility with HTML 5,
- Multilingual websites support (with qTranslate X plugin),
- Fast operation due to use of the cache,
- Displaying posts, pages, menu items, authors, tags and custom types entries (with custom taxonomies),
- Displaying all elements with dividing it by sections or without it,
- Ability to change order of displayed entries,
- Ability to exclude selected entries,
- Ability to hide selected element types, for example, all posts,
- Easily adding of the sitemap by using a shortcode with help of HTML or visual editor button,
- Possibility to set left margin for each level in multi-level sitemap if theme has problems with displaying such a list,
- Many configuration options,
- Many filters for better control of the plugin.
Requirements
This plugin requires PHP 5.x (from 5.3) or PHP 7.x and WordPress 4.9 or greater. It works in standard and multisite WordPress environments. It is strongly recommended to use WordPress in the newest version. This plugin uses shortcodes so in Gutenberg (a WordPress editor from version 5.0) it will not work as block and shortcode should be added manually.
How to use
There are few possibilities to display the sitemap:
* by using a shortcode [KocujSitemap]
inside a post of any type,
* by displaying a widget,
* by using the PHP function anywhere in the code, for example, inside a theme.
The shortcode [KocujSitemap]
has optional parameters:
homelinktext
– text that will be used as the text for the link to the main page,
class
– name of the style sheet class that will be added to the block element (div
or nav
) containing the entire sitemap,
excludepost
– comma separated list of identifiers for posts of any type (posts, pages, custom types entries) to exclude,
excludecategory
– comma separated list of identifiers for post categories to exclude,
excludeauthor
– comma separated list of identifiers for authors to exclude,
excludeterm
– comma separated list of identifiers for post categories, post tags or custom taxonomies to exclude,
hidetypes
– comma separated list of element types to hide; it can contains the following types: “author” (to hide authors), “custom” (to hide custom post types), “home” (to hide link to homepage), “menu” (to hide menus), “page” (to hide pages), “post” (to hide posts), “tag” (to hide tags).
For example, if you use [KocujSitemap homelinktext="NEW LINK TEXT" class="new_class"]
, the sitemap will be displayed in the block element (div
or nav
) with the CSS class new_class
and link to the home page with text NEW LINK TEXT
.
If you add other parameters, for example [KocujSitemap homelinktext="NEW LINK TEXT" class="new_class" excludepost="5,6" excludeterm="12" hidetypes="page"]
, the sitemap will be displayed in the block element (div
or nav
) with the CSS class new_class
, link to the home page with text NEW LINK TEXT
, there will be not displayed posts of any type with identifiers 5 and 6 and post tags and custom taxonomies with identifier 12 and all pages will be not displayed.
Instead of using the shortcode, you can edit the PHP file responsible for the theme. Kocuj Sitemap plugin defines global PHP function which declaration is as follows:
. The parameters $homeLinkText
and $class
perform the same function as the corresponding parameters in the shortcode [KocujSitemap]
.
For example, if you use
, the sitemap will be displayed in the block element (div
or nav
) with the CSS class new_class
and link to the home page with text NEW LINK TEXT
.
More things should be sayed about $exclude
parameter. It should contains an array of identifiers categorized (with correct key identifier) by entry type to exclude. There are the following entries types available:
post
– for excluding posts of any type (posts, pages, custom types entries),
category
– for excluding post categories,
author
– for excluding authors,
term
– for excluding post categories, post tags or custom taxonomies.
For example, the $exclude
array containing array('post' => array(5, 6), 'term' => array(12))
will exclude posts of any type with identifiers 5 and 6 and post tags and custom taxonomies with identifier 12.
The parameter $hideTypes has list of elements types to hide. It can contains the following types: “author” (to hide authors), “custom” (to hide custom post types), “home” (to hide link to homepage), “menu” (to hide menus), “page” (to hide pages), “post” (to hide posts), “tag” (to hide tags).
For example, the $hideTypes
array containing array('post', 'page')
will hide all posts and pages.
There is also possibility to use widget. It has possibility to display the sitemap as standard or drop-down list. It has also the possibility to exclude selected elements or hide the selected elements types from the sitemap.
Configuration
There is option Sitemap in the administration panel, which is used to configure the behavior of the Kocuj Sitemap plugin. If you select any submenu item from the Sitemap menu, you will find yourself in a place where you can set specific options for the plugin.
The settings on each administration page are divided into tabs. There can be active only one tab at once. Tab is selected by clicking on its name.
Each tab contains a set of options. Each option has a description that is displayed when you set mouse cursor over it. You can also see more detailed information by clicking a Help button on top of the page.
Changes in the configuration can be saved by clicking on the Save settings button. There is a possibility to restore the settings that were set after installing the plugin, by selecting an option Restore settings in the plugin menu.
Remember, that removing the plugin will clean all its options saved into the database.
CSS classes
The Kocuj Sitemap plugin displays a sitemap using a few CSS classes, so you can customize the look of the sitemap to your requirements.
There are the following CSS classes available:
kocujsitemap
– used by main container for the sitemap (nav
or div
) in shortcode, PHP function and widget,
kocujsitemapwidget
– used by main container for the sitemap (nav
or div
) in the widget,
kocujsitemap-home
– used by
element in the sitemap when the link is to the home page,
kocujsitemap-post
– used by
element in the sitemap when the link is to the post of any type (post, page, custom type entry),
kocujsitemap-category
– used by
element in the sitemap when the link is to the post category,
kocujsitemap-term
– used by
element in the sitemap when the link is to the post tags or custom taxonomy,
kocujsitemap-author
– used by
element in the sitemap when the link is to the author,
kocujsitemap-unknown
– used by
element in the sitemap when the link is to something different than all above (for example, link to other website).
Planned features
- Generating one sitemap for all blogs in multisite installation,
- Creating more than one sitemap,
- Easy control of shortcode parameters in HTML and visual editor,
- Generating XML sitemap for search engines.
Contact
If you have any suggestion, feel free to use the contact form at http://kocujsitemap.wpplugin.kocuj.pl/contact/.
If you want to have a regular information about this plugin, please become a fan of plugin on Facebook: http://www.facebook.com/kocujsitemap
See also official plugin website: http://kocujsitemap.wpplugin.kocuj.pl
For developers
The Kocuj Sitemap plugin contains a set of filters that allow you to change some behavior of the plugin. This allows you to adapt the plugin to the requirements of the developer of another plugin or theme without making changes to the code in Kocuj Sitemap plugin.
Kocuj Sitemap plugin contains the following filters:
kocujsitemap_additional_multiple_languages_php_classes
Parameters:
- array – a list of additional PHP classes that support multilingual plugins and they are not built-in into the Kocuj Sitemap plugin
Returned value:
- array – a list of PHP classes that support multilingual plugins and they are not built-in into the Kocuj Sitemap plugin
Description:
This filter adds a PHP class for supporting multilingual websites. To add a new PHP class, you need to add a new element to array which contains the following fields:
filename
– full path to the file with a new PHP class,
class
– PHP class name.
More information about this functionality can be found by looking into file classes/multiple-languages/template-for-developers/some-plugin.class.php which can be a good start point for developer of another PHP class. Remember, that this PHP class should implements the interface \KocujSitemapPlugin\Interfaces\Language.
kocujsitemap_default_custom
Parameters:
- array – a list of custom post types slugs
Returned value:
- array – a list of custom post types slugs
Description:
This filter sets the default list of custom post types that appear in the sitemap if the list in the “custom post types posts list options” in administration panel is empty.
kocujsitemap_default_exclude_author
Parameters:
- string – comma separated list with authors identifiers to exclude
Returned value:
- string – comma separated list with authors identifiers to exclude
Description:
This filter sets the default authors list to exclude in shortcode [KocujSitemap]
.
kocujsitemap_default_exclude_category
Parameters:
- string – comma separated list with post categories identifiers to exclude
Returned value:
- string – comma separated list with post categories identifiers to exclude
Description:
This filter sets the default post categories list to exclude in shortcode [KocujSitemap]
.
kocujsitemap_default_exclude_post
Parameters:
- string – comma separated list with posts, pages and custom types posts identifiers to exclude
Returned value:
- string – comma separated list with posts, pages and custom types posts identifiers to exclude
Description:
This filter sets the default posts list to exclude in shortcode [KocujSitemap]
.
kocujsitemap_default_exclude_term
Parameters:
- string – comma separated list with post tags and custom taxonomies identifiers to exclude
Returned value:
- string – comma separated list with post tags and custom taxonomies identifiers to exclude
Description:
This filter sets the default post tags and custom taxonomies list to exclude in shortcode [KocujSitemap]
.
kocujsitemap_default_home_link_text
Parameters:
- string – text with default text for link to the main page
- string – current locale
Returned value:
- string – text with default text for link to the main page
Description:
This filter sets the default text that is used in the link to the main page in the sitemap. It is used if there is not specified homelinktext
parameter in the [KocujSitemap]
shortcode or if there is not specified $homeLinkText
parameter in the kocujsitemap_show_sitemap
PHP function.
kocujsitemap_default_main_css_class
Parameters:
- string – text with all default CSS classes for a sitemap container (block element
div
or nav
)
Returned value:
- string – text with all default CSS classes for a sitemap container (block element
div
or nav
)
Description:
This filter sets the default CSS class that is used in the block element of the sitemap. It is used if there is not specified class
parameter in the [KocujSitemap]
shortcode or if there is not specified $class
parameter in the kocujsitemap_show_sitemap
PHP function.
kocujsitemap_default_menus
Parameters:
- array – a list of menus identifiers
Returned value:
- array – a list of menus identifiers
Description:
This filter sets the default list of menus that appear in the sitemap if the list in the “menus list options” in administration panel is empty.
kocujsitemap_element
Parameters:
- string – text for link to current element (the entire HTML tag
)
- int – element identifier or 0 for link to the main page
- string – element type; available values: “post” for post, “page” for page, “menu” for menu item, “category” for post category, “author” for author, “tag” for post tag, “custom” for custom post type entry, “taxonomy” for custom taxonomy and “home” for link to the main page
- string – current locale
Returned value:
- string – text for link to current element (the entire HTML tag
)
Description:
This filter sets the text for link to current element.
kocujsitemap_element_home_link_text_position
Parameters:
- int – position of text in link to main page
- string – text for link to current element (the entire HTML tag
)
- string – current locale
Returned value:
- int – position of text in link to main page
Description:
This filter sets the position of text in link to main page. For example, if link is Main page
, the position of text in link to the main page will be set to 14
.
kocujsitemap_first_element_css_class
Parameters:
- string – text with CSS class for first element in the sitemap
Returned value:
- string – text with CSS class for first element in the sitemap
Description:
This filter sets the CSS class that is used in the first element of the sitemap.
kocujsitemap_link_text
Parameters:
- string – text with link text
- int – element identifier or 0 for link to the main page
- string – element type; available values: “post” for post, “page” for page, “menu” for menu item, “category” for post category, “author” for author, “tag” for post tag, “custom” for custom post type entry, “taxonomy” for custom taxonomy and “home” for link to the main page
- string – current locale
Returned value:
- string – text with link text
Description:
This filter sets the link text.
kocujsitemap_widget_default_exclude_author
Parameters:
- string – comma separated list with authors identifiers to exclude
Returned value:
- string – comma separated list with authors identifiers to exclude
Description:
This filter sets the default authors list to exclude in the widget.
kocujsitemap_widget_default_exclude_category
Parameters:
- string – comma separated list with post categories identifiers to exclude
Returned value:
- string – comma separated list with post categories identifiers to exclude
Description:
This filter sets the default post categories list to exclude in the widget.
kocujsitemap_widget_default_exclude_post
Parameters:
- string – comma separated list with posts, pages and custom types posts identifiers to exclude
Returned value:
- string – comma separated list with posts, pages and custom types posts identifiers to exclude
Description:
This filter sets the default posts list to exclude in the widget.
kocujsitemap_widget_default_exclude_term
Parameters:
- string – comma separated list with post tags and custom taxonomies identifiers to exclude
Returned value:
- string – comma separated list with post tags and custom taxonomies identifiers to exclude
Description:
This filter sets the default post tags and custom taxonomies list to exclude in the widget.
shortcode_atts_kocujsitemap
Parameters:
- array – output array of shortcode attributes
- array – accepted parameters and their defaults
- array – input array of shortcode attributes
Returned value:
- array – output array of shortcode attributes
Description:
This filter changes attributes for the [KocujSitemap]
shortcode.
Be Part of the Conversation with WordPress Enthusiasts
Using Kocuj Sitemap? Great, join the conversation now!
Let’s talk about overall quality, ease of use, stellar support, unbeatable value, and the amazing experience Kocuj Sitemap brings to you.