Tagged: activity feed, help, shortcode
Hello Peter,
Thank you for posting. Try the following code in your “bp-custom.php” file
function buddydev_add_slider() { echo do_shortcode( '[your-short-code]' ); // Replace shortcode with your one } add_action( 'bp_before_directory_activity', 'buddydev_add_slider' );
If you do not know about “bp-custom.php” file refer the following url.
https://codex.buddypress.org/themes/bp-custom-php/Let me know if it works or not.
Thank You
Ravi- This reply was modified 6 years, 8 months ago by Ravi.
mmm…. this is the second time that I’ve tried to add something to a bp-custom.php file that I’d created in the plugins directory. yet I get a line of code at the top of my screen that layers over everything else.
Did I not set u p the bp-custom.php file in the right place? Is my syntax out?
This is what it says in my bp-custom.php file –>
<?php
// hacks and mods will go here
?>function buddydev_add_slider() {
echo do_shortcode( ‘[your-short-code]’ ); // Replace shortcode with your one
}
add_action( ‘bp_before_directory_activity’, ‘buddydev_add_slider’ );… in order to use another BP code, I had to put it into the functions.php file of my child theme. When I tried to put the code into the bp-custom.php file in the /plugins directory, I got the same effect, code on top of the site.
????
Hello Peter,
Please post me your any whole file code into postbin. You can refer the following url.
Thank You
Ravimmm…. this is the second time that I’ve tried to add something to a bp-custom.php file that I’d created in the plugins directory. yet I get a line of code at the top of my screen that layers over everything else.
Did I not set u p the bp-custom.php file in the right place? Is my syntax out?
This is what it says in my bp-custom.php file –>
‘<?php
// hacks and mods will go here
?>function buddydev_add_slider() {
echo do_shortcode( ‘[your-short-code]’ ); // Replace shortcode with your one
}
add_action( ‘bp_before_directory_activity’, ‘buddydev_add_slider’ );’… in order to use another BP code, I had to put it into the functions.php file of my child theme. When I tried to put the code into the bp-custom.php file in the /plugins directory, I got the same effect, code on top of the site.
????
(is that better? with the post code?)
Hi Peter,
Your problem is// hacks and mods will go here ?>
You should not add code after closing the php tag.
Remove this line
?>
and give it a try.
Best Regards
Brajeshthat worked! Thank you so much.
I have two questions regarding this.
ONE – this created the revolution slider in the container that the activity feed is in, which is beautiful. However, I’d like to see the revolution slider *below the masthead* of the theme, which is ABOVE the container/sidebar area.
When I asked this question to the developers at X-Theme, they provided this info –>
Hey @Peter_Fae,
Please disregard the previous advice. To output custom content in above the masthead, you can hook to x_after_site_begin action. The next thing is to detect if the page is an activity page and display your slider in the area using the do_shortcode function and your slider’s shortcode. Regretfully, the bp_is_activity conditional of BuddyPress does not seam to work so you will need to hire a third party developer who is an expert in BuddyPress or contact BuddyPress support to know what is the correct conditional. The code should look like this.
‘add_action(‘x_after_site_begin’, ‘slider_above_activity’);
function slider_above_activity() {
if ( bp_is_activity() ) {
echo do_shortcode(‘[rev_slider alias=”gym-classes”]’);
}
}’what is the conditional to use here?
TWO –
In the concept I’m planning, I’d like to have a *specific* revolution slider for particular Profiles in Buddypress, while having a large revolution slider above the feed/sidebar on the main activity feed.
As the above question tackles how do I showcase the revolution slider on the activity page below the masthead yet above hte container/sidebar, I would also like to know, how do I place a revolution slider like we did in the earlier bit of code which puts it above the activity feed *within* the container, yet with SPECIFIC USER PRIOFILES?
So, what I’m looking for is a way to set the rev slider for a Profile the way the code You sent me worked, as well as ONE, above
thank you so much!
- This reply was modified 6 years, 8 months ago by Peter Fae.
You can use
The folloing to show on activity directory
function slider_above_activity_directory() { if ( bp_is_activity_directory() ) { echo do_shortcode( '[rev_slider alias="gym-classes"]' ); } } add_action( 'x_after_site_begin', 'slider_above_activity_directory' );
or the below code to show on user profile activity
function slider_above_user_activity() { if ( bp_is_user_activity() ) { echo do_shortcode( '[rev_slider alias="gym-classes"]' ); } } add_action( 'x_after_site_begin', 'slider_above_user_activity' );
Hope that helps.
You must be logged in to reply to this topic.