Skip to content

A plugin's settings page notice that advertises about the Pro version and makes the disabled features that may get clicked point to the promoting notice

Notifications You must be signed in to change notification settings

wpcodefactory/wpfactory-promoting-notice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WPFactory Promoting Notice

Description

A little library that does 2 things:

  1. Adds an admin notice only on the plugin's settings page advertising about the Pro version of the plugin
  2. Makes all the disabled features from the free version that eventually may get clicked point to the promoting notice

Screenshot

promoting-notice-only

Installation

Add this to your composer.json

  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/wpcodefactory/wpf-promoting-notice"
    }
  ],
  "require": {
    "wpfactory/wpf-promoting-notice":"dev-master"
  },

Don't forget to require the autoload.php to your project, as it's required for any composer library and to run composer install, of course :)

Usage

add_action( 'admin_init', 'add_promoting_notice' );
function add_promoting_notice(){
	$promoting_notice = wpf_promoting_notice();
	$promoting_notice->set_args( array(
		'url_requirements'              => array(
			'page_filename' => 'admin.php',
			'params'        => array( 'page' => 'wc-settings', 'tab' => 'alg_wc_ev' ),
		),
		'enable'                        => true, // Probably you should apply some custom filter here that only returns true on free version
		'optimize_plugin_icon_contrast' => true // Use true here if the plugin icon is blurry
		'template_variables'     => array(
			'%pro_version_url%'    => 'https://wpfactory.com/item/email-verification-for-woocommerce/',
			'%plugin_icon_url%'    => 'https://ps.w.org/emails-verification-for-woocommerce/assets/icon-128x128.png',
			'%pro_version_title%'  => __( 'Email Verification for WooCommerce Pro', 'emails-verification-for-woocommerce' ),
			//'%main_text%'          => __( 'Disabled options can be unlocked using <a href="%pro_version_url%" target="_blank"><strong>%pro_version_title%</strong></a>', 'emails-verification-for-woocommerce' ),
			//'%btn_call_to_action%' => __( 'Upgrade to Pro version', 'emails-verification-for-woocommerce' ),
		),		
	) );
	$promoting_notice->init();
}

Arguments

Parameter Default value        Description       
enable true Enables the notice or not
notice_template '<div id="message" class="%notice_class%"><p class="wpfactory-pan-p">%content_template%</p></div>' The whole notice template
lib_dirname dirname( __FILE__, 2 ) The directory of the project
highlight_notice_on_disabled_opt_click true Makes the disabled features that may get clicked point to the promoting notice
url_requirements array( 'page_filename' => 'admin.php', 'params' => array() ) URL requirements in order to display the notice
optimize_plugin_icon_contrast false Improves the plugin icon img contrast
display_action 'admin_notices' or 'woocommerce_sections_' . $tab The action hook used to display the notice
template_variables Documentation Template variables you can use

See it in action

WPF.-.Promoting.notice.mp4

About

A plugin's settings page notice that advertises about the Pro version and makes the disabled features that may get clicked point to the promoting notice

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages