Filters

Here’s a list of the developer filters for MightyShare. Useful to fully customize MightyShare using functions.php or adding code snippets to your site.

mightyshare_filter_post

Using the mightyshare_filter_post filter you can overwrite any aspect of a MightyShare render. This is great if you have a large site and want to programmatically control all aspects of MightyShare.

Below is an example of different variables and how you can overwrite them.

function mightyshare_filter_post_example( $template_options ) {
		// Overwrite the page template used
		$template_options['template'] = 'mighty-2';

		// Overwrite the page title used to render
		$template_options['title'] = 'My new title!';

		// Overwrite the page excerpt and force the sub heading option to enabled
		$template_options['enable_description'] = false;
		$template_options['description'] = 'My new subheading';

		// Overwrite the page background used to render
		$template_options['background'] = 'https://your-image-url.jpg';

		// Overwrite primary color setting
		$template_options['primary_color'] = '#ff6361';

		// Force the plugin to return a MightyShare image, useful for programmatically disabling/enabling MightyShare
		$template_options['is_enabled'] = true;

		return $template_options;
}
add_filter( 'mightyshare_filter_post', 'mightyshare_filter_post_example', 10, 3 );

Useful MightyShare Code Snippets

Here are PHP code snippets created for the MightyShare community that may be useful to you.

Was this article helpful?