Skip to content

Instantly share code, notes, and snippets.

@imath
Last active April 6, 2020 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imath/74f8b1ee74e5b4c6c7d1be0986cbe7c4 to your computer and use it in GitHub Desktop.
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.
<?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