Make your own custom BuddyPress page
-
The title of this post makes it a little hard to grasp what I’m talking about, but in short this is a really quick and easy way to make your own hard coded BuddyPress page without going into the WordPress page admin.
In this example we’re going to make a page called “fun” that you can visit at domain.com/fun.
Put the following In your home theme’s functions.php file…
define('BP_EXAMPLE_SLUG', 'fun');
function bp_show_example_page() {
global $bp, $current_blog;
if ( $bp->current_component == BP_EXAMPLE_SLUG && $bp->current_action == '' ) {
// The first variable here must match the name of your template file below
bp_core_load_template( 'fun', true );
}
}
add_action( 'wp', 'bp_show_example_page', 2 );Now you need to create a fun.php file (mentioned above) in your home theme directory, and inside that file put…
<?php get_header(); ?>
<h3>Hello</h3>
<p>I am an example page.</p>
<?php get_footer(); ?>This could be used to make custom a custom login page, or whatever you’d like…
All we did here was swipe the exact code BP already uses for the /register and /activate pages, and simplify it for our own use.
Have fun!
You must be logged in to reply to this topic.
