Embedding content from one buddypress page into another
-
Hello, is it possible to embed the content of one buddypress page on another? Let’s say I wanted to content from the activities page on the profile page. I am having trouble doing this because the buddypress pages don’t have specific page Ids.
<?php
$include = get_pages(‘include=’);
$content = apply_filters(‘the_content’,$include[0]->post_content);
echo $content;
?>
-
– BuddyPress pages have all an ID.
– BP pages are not ordinary static WordPress page, but dynamic pages, a kind of placeholder. They have no content and are only existing to have a slug (and a ID for DB magement) for WP/BP dialog.
Eg.your-site/activity/
URL is empty when you deactivate BP.Let’s continue with the activity page as example.
This “page” is made of different parts, which are contextually loaded on their own template. Use the activity filter to see what is all coming up on the (url/activity/) page. About 10 items which would be 10 real pages on a WP site without BP ! And that’s just default. Many plugins use also BP’s activity…
For each component, there is a loop. As long as you are in such a loop, you can call what ever belong to that component from inside this loop. And for almost each loop, you have a template.
If you want the About page (default WP page) to show up on a profile, you load it on one of the profile templates, but not on the BP member page which is the “page” who host “profiles”, but also the “member director”y. And you don’t want About apearing there, isn’t it ? 😉
If you read the codex about theme develoment and template hierarchy, you may understand how all this is articulated.
This is probably bad practice, and I know it won’t actually combine the two pages into one, but I just simply copied the template file of the one I needed into the other and now both are integrating in a useful way. Now I just plan on redirecting the other page.
- You must be logged in to reply to this topic.