For developers

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:

  1. array - a list of additional PHP classes that support multilingual plugins and they are not built-in into the Kocuj Sitemap plugin

Returned value:

  1. 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:

  1. array - a list of custom post types slugs

Returned value:

  1. 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:

  1. string - comma separated list with authors identifiers to exclude

Returned value:

  1. 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:

  1. string - comma separated list with post categories identifiers to exclude

Returned value:

  1. 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:

  1. string - comma separated list with posts, pages and custom types posts identifiers to exclude

Returned value:

  1. 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:

  1. string - comma separated list with post tags and custom taxonomies identifiers to exclude

Returned value:

  1. 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:

  1. string - text with default text for link to the main page
  2. string - current locale

Returned value:

  1. 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:

  1. string - text with all default CSS classes for a sitemap container (block element div or nav)

Returned value:

  1. 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:

  1. array - a list of menus identifiers

Returned value:

  1. 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:

  1. string - text for link to current element (the entire HTML tag <a>)
  2. int - element identifier or 0 for link to the main page
  3. 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
  4. string - current locale

Returned value:

  1. string - text for link to current element (the entire HTML tag <a>)

Description:

This filter sets the text for link to current element.

kocujsitemap_element_home_link_text_position

Parameters:

  1. int - position of text in link to main page
  2. string - text for link to current element (the entire HTML tag <a>)
  3. string - current locale

Returned value:

  1. 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 <a href="mainpage.html">Main page</a>, the position of text in link to the main page will be set to 14.

kocujsitemap_first_element_css_class

Parameters:

  1. string - text with CSS class for first element in the sitemap

Returned value:

  1. 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:

  1. string - text with link text
  2. int - element identifier or 0 for link to the main page
  3. 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
  4. string - current locale

Returned value:

  1. string - text with link text

Description:

This filter sets the link text.

kocujsitemap_widget_default_exclude_author

Parameters:

  1. string - comma separated list with authors identifiers to exclude

Returned value:

  1. 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:

  1. string - comma separated list with post categories identifiers to exclude

Returned value:

  1. 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:

  1. string - comma separated list with posts, pages and custom types posts identifiers to exclude

Returned value:

  1. 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:

  1. string - comma separated list with post tags and custom taxonomies identifiers to exclude

Returned value:

  1. 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:

  1. array - output array of shortcode attributes
  2. array - accepted parameters and their defaults
  3. array - input array of shortcode attributes

Returned value:

  1. array - output array of shortcode attributes

Description:

This filter changes attributes for the [KocujSitemap] shortcode.