Peer Categories

Peer Categories

Wordpress plugin

Install on Wordpress

App Details

This plugin provides a template tag which acts a modified version of WordPress’s built-in template tag, the_category(). the_category() lists all categories directly assigned to the specified post. c2c_peer_categories() lists those categories PLUS any categories that are peer to those categories and MINUS categories that are parents to other assigned categories. Peer categories are categories that all share the same category parent.

For example, assume your category structure is hierarchical and looks like this:

Vegetables |-- Leafy | |-- Broccoli | |-- Bok Choy | |-- Celery |-- Fruiting | |-- Bell Pepper | |-- Cucumber | |-- Pumpkin |-- Podded | |-- Chickpea | |-- Lentil | |-- Soybean 

If you directly assigned the categories “Fruiting” and “Pumpkin” to a post, peer_categories() would return a list that consists of: “Bell Pepper”, “Cucumber”, and “Pumpkin”. Notice that since “Fruiting” was a parent to a directly assigned category, it and its peers are not included in the list. If only “Fruiting” were selected as a category, then “Leafy”, “Fruiting”, and “Podded” would have been listed.

By default, categories are listed as an HTML list. The first argument to the template tag allows you to define a custom separator, e.g. to have a simple comma-separated list of peer categories: <?php c2c_peer_categories(','); ?>.

As with categories listed via the_category(), categories that are listed are presented as links to the respective category’s archive page.

Example usage (based on preceding example):

  • <?php c2c_peer_categories(); ?>

Outputs something like:

<ul><li><a href="https://example.com/category/fruiting/bell-pepper">Bell Pepper</a></li> <li><a href="https://example.com/category/fruiting/cucumber">Cucumber</a></li> <li><a href="https://example.com/category/fruiting/pumpkin">Pumpkin</a></li></ul> 
  • <?php c2c_peer_categories( ',' ); ?></ul>

Outputs something like:

<a href="https://example.com/category/fruiting/bell-pepper">Bell Pepper</a>, <a href="https://example.com/category/fruiting/cucumber">Cucumber</a>, <a href="https://example.com/category/fruiting/pumpkin">Pumpkin</a> 

Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage

Developer Documentation

Developer documentation can be found in DEVELOPER-DOCS.md. That documentation covers the template tags and hooks provided by the plugin.

As an overview, these are the template tags provided by the plugin:

  • c2c_peer_categories() : Outputs the peer categories.
  • c2c_get_peer_categories_list() : Returns the list of peer categories.
  • c2c_get_peer_categories() : Returns the list of peer categories for the specified post.

These are the hooks provided by the plugin:

  • c2c_peer_categories (action), c2c_get_peer_categories_list, c2c_get_peer_categories (filters) :
    Allows for an alternative approach to safely invoke each of the identically named functions in such a way that if the plugin were deactivated or deleted, then your calls to the functions won’t cause errors on your site.
  • c2c_peer_categories_list (filter) :
    Customizes the return value of the c2c_peer_categories_list() function.
  • c2c_get_peer_categories_omit_ancestors (filter) :
    Customizes the function argument indicating if ancestor categories of all directly assigned categories (even if directly assigned themselves) should be omitted from the return list of categories.

Pricing

Starting from $0 per month.

Check Out the Vimeo Slider Widget

By Common Ninja

Vimeo SliderTry For Free!

App Info

Rating

Reviewers

No reviews

Tags

category
coffee2code
related posts
the_category

Developed By

Scott Reilly

Quick & Easy

Find the Best Wordpress plugins for you

Common Ninja has a large selection of powerful Wordpress plugins that are easy to use, fully customizable, mobile-friendly and rich with features — so be sure to check them out!

Testimonial

Testimonial plugins for Wordpress

Galleries

Galleries plugins for Wordpress

SEO

SEO plugins for Wordpress

Contact Form

Contact Form plugins for Wordpress

Forms

Forms plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Sliders

Sliders plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Comments

Comments plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Maps

Maps plugins for Wordpress

Security

Security plugins for Wordpress

Translation

Translation plugins for Wordpress

Ads

Ads plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Music Player

Music Player plugins for Wordpress

Backup

Backup plugins for Wordpress

Privacy

Privacy plugins for Wordpress

Optimize

Optimize plugins for Wordpress

Chat

Chat plugins for Wordpress

Countdown

Countdown plugins for Wordpress

Email Marketing

Email Marketing plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Membership

Membership plugins for Wordpress

popup

popup plugins for Wordpress

SiteMap

SiteMap plugins for Wordpress

Payment

Payment plugins for Wordpress

Coming Soon

Coming Soon plugins for Wordpress

Ecommerce

Ecommerce plugins for Wordpress

Customer Support

Customer Support plugins for Wordpress

Inventory

Inventory plugins for Wordpress

Video Player

Video Player plugins for Wordpress

Testimonials

Testimonials plugins for Wordpress

Tabs

Tabs plugins for Wordpress

Social Sharing

Social Sharing plugins for Wordpress

Social Feeds

Social Feeds plugins for Wordpress

Slider

Slider plugins for Wordpress

Reviews

Reviews plugins for Wordpress

Portfolio

Portfolio plugins for Wordpress

Membership

Membership plugins for Wordpress

Forms

Forms plugins for Wordpress

Events Calendar

Events Calendar plugins for Wordpress

Contact

Contact plugins for Wordpress

Comments

Comments plugins for Wordpress

Analytics

Analytics plugins for Wordpress

Common Ninja Apps

Some of the best Common Ninja plugins for Wordpress

Browse our extensive collection of compatible plugins, and easily embed them on any website, blog, online store, e-commerce platform, or site builder.

Vimeo Slider for Wordpress logo

Vimeo Slider

Show Vimeo videos with a Vimeo slider that displays clips in a smooth slider to boost engagement and keep visitors watching.

RSVP Form for Wordpress logo

RSVP Form

Collect event responses with an RSVP form that lets guests register easily, saves submissions, sends notifications, and helps you organize attendance efficiently.

Nudge Button for Wordpress logo

Nudge Button

Nudge button with a subtle shaking animation that draws attention to important calls to action, increases interaction, and helps boost conversions.

Payment Method Logos for Wordpress logo

Payment Method Logos

Show payment method logos that highlight accepted payment options, build trust at checkout, and help visitors feel confident completing their purchase.

YouTube Slider for Wordpress logo

YouTube Slider

Show YouTube videos with a YouTube slider that displays clips in a smooth, customizable layout to boost engagement.

Pricing Tables for Wordpress logo

Pricing Tables

Add pricing tables to your site to present plans clearly, help visitors compare features, and guide them toward faster and more confident conversions.

All In One Chat for Wordpress logo

All In One Chat

Add a unified chat tool to your site that connects users via WhatsApp, Messenger, Telegram, or email for seamless support.

Social Proof Avatars for Wordpress logo

Social Proof Avatars

Display social proof avatars that show user activity and ratings, build trust instantly, and help visitors feel confident about your credibility.

Marketing Button for Wordpress logo

Marketing Button

Marketing button with text and an icon that highlights key offers, draws attention to promotions, and helps increase engagement and conversions.

G2 Reviews for Wordpress logo

G2 Reviews

Show G2 reviews to build trust, strengthen credibility, and help visitors make confident SaaS buying decisions that support higher sales.

Countdown for Wordpress logo

Countdown

Add a countdown timer to your site to highlight upcoming events or launches and encourage timely user action.

Diagrams for Wordpress logo

Diagrams

Create interactive diagrams with a diagrams widget that lets you build and customize flow charts, improve clarity, and help visitors understand complex ideas easily.

More plugins

plugins You Might Like

Discover Apps By Platform

Discover the best apps for your website

WordPress
Wix
Shopify
Weebly
Webflow
Joomla
PrestaShop
Shift4Shop
WebsiteX5
MODX
Opencart
NopCommerce

Common Ninja Search Engine

The Common Ninja Search Engine platform helps website builders find the best site widgets, apps, plugins, tools, add-ons, and extensions! Compatible with all major website building platforms - big or small - and updated regularly, our Search Engine tool provides you with the business tools your site needs!

Multiple platforms