Usage
PHP
nebula()->facebook_like($counts, $url)
Parameters
$counts
(Optional) (Boolean) Whether to show the count bubble
Default: false
$url
(Optional) (String) The URL to share
Default: (Current page URL)
Examples
Only show count bubbles to staff.
PHP
<?php nebula()->facebook_like(nebula()->is_staff()); ?>
Source File
Located in /libs/Functions.php on line 1160.
1 Hook
Find these filters and actions in the source code below to hook into them. Use do_action() and add_filter() in your functions file or plugin.
Filters
"pre_nebula_facebook_like"Need a new filter hook? Request one here.
Actions
This function has no action hooks available. Request one?
PHP
public function facebook_like($counts=0, $url=false){ $override = apply_filters('pre_nebula_facebook_like', null, $counts); if ( isset($override) ){return;} ?> <div class="nebula-social-button facebook-like require-fbsdk"> <div class="fb-like" data-href="<?php echo ( !empty($url) )? $url : get_page_link(); ?>" data-layout="<?php echo ( $counts !== 0 )? 'button_count' : 'button'; ?>" data-action="like" data-show-faces="false" data-share="false"></div> </div> <?php }
Override
To override this PHP function, use this hook in your child theme or plugin ("my_custom" can be changed):
PHP
add_filter('pre_nebula_facebook_like', 'my_custom_facebook_like', 10, 3); //The last integer must be 1 more than the actual parameters function my_custom_facebook_like($null, $counts, $url){ //$null is required, but can be ignored //Write your own code here return true; //Return true to prevent the original function from running afterwords }
You can completely disable this PHP function with a single line actions:
PHP
add_filter('pre_nebula_facebook_like', '__return_false');