Skip to:
Content
Pages
Categories
Search
Top
Bottom

Extra Page’s in BuddyPress

  • 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

Viewing 18 replies - 1 through 18 (of 18 total)
  • Can anyone help please?


    modemlooper
    Moderator

    @modemlooper

    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?

    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


    modemlooper
    Moderator

    @modemlooper

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

    https://codex.wordpress.org/Pages


    stwc
    Participant

    @stwc

    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 (https://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.


    stwc
    Participant

    @stwc

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

    kses.php, as I recall.


    modemlooper
    Moderator

    @modemlooper

    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.

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


    bpisimone
    Participant

    @bpisimone

    @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”?

    @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”

    @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 );

    but then again you could use the BP-SEO plugin for that i think :)


    bpisimone
    Participant

    @bpisimone

    @dre1080 aha! That’s an idea! Thanks


    stwc
    Participant

    @stwc

    : “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”

    I tire of trying to parse through the mangled English we see here sometimes to tease out intended meaning. Also, I believe the question was edited since first posted.

    The answer to that questions is: of course, any good FTP client will let you do that kind of thing. My preferred tools: get the WinSCP FTP client, get Notepad++ and set it as the text editor for WinSCP, double click on any PHP (or whatever) file on your site through the FTP client, it’ll open locally in Notepad++, when you hit save it’ll automatically upload the file. Boom, done.

    This used to work perfectly until I updated to buddypress 1.5 :( Please give us a new tutorial how to do it in BP 1.5 because it doesn’t work anymore :)

Viewing 18 replies - 1 through 18 (of 18 total)
  • The topic ‘Extra Page’s in BuddyPress’ is closed to new replies.
Skip to toolbar