BuddyPress add custom class to profile page buttons - php

I am trying to create a custom theme for BuddyPress and in the template the buddypress/members/single/member-header.php file at line 45 there are buttons rendered using <?php do_action( 'bp_member_header_actions' ); ?>
After a lot of searching around I found out that I should be able to use filters to add custom data to elements, the problem is that I can't find anywhere as to what filter to use or how to use such a filter to add a custom class to these buttons.
The buttons I am talking about are the buttons like "Add Friend", "Public Message" and "Private Message" and I would like to add the "btn" class.
Any help is greatly appreciated.

Check out these filters:
bp_get_add_friend_button
bp_get_send_public_message_button
bp_get_send_message_button_args
EDIT: Updated (see comments)

Related

How I can add a tooltip to a PHP short code?

I'm trying to add a tooltip function (on hover) to the following shortcode:
<?php
echo do_shortcode('[um_loggedout]Accedi /<br>Registrati[/um_loggedout]');
?>
I've already created a css class with all the parameters needed, but since I am not
big with php I don't really know how I can make it work.
Anyone can help me? If this detail can be useful I am working via Wordpress.
Thanks,
Ivan
What does that output to the frontend? Can you apply your hover styles to one of the classes generated by the shortcode?
---Update---
So you're trying to create a login form appear when they hover over the logged out text?
If so, I think you can use [ultimatemember form_id=####] to display the login form, you'll need to replace the #### with the login form ID. If the <br> tag in the above example works, why can't you wrap the text in a div?
<?php
echo do_shortcode('[um_loggedout]<div id="display-login-form">Accedi /<br>Registrati</div>[/um_loggedout]'); ?>
Then with jQuery/JavaScript, on hover make the box display?
$('#display-login-form').on('mouseover', function() {
$('[insert form container id here]').show();
})
You'll need some logic/ability to hide it if they change their mind.

Is there a method to add shortcode to a custom widget in wordpress?

I am looking for a simple way to add shortcode to a custom widget(Not in custom template) which i have created using my function file in wordpress,so this shortcode can be used to show my custom stuffs..?Any help
WordPress widgets aren’t enabled to manage shortcodes.So there is a simple trick which can
be used here.
Open your function file and write the following code
add_filter(‘widget_text’, ‘do_shortcode’);
More can be found here
if you want to use the shortcode in widget script, you need to add a function like:
echo do_shortcode('[your_shortcode]');

Advanced Custom Fields Add Class to Element

I'm using Advanced Custom Fields' flexible content area in a Wordpress theme that I'm developing. One of my sub_fields requires a textarea.
When I make my get_sub_field call from my template it is already wrapped in <p></p> tags. How do I go about adding a class to that paragraph?
Example:
get_sub_field('textarea');
Output:
<p>This is my textarea.</p>
Desired:
<p class="my-class">This is my textarea.</p>
Thanks for your help!
Go to your Textarea custom field settings and change "Automatically add paragraphs" to none.
So WP-admin-> Custom Fields -> Field group -> then your field group-> edit textarea-> look for "Controls how new lines are rendered"
You can add a second false argument to get_sub_field() to disable reformatting on a case-by-case basis in the template:
get_sub_field('textarea', false);

WP Jetpack publicize insert default text(s)

How can I place a default text (hashtag) in the Custom Message?
The textarea is (located in line 643) under jetpack/modules/publicize/ui.php
I tried to put the text in front of $title in various ways, like:
<?php echo "#myhashtag $title"; ?>
or
<?php echo '#myhashtag '.$title; ?>
but it just echoes the text, not the $title.
Any ideas will be greatly appreciated.
You can use the approach of this Wordpress plugin i made (Publicize With Hashtags), which does exactly that. It basically use and action trigger bound to the 'save_post' native event.
If you want to develop your own one you can have a look at my Source Code on the project's GitHub page or in this installation & usage guide I wrote about it.
You can add a filter, like so, to your theme's functions.php or a site-specific plugin:
add_filter( 'wpas_default_prefix', 'add_default_publicize_hashtag_prefix', 10, 4 );
function add_default_publicize_hashtag_prefix() {
$default_tags = '#yourhastaghere ';
return $default_tags;
}
This will add your default hashtag before your title without you needing to hack the WordPress core.
jetpack/modules/publicize/ui.php itself states in its comments:
/**
* Only user facing pieces of Publicize are found here.
*/
You added your hashtag in the textarea which allows admins to enter a custom message (click edit and it will slide down with your hashtag).
As #Yazmin mentioned, the best way to permanently edit the message is using a filter. The filters available are wpas_default_prefix, wpas_default_message, and wpas_default_suffix.
Personally, I had no success using these filters and I'm interested in a working solution to this issue myself.

how to filter "link to existing content" suggestion in wordpress?

How can i filter the link given in "link to existing content".
As in the above image. I just want WSP BANNER TO BE SHOWN.
where WSP BANNER & CALENDAR are custom post_type
Any help will be appreciable.
Currently there are no ready filters available for this purpose. A ticket has been posted for the request.Lets hope we get one soon.
Till then you can create your own filter.
Open includes/class-wp-editor.php and make folowing changes at line no 712
$pt_names = apply_filters('custom_insert_link_suggestion_filter',array_keys( $pts ));
we just added a new filter instead of getting all the public post types
Then in your theme add following code to filter the internal link custom post type
function my_filter_function($allowed_post_types)
{
if( condition chek)
{
return array('page','your custom post types');
}
}
add_filter('custom_insert_link_suggestion_filter','my_filter_function',10,1);
There is a plugin that could be helpful for you: B09 Link to Existing Content
It has a filter called "link_to_existing_content_post_types", that enables you to control which post types should be searched.
You can also use it together with this plugin, if you also want to have complete control over the search results: Search Everything.
Consider an example where my site is configured on wp.abc.com and I point my root domain www.abc.com to the new site. I need to update the URL's in General Setting. So when I update the URL, it is reflected in menu items etc. Will it be reflected in the content area links aslo?

Categories