Force below masthead slider option on buddypress activity page

Hey. I want to override buddypress control of buddypress activity page such that I can simply choose a slider within the X-Theme’s ‘below masthead’ ‘above masthead’ standard option.

how to do this?

(thanks)

Hello Peter,

Thanks for posting in! Please be advised that the Below Masthead and Above Masthead data were saved as post meta. When you assign a page as your Activity page, BuddyPress will disregard any of the post meta. Regretfully, you cannot use the Slider Settings because of that.

What you can do is to use a custom PHP script added in your child theme’s functions.php file. The BuddyPress Conditional tags can help you in pointing out which of the BuddyPress will your PHP code be applied. For example;

// Add custom slider to buddypress pages
// =============================================================================
function add_buddypress_slider(){ ?>
  <?php if ( bp_is_activity() ) : ?>
    <?php echo do_shortcode('[your slider shortcode here]'); ?>
  <?php endif; ?>
<?php }
add_action('x_before_view_global__slider-below', 'add_buddypress_slider');
// =============================================================================

You will have to replace x_before_view_global__slider-below into x_before_view_global__slider-above if you want to display the slider above the masthead.

Please note that custom coding is outside the scope of our support. Issues that might arise from the use of custom code and further enhancements should be directed to a third party developer.

You’re awesome. Curious though, will this allow only a single slider in the [your slider shortcode here] area or would I be able to use the drop-down to change the slider on the page in question once the .php is established?

(or would I have to go in and change the code in functions.php any time I wanted to use a new slider? )

Hi Peter,

You can only change it through that code, there is no dropdown. You can add many shortcode as you want but it will be just placed on the same area as the first shortcode.

Yes, you will need to edit the same code in functions.php just to change the slider.

Thanks!

Understood. Thank you sir. :slight_smile:

You are most welcome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.