Docs & Support

Learn about all Business Directory’s features and get support from our amazing customer success team.

CustomizationsHooks – For Developers
wpbdp_before_category_page

wpbdp_before_category_page

Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don’t provide support for code customizations or 3rd party development.

Add content at the top of the category pages.

Usage

add_action( 'wpbdp_before_category_page', 'add_my_custom_cat_message' );

Parameters

  • $category (object)

Examples

Add text for one category

Display a message on top of every category page, with a special message (“Everybody likes pizza”) for just the category with slug “pizza”.

function pizza_places_message( $category ) {
    if ( 'pizza' == $category->slug ) {
        echo "<p>Everybody likes pizza.</p>";
    } else {
        echo "<p>This is category {$category->name}.</p>";
    }
}
add_action( 'wpbdp_before_category_page', 'pizza_places_message' );
Was this article helpful? *

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

In this article

    We have a small, but amazing team of dedicated people who are committed to helping you achieve your goals and project requirements.


    Copyright © 2010-2025 S11 Directories, LLC.

    Join 20,000+ using Business Directory Plugin to build website directories fast. Get Started