Hi there @monjolitop !
I hope you are having a great day!
You should be able to add any shortcodes to a custom menu page added through this plugin. I’ve mentioned the usage steps of the plugin here.
In short:
- Install and activate the plugin
- Go to your WordPress Dashboard→BP Custom Menu
- Add a new page, enter your content, and publish. It will automatically show up as a menu item in the BuddyPress profile.
In the menu page contents, you can enter any shortcodes that you’d like to display.
Hope this helps. Please let me know if you need any further assistance regarding this. Thanks!
Kind regards,
Nahid
Hello,
Thanks for your answer.
I would like to put a variable in my shortcode.
For my test :
1. I modify the budypress.php
2. Get my user id with $user_id = bp_displayed_user_id();
3. send my shortcode with my var echo do_shortcode( '[shortcodename param='.$user_id.']' );
And it works.
Now, i want to add this php in a file displayed by your plugin.
Can you tell me how to do this ?
Thanks,
Hi there, @monjolitop !
I hope you are doing well today!
Thank you for describing your requirement. Unfortunately, the editor for the profile menu page, like all WordPress post types doesn’t support PHP.
So, unfortunately, such a shortcode will not work there.
But as a workaround, you can possibly create a new shortcode as a wrapper of your current shortcode, for example:
add_shortcode( 'wrappershortcodename', 'wrapper_shortcode_name' );
function wrapper_shortcode_name() {
$user_id = bp_displayed_user_id();
return do_shortcode( '[shortcodename param=' . $user_id . ']' );
}
And then, you can try adding the [wrappershortcodename]
shortcode in the page editor.
Hope this helps. Please let me know if this works for you. Thanks!
Kind regards,
Nahid
Hello,
That’s what i did.
Thanks for your work and your time.
Best regards,
Hi @monjolitop !
I hope you are doing well today!
I’m glad to hear that the code worked for you! If this plugin was useful to you, I’d really appreciate if you could share your feedback regarding the plugin in the form of a five-starred review so that it can help other users seeking a similar solution.
Kind regards,
Nahid
Thank you very much for your kind words!