This topic has 1 reply, 2 voices, and was last updated 8 years by sharmstr.

  • Author
  • #94830
     viriis
    Participant

    Hello,

     

    I would like to know if it is possible to change H1 into H2 in the following page:

    /wp-content/themes/buddyapp-child/lib/plugins/buddypress/buddypress.php

    in such a way that the updates never erase this modification?

     

    /* Template functions */

     

    add_action( ‘bp_before_member_body’,’kleo_bp_member_title’, 1 );

    add_action( ‘bp_before_group_body’,’kleo_bp_group_title’, 1 );

     

    function kleo_bp_member_title() {

    ?>

    <div class=”bp-title-section”>

    <h1 class=”bp-page-title”><?php echo ucfirst(bp_current_component());?></h1>

    <?php kleo_breadcrumb( array( ‘container’ => ‘ol’, ‘separator’ => ”, ‘show_browse’ => false ) ); ?>

    </div>

    <?php

    }

     

    function kleo_bp_group_title() {

    ?>

    <div class=”bp-title-section”>

    <h1 class=”bp-page-title”><?php echo ucwords(str_replace(‘-‘, ‘ ‘, bp_current_action()));?></h1>

    <?php kleo_breadcrumb( array( ‘container’ => ‘ol’, ‘separator’ => ”, ‘show_browse’ => false ) ); ?>

    </div>

    <?php

    }

     

    Thank you very much

    #94883
     sharmstr
    Moderator

    Since you have it in buddyapp-child the changes wont be lost when you update Buddyapp. Buddyapp updates only change files in /themes/buddyapp, not /themes/buddyapp-child. That’s the whole point of using a child theme 🙂

    With that said, you should NOT put buddypress.php into your child theme. There are way too many functions in there and you’ll end up screwing up your site.

    To change the h1 to h2 in the bp titles, put this in your child theme’s functions.php file

    COPY CODE
    
    add_action( 'bp_init', 'change_bp_titles' );
    function change_bp_titles(){
        remove_action('bp_before_member_body', 'kleo_bp_member_title', 1);
        add_action('bp_before_member_body', 'custom_bp_member_title', 1);
        remove_action('bp_before_group_body', 'kleo_bp_group_title', 1);
        add_action('bp_before_group_body', 'custom_bp_group_title', 1);
    }
    
    function custom_bp_member_title() {
        ?>
        <div class="bp-title-section">
            <h2 class="bp-page-title"><?php echo ucfirst(bp_current_component());?></h2>
            <?php kleo_breadcrumb( array( 'container' => 'ol', 'separator' => '', 'show_browse' => false ) ); ?>
        </div>
        <?php
    }
    
    function custom_bp_group_title() {
        ?>
        <div class="bp-title-section">
            <h2 class="bp-page-title"><?php echo ucwords(str_replace('-', ' ', bp_current_action()));?></h2>
            <?php kleo_breadcrumb( array( 'container' => 'ol', 'separator' => '', 'show_browse' => false ) ); ?>
        </div>
        <?php
    }
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?