Monarch Plugin Custom Shortcode for WordPress

I am a web designer so naturally I do not follow standard website layouts… I love the Monarch social sharing plugin for WordPress, but I needed a way to add the inline sharing buttons to a custom sidebar that I’ve made. I searched high and low to find a way to do this using their settings but there is just no way to do it.

They have a shortcode for adding the Follow buttons anywhere you want but not the sharing buttons. I went ahead and added this capability by adding a few lines of code to their plugin. Here is how you do it.

1. Find the function named “display_inline” in monarch.php file and right after this function closes, add this function:


/**
* Adds monarch wherever you put the shortcode.
*/
function display_custom() {
$monarch_options = $this->monarch_options;

return $this->generate_inline_icons( 'et_social_inline_top' );;
}

Now go up to around line 119 and find this line:

add_shortcode( 'et_social_follow', array( $this, 'display_shortcode' ) );

Right below it add this:

add_shortcode( 'et_social_share', array( $this, 'display_custom' ) );

That’s it.

Now you can add your sharing buttons anywhere you want using the [et_social_share] shortcode.

To add it in your PHP, you can do this:

echo do_shortcode('[et_social_share]');

Enjoy!

Author: Valik Rudd

Valik (Valiik) Rudd is an Internet entrepreneur. He develops new online businesses and creates new websites. His other passion is writing about the those things. Web Design Ideas blog is the outlet through which his ideas and web design tricks and tips get recorded and shared with others.

1 thought on “Monarch Plugin Custom Shortcode for WordPress”

Leave a Reply

Your email address will not be published. Required fields are marked *