Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

Extra Page’s in BuddyPress (19 posts)

Started 2 years ago by: sofastop

  • Hi,

    When you create an extra page through dashboard, is they’re any way you can edit it through a text editor rather than dashboard. Or is there any known way of how to solve this problem

  • Can anyone help please?

  • Profile picture of modemlooper modemlooper said 2 years ago:

    What are you trying to accomplish? You can create page templates and hard code a page.

  • @Modemlooper can you really, I have went into the Dashboard and set up to page’s but having less control of them is making me angry lol! I want to have full control over how I style them etc,. How do I create a page template so that I can hard code them?

  • Anyone please?

  • Profile picture of dre1080 dre1080 said 2 years ago:

    add this to your bp-custom.php or functions.php file:

    /*Define slugs*/
    define(‘BP_EXAMPLE_SLUG’, ‘example’); /* this will show up as http://yourdomain.com/example */

    /*Add slug as a root component*/
    function page_setup_root_component()
    {
    bp_core_add_root_component( BP_EXAMPLE_SLUG );
    }
    add_action( ‘plugins_loaded’, ‘page_setup_root_component’, 2 );

    /*Show defined slug*/
    function bp_show_page() {
    global $bp, $current_blog;

    if ( $bp->current_component == BP_EXAMPLE_SLUG && $bp->current_action == ” ) {
    bp_core_load_template( ‘example’, true ); /*replace example with the name that of the template you upload*/
    }
    }
    add_action( ‘wp’, ‘bp_show_page’, 2 );

    /*For extra functionality you can add a title for that page*/
    function page_titles( $title, $b ) {
    global $bp;

    if ( $bp->current_component == BP_Example_SLUG && $bp->current_action == ” ) {
    $title = __( ‘Example’, ‘buddypress’ ); /*change Example with what you want the title of your page to be*/
    }
    return $title;
    }
    add_filter( ‘bp_page_title’, ‘page_titles’, 10, 2 );

    now create an example.php file and add this to it:

    get the header with the get_header() bp function
    Hello im an example page

    testing to see if this works

    get the footer with the get_footer() bp function

    then upload it to the root of the bp-default theme, it should be at the same level as where the header.php, footer.php files etc.. are
    now go to http://yourdomain.com/example and see if it shows..

    remember to replace ‘example’ throughout the code with what you want your slug/page to be, the template (example.php or whatever you will call it) that you upload to the theme should be the same as what you call on this line above>> bp_core_load_template( ‘example’, true );

    if its working, go ahead and customize as ud like
    hope this helps, it works for me, dont know a way to do it through wordpress though as wordpress will load page.php for every page you create so you cant really customize it..

  • Thank you, I will try this… great

  • Profile picture of modemlooper modemlooper said 2 years ago:

    You don’t need any of that code above. You can easily create a page using WP page templates.

    http://codex.wordpress.org/Pages

  • Profile picture of stwc stwc said 2 years ago:

    wordpress will load page.php for every page you create so you cant really customize it..

    Not necessarily.

    Echoing modemlooper, you don’t need any of that code above. If you want Pages you create in WP to have different layouts, create a template file (http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates), upload it to the root of your theme, and when you add the new page in WP, just select the template you wish to use. Arbitrary PHP, HTML, stylesheets, whatever.

  • Profile picture of stwc stwc said 2 years ago:

    Can we at least get blockquotes working in the forums? This is ridiculous. Changing it to italics above.

    kses.php, as I recall.

  • Profile picture of modemlooper modemlooper said 2 years ago:

    I want to add that the method above is really for creating plugins or multipaged slugs. Telling BP that a folder is a slug. So you can add a folder named whatever you want that slug to be and then put files in this folder.

  • Profile picture of Paul Gibbs Paul Gibbs said 2 years ago:

    @stwc I believe all the Automattic are at WCSF so I doubt anything will get fixed this weekend :)

  • @dre1080 I like the page title function there.

    /*For extra functionality you can add a title for that page*/
    function page_titles( $title, $b ) {
    global $bp;

    if ( $bp->current_component == BP_Example_SLUG && $bp->current_action == ” ) {
    $title = __( ‘Example’, ‘buddypress’ ); /*change Example with what you want the title of your page to be*/
    }
    return $title;
    }
    add_filter( ‘bp_page_title’, ‘page_titles’, 10, 2 );

    The first one works and adds a nice title to my about page. The second one though results in a white page. As if there was a double definition somewhere. There’s nothing I need to change else than BP_Example_SLUG and the actual title “Example”?

  • Profile picture of dre1080 dre1080 said 2 years ago:

    @stwc as i stated above, i did not know how to do it through wp, i tried using the wp codex for creating a page template but it didnt seem to be working for me, so instead i used the code above which was provided by john james jacoby in a previous forum topic
    as the question above that he asked was: “is they’re any way you can edit it through a text editor rather than dashboard. Or is there any known way of how to solve this problem”

  • Profile picture of dre1080 dre1080 said 2 years ago:

    @bpisimone , yes you only need to change the EXAMPLE in BP_EXAMPLE_SLUG and the title “Example”..is the second page a new page you created without a title?

    this is what i did to add 3 page titles to 3 pages i created, in the same code:

    function page_titles( $title, $b ) {
    global $bp;

    if ( $bp->current_component == BP_EXAMPLE_SLUG && $bp->current_action == ” ) {
    $title = __( ‘Example 1′, ‘buddypress’ );
    }
    if ( $bp->current_component == BP_EXAMPLE2_SLUG && $bp->current_action == ” ) {
    $title = __( ‘Example 2′, ‘buddypress’ );
    }
    if ( $bp->current_component == BP_EXAMPLE3_SLUG && $bp->current_action == ” ) {
    $title = __( ‘Example 3′, ‘buddypress’ );
    }
    return $title;
    }
    add_filter( ‘bp_page_title’, ‘page_titles’, 10, 2 );