WordPress Business Directory Plugin

  • Features
  • Pricing
  • Blog
  • Support
  • Login
  • Get Started

wpbdp-listing-buttons

Last Updated: December 18, 2020

  1. Home
  2. Knowledge Base
  3. Customizations
  4. Hooks - For Developers
  5. wpbdp-listing-buttons
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.

Make adjustments to the buttons before they are displayed on the page. This includes the edit and delete buttons on the single listing page, and on the page that shows all listings.

Usage

add_filter( 'wpbdp-listing-buttons', 'change_bd_buttons', 10, 2 );

Parameters

  • $buttons (string) The HTML to show.
  • $listing_id (int) The id of the listing.

Examples

Add a ‘View' button

This example will add a button to View the listing from the ‘All Listings' page.

add_filter( 'wpbdp-listing-buttons', 'bd_add_view_button', 10, 2 );
function bd_add_view_button ( $buttons, $listing_id ) {
  if ( is_singular( WPBDP_POST_TYPE ) || ! wpbdp_user_can( 'view', $listing_id ) ) {
    // Don't add the button if already on the single page.
    return $buttons;
  }

  $buttons .= '<a class="wpbdp-button button view-listing" href="' . esc_url( get_permalink() ) . '">View</a>';

  return $buttons;
}

Related Articles

  • wpbdp_admin_listing_owner_mode
  • wpbdp_custom_strings
  • wpbdp_region_find_args
  • wpbdp_field_schema_org
  • wpbdp_paid_listing_status
  • wpbdp_skip_page_1

Topics

  • Usage
  • Parameters
  • Examples
    • Add a ‘View’ button

Quick Links

  • Getting Started Guide
  • Knowledge Base
  • Change Log

Build Easy Directory Listings

Our WordPress directory plugin will help you create the online listings website you've been planning. And with our 14-day risk-free trial, there's no reason to wait.
Start earning customers today.

Get Business Directory Now

Resources

  • Blog
  • Contact
  • Video Tutorials
  • Affiliates
  • Best Directory Websites Showcase
  • Demo

Purchase

  • Pricing
  • Business Directory Themes
  • Free Business Directories

Our Brands

  • Formidable Forms
  • AWP Classifieds

Business Directory Plugin for WordPress

Copyright © 2010–2022 Strategy11 LLC
Privacy Policy | Terms of Service | Sitemap

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