Edit Suffusion Shortcodes

Oct 192014
 
 Posted by on 19/10/2014 How-To's Tagged with: , ,  Add comments

Besides of it’s powerful set of options, Suffusion provides also a set of shortcodes which can be used in widgets or posts. The usage of shortcodes are described by Sayontan on aquoid.com. Very important, these shortcodes not works without Suffusion Shortcodes Plugin! So, for benefit even by the Ad-Hoc Widgets areas, will have to install the plugin. Don’t ask “why to install a plugin for a functionality provided by theme?”. This is because WPTRT (WordPress Theme Review Team) ask to take out shortcodes from theme to not keep users captive. So, if you ever want to change Suffusion to other theme, your content added in shortcodes will stay safe and unchanged as much you keep Suffusion Shortcodes Plugin activated. The first observation come immediately. The plugin can be used even if you don’t use Suffusion on your site. By example if you need widgets area to be added directly in pages/posts and your theme don’t have such functionality, can install the plugin and will benefit of this Suffusion shortcode.

Suffusion Shortcodes PluginNow, with Suffusion Shortcodes Plugin installed, can go to use shortcodes in your content. But sometimes you see that the shortcode is not fit exactly your needs. By example, you want to use [suffusion-register]  but you need to keep users out of WordPress dashboard (like Giorgos on Suffusion forum).

In this case is simple to change the shortcode for obtaining exactly what you need. In fact, you will add a brand new shortcode which will have the desired functionality. First, as always, I recommend to use a child theme for this kind of changes. Install one in few steps as I described in my article about child themes.

Now, go through ftp and open /suffusion/functions/shortcodes.php. Identify the function for desired shortcode. At the beginning of file will see the list of shortcodes included in add_shortcode() functions. In our case the function is:

The function add_shortcode add a hook for a shortcode tag. First argument is the shortcode tag used in content (the words between brackets []), the second argument is the function to run when the shortcode is called.

So, the next step is to search the function ‘suffusion_sc_register’ and will find this:

So, our job is to add a new shortcode which permit only to admins to access the dashboard, the other users not seeing a “site admin” link and being redirected to the homepage after login. In functions.php of our child theme add a function like this one:

I commented the lines added for obtaining the new functionality. You can name your function and shortcode as you like, but keep the names consistently between the function and add_shortcode hook.

That’s all folks, go and add the new shortcode in a text widget or in a post as [suffusion-regist] .

https://drafie-design.nl/edit-suffusion-shortcodes/trackback/Trackback URI:  

Ciprian

Experienced web developer and graphic designer. Former consultant for Suffusion theme and former moderator on Suffusion Support forum. I teach others while learning myself.

Google+ Profile

    Google+ Page

 Leave a Reply

(Your comment will be published. To contact me privately, use the contact form.)

This site uses Akismet to reduce spam. Learn how your comment data is processed.