Safe Function Call

Safely call a function, class method, or object method in a manner that doesn't generate errors if those plugins cease to exist.

Various helper functions are provided that provide handy variations of this theme:

  • _sfc(): Safely call a function and get its return value
  • _sfce(): Safely call a function and echo its return value
  • _sfcf(): Safely call a function; if it doesn't exist, then a fallback function (if specified) is called
  • _sfcm(): Safely call a function; if it doesn't exist, then echo a message (if provided)

Let's assume you had something like this in a template:

<?php list_cities( 'Texas', 3 ); ?>

If you deactivated the plugin that provided list_cities(), your site would generate an error when that template is accessed.

You can instead use _sfc(), which is provided by this plugin to call other functions, like so:

<?php _sfc( 'list_cities', 'Texas', 3 ); ?>

That will simply do nothing if the list_cities() function is not available.

If you'd rather display a message when the function does not exist, use _sfcm() instead, like so:

<?php _sfcm( 'list_cities', 'The cities listing is temporarily disabled.', 'Texas', 3 ); ?>

In this case, if list_cities() is not available, the text "The cities listing is temporarily disabled." will be displayed.

If you'd rather call another function when the function does not exist, use _sfcf() instead, like so:

<?php
    function unavailable_function_handler( $function_name ) { echo "The function $function_name is not available."; }
    _sfcf( 'nonexistent_function', 'unavailable_function_handler' );
?>

In the event you want to safely call a function and echo its value, you can use _sfce() like so:

<?php _sfce( 'largest_city', 'Tx' ); ?>

Which is roughly equivalent to doing :

<?php if function_exists( 'largest_city' ) { echo largest_city( 'Tx' ); } ?>

Links: Plugin Homepage | Plugin Directory Page | Author Homepage

YD Search Functions

Display WordPress search results like Google! This WordPress plugin installs a set of new template functions that lets you customize the way search results are displayed in your WordPress search page. You can use on-the-fly generated Google-style text snippets to help make search result abstracts m.........

Similar: 10%

TR WP Custom Login Page

TR WP Custom Login Page by http://themeroad.net WP Custom Login Page allows to you change your unlimited custom logo,unlimited custom text,unlimited custom background color,unlimited custom body background color easily.After publishing this plugin people enjoy custom wp login page smoothly. It's re.........

Similar: 3%

Facebook Like Lock

Facebook Like Lock for WordPress. Locks your content and user can unlock by clicking on like button. This will increase facebook likes of your wordpress site and which will result in increase of traffic from Facebook....

Similar: 3%

Landing Pages Builder

Create amazing Landing Pages, Website Popups and Forms from your WordPress site in minutes for FREE! Use one of our many responsive templates, run A/B tests, track, manage and export your leads, much more! You can create all kinds of landing pages: lead-gen, sales, support, ebook download, w.........

Similar: 3%

Social Share 2.0 - Social Bookmarks

This plugin adds a small widget within each blog post to share blog posts on Facebook, Twitter, Google Buzz, Digg, Surfpeople, and well over 100 more social bookmarking and sharing sites ....

Similar: 2%

Landing Page

Our powerful landing page builder lets you create beautiful and high converting landing pages in mere minutes without writing a single line of code. With our Landing Page templates your landing page will perform out of the box and increase your conversion rates instantly.Switch templates to test whi.........

Similar: 2%

As Nice Scroll

As nice scroll is a jquery plugin for WordPress site. This plugin will create a nice scrollbar for your site. After installing and Activating the plugin, go to WordPress Admin Dahsbord and then go to Appearance > As option Here you can customize default settings. So customize settings as you choi.........

Similar: 2%

As woocomerce with owl carousel

As woocommerce with owl carousel is a jquery plugin for WordPress site. This plugin will create a nice carousel for your site. After installing and Activating the plugin, go to WordPress Admin Dahsbord and then go to Appearance > As option Here you can create Shortcode and publish a carousel .........

Similar: 2%

Ads Manager WP/BB

Use this plugin to quickly and easily insert Any Ad code Unit to your posts and BuddyPress sections including Forum topics....

Similar: 2%

WPVKP Custom Login Page

This easy to use plugin gives you the power to convert the boring wordpress login page with much more attractive and personalized login page. This plugin helps to improve your brand authority and also helps to improve user experince. Now can customize the logo, the background, the login button and v.........

Similar: 2%