api_key: '.stripslashes(strip_tags(get_option( 'applywithlinkedin_apikey' ))).' '; } // if } // shortcode for adding linkedin buttons to post //[applywithlinkedin jobtitle="Job title" companyname="My Company" email="myemail@address.com" logo="http://yoursite.com/yourlogo.png" themecolor="#ff0000" coverletter="required"] function applywithlinkedin_sc_func( $atts ) { extract( shortcode_atts( array( 'jobtitle' => '', 'companyname' => '', 'email' => '', 'logo' => '', 'themecolor' => '', 'coverletter' => '', 'size' => '' ), $atts ) ); // check if set email address is my work email address (author). Some people won't change it so i get spammed if ( $email == 'martijn@d-media.nl'){ return 'Please notify website administrator to check the email addresses used in the shortcodes of the "Apply with LinkedIn" plugin. The current address is still set to the authors email address'; } else { // clean vars if (( $coverletter != 'optional' ) && ( $coverletter != 'required' ) ){ $coverletter = 'hidden'; } // optional, required or hidden (default) if (( $size != 'medium' ) && ( $size != 'small' ) ){ $size = ''; } // small, medium or empty (=large=default) $logo = sanitize_text_field( $logo ); // http://www.xyzcompany.com/images/logo.png if ($logo != ''){ $logo='data-logo="'.$logo.'"'; } $themecolor = sanitize_text_field( $themecolor ); // #ff0000 if ($themecolor != ''){ $themecolor='data-themecolor="'.$themecolor.'"'; } // build button $result=''; // add div for styling if ( get_option( 'applywithlinkedin_divstyling' ) == 1){ $result='
'.$result.'
'; } // return button return $result; } } add_shortcode( 'applywithlinkedin', 'applywithlinkedin_sc_func' ); /* admin area */ // register plugin options function applywithlinkedin_register_plugin_settings() { // only for users who can manage options if ( current_user_can( 'manage_options' ) ){ // add options with default values (only adds them if they don't exist yet) add_option( 'applywithlinkedin_apikey' ,'' ); add_option( 'applywithlinkedin_divstyling','' ); } } // adds page to the admin menu function applywithlinkedin_options(){ $page=add_options_page( 'Apply with LinkedIn button settings', 'Apply with LinkedIn', 'administrator', basename(__FILE__), 'applywithlinkedin_options_page' ); // Using registered $page handle to hook stylesheet loading add_action( 'admin_print_styles-' . $page, 'applywithlinkedin_admin_stylesandscripts' ); } // add js and stylesheet for options page, It will be called only on your plugin admin page, enqueue our stylesheet here function applywithlinkedin_admin_stylesandscripts() { wp_enqueue_style('applywithlinkedinStylesheet'); wp_enqueue_script('applywithlinkedinScript'); } // plugin options page function applywithlinkedin_options_page(){ if ( isset( $_POST ) ){ if ( isset( $_POST['Submit'] ) ){ update_option( 'applywithlinkedin_apikey', $_POST['apikey'] ); update_option( 'applywithlinkedin_divstyling', $_POST['divstyling'] ); } } ?>

name="divstyling" />
(required) here.', 'applywithlinkedin' );?>

After setting up the API key you can use the following shortcode to add buttons to your post:

[applywithlinkedin jobtitle="Job title" companyname="My Company" email="myemail@address.com" logo="http://yoursite.com/yourlogo.png" themecolor="#ff0000" coverletter="required" size="small"]
Note that setting a logo, theme color, size or cover letter is optional.
The possible values for cover letter are: optional, required and hidden (default)
The possible values for size are: small, medium and large (default)
Settings' ), $links ); } ?>