Last active
April 6, 2020 18:08
-
-
Save imath/74f8b1ee74e5b4c6c7d1be0986cbe7c4 to your computer and use it in GitHub Desktop.
Outputs the content of the Activity WordPress page into the BP Activity directory.
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 | |
/** | |
* BP Custom function file. | |
* | |
* Add this file into /wp-content/plugins/ to customize BuddyPress. | |
* | |
* @see https://codex.buddypress.org/themes/bp-custom-php/ | |
*/ | |
// Exit if accessed directly. | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
/** | |
* Outputs the content of the Activity WordPress page into the BP Activity directory. | |
*/ | |
function inclusion_du_contenu_de_la_page_wp() { | |
$queried_object = get_queried_object(); | |
if ( $queried_object && $queried_object instanceof WP_Post ) { | |
$post_content = get_the_content( null, false, $queried_object ); | |
remove_filter( 'the_content', 'bp_replace_the_content' ); | |
echo apply_filters( 'the_content', $post_content ); | |
add_filter( 'the_content', 'bp_replace_the_content' ); | |
} | |
} | |
add_action( 'bp_before_directory_activity', 'inclusion_du_contenu_de_la_page_wp' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment