Last active
July 25, 2019 19:57
-
-
Save matadorjobs/215ec3ea648e10dbe8154abcc6695472 to your computer and use it in GitHub Desktop.
Add "Page Builder" Shortcodes before and after Matador Job Description
This file contains hidden or 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 // do not include opening PHP tag unless required | |
/** | |
* Matador Docs : Adding "Page Builder" shortcodes before/after job description | |
* | |
* @author Jeremy Scott, Paul Bearne, Matador Software LLC https://matadorjobs.com | |
* | |
* @param $content | |
* | |
* @return string | |
*/ | |
function matadordocs_the_content( $content ) { | |
if ( ! is_singular( 'matador-job-listings' ) ) { | |
return $content; | |
} | |
ob_start(); | |
?> | |
EVERYTHING FOR BEFORE THE JOB DESCRIPTION HERE. | |
<?php | |
$before = ob_get_clean(); | |
ob_start(); | |
?> | |
EVERYTHING FOR AFTER THE JOB DESCRIPTION HERE. | |
<?php | |
$after = ob_get_clean(); | |
ob_end_flush(); | |
return do_shortcode( $before . $content . $after ); | |
} | |
// Later priority of at least 50 recommended. | |
add_filter( 'the_content', 'matadordocs_the_content', 50 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment