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' );

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support