开发者 | dahousecatz |
---|---|
更新时间 | 2018年10月25日 22:21 |
PHP版本: | 5.6 及以上 |
WordPress版本: | 4.9.8 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
/wp-content/plugins/
directoryYes. The easiest way to do this is to pass in attributes when initially calling bbp_topic_like_button(). You can pass in attributes to set a custom user_id or topic_id, set before or after html, customise the button text or add custom classes to the button. Here is an example setting all possible custom options: $args = [ 'user_id' => get_current_user_id(), 'topic_id' => bbp_get_topic_id(), 'before' => '', 'after' => '', 'like' => ('Like', 'your-domain'), 'unlike' => ('Unlike', 'your-domain'), 'class' => ['my-custom-class', 'another-custom-class'], ]; bbp_topic_like_button($args); It is also possible to implement the filter get_bbp_topic_like_button to make any final changes to the rendered html.
Yes, the action bbp_topic_like_button_clicked is fired on every button press. E.g. implement like this: add_action('bbp_topic_like_button_clicked', 'my_plugin_bbp_topic_like_button_clicked', 10, 3); function my_plugin_bbp_topic_like_button_clicked($res, $user_id, $topic_id) { // Add code here to do something. }