Last active
September 3, 2020 21:30
-
-
Save xnau/d93c36ceb9efd36ddfece57504641a62 to your computer and use it in GitHub Desktop.
Shows how to set up a custom "shortcode present" notification for Participants Database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: PDb Shortcode Placement Notification | |
* Description: Tells the Participants Database plugin that a shortcode is present on the page. | |
*/ | |
add_filter( 'pdb-shortcode_in_content', 'xnau_notify_shortcode_present', 10, 2 ); | |
/** | |
* tells the plugin that a shortcode is present | |
* | |
* @param bool $present | |
* @param WP_Post $post | |
*/ | |
function xnau_notify_shortcode_present( $present, $post ) | |
{ | |
// this is a list of all the pages that have PDB shortcodes | |
// you must edit this in order for it to work for you | |
// this must be the page's "slug name" | |
$pages = array( 'test-page' ); | |
if ( in_array( $post->post_name, $pages ) ) { | |
$present = true; | |
} | |
return $present; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment