' . "\n" ); $pblock_options = get_option( 'pblock_options' ); //Plugin install/activation function pblock_install() { //Deactivate plugin if WP version too low if ( version_compare( get_bloginfo( 'version' ), '3.0', '<' ) ) { deactivate_plugins( basename( __FILE__ ) ); } //All settings values are off by default, so no need to initialize here } register_activation_hook( __FILE__, 'pblock_install' ); //Debugging function pblock_debug_print( $value ) { print_r( '

' ); print_r( $value ); } //Add settings page to admin menu //Use $page variable to load CSS/JS ONLY for this plugin's admin page function pblock_create_menu() { $page = add_submenu_page( 'options-general.php', 'Pinterest Block Settings', 'Pinterest Block', 'manage_options', __FILE__, 'pblock_create_settings_page' ); add_action( 'admin_print_styles-' . $page, 'pblock_add_admin_css_js' ); } add_action( 'admin_menu', 'pblock_create_menu' ); //Add Admin CSS/JS function pblock_add_admin_css_js() { wp_enqueue_script( 'jquery' ); wp_enqueue_style( 'pinterest-block', plugins_url( '/css/pinterest-block-admin.css' , __FILE__ ) ); wp_enqueue_script( 'pinterest-block', plugins_url( '/js/pinterest-block-admin.js', __FILE__ ), array( 'jquery' ) ); } //Add first-install pointer CSS/JS & functionality function pblock_add_admin_css_js_pointer() { wp_enqueue_style( 'wp-pointer' ); wp_enqueue_script( 'wp-pointer' ); add_action( 'admin_print_footer_scripts', 'pblock_admin_print_footer_scripts' ); } add_action( 'admin_enqueue_scripts', 'pblock_add_admin_css_js_pointer' ); //Add pointer popup message when plugin first installed function pblock_admin_print_footer_scripts() { //Check option to hide pointer after initial display if ( !get_option( 'pblock_hide_pointer' ) ) { $pointer_content = '

Pinterest Block Installed!

'; $pointer_content .= '

Congratulations. You have just installed the Pinterest Block Plugin. ' . 'Now just configure your settings to specify what gets blocked.

'; $url = admin_url( 'admin.php?page=' . PBLOCK_PLUGIN_BASENAME ); ?>


What types of pages should pinning be blocked on?

/>
/>
/>
/>
/>

Pinterest Block Details

Pinterest Block simply disables pinning by inserting the official meta tag.

Besides the types of pages above, any individual post or page can be blocked. Just go to the edit screen for that post or page, scroll down to the bottom, and check the "Block Pinning" checkbox.

Note that the meta tag only blocks people from pinning using the official bookmarklet or "Add" feature on Pinterest.com itself. "Pin It" buttons on the page might still work. Get the "Pin It" Button plugin to specify the posts and pages the button should or should not be shown on.

' . esc_html( __( 'Settings') ) . ''; array_unshift( $links, $settings_link ); return $links; } add_filter( 'plugin_action_links', 'pblock_plugin_action_links', 10, 2 ); //Render rss items from pinterestplugin.com //http://codex.wordpress.org/Function_Reference/fetch_feed function pblock_rss_news() { // Get RSS Feed(s) include_once(ABSPATH . WPINC . '/feed.php'); // Get a SimplePie feed object from the specified feed source. $rss = fetch_feed('http://pinterestplugin.com/feed/'); if (!is_wp_error( $rss ) ) { // Checks that the object is created correctly // Figure out how many total items there are, but limit it to 5. $maxitems = $rss->get_item_quantity(3); // Build an array of all the items, starting with element 0 (first element). $rss_items = $rss->get_items(0, $maxitems); } ?> Tweet ID, 'pblock_pinning_blocked', 1 ); ?>

type="checkbox" />

ID; //Determine if block on current page from main admin settings if ( ( $pblock_options['block_home_page'] && is_home() ) || ( $pblock_options['block_front_page'] && is_front_page() ) || ( is_single() && ( $pblock_options['block_posts'] ) ) || ( is_page() && ( $pblock_options['block_pages'] ) && !is_front_page() ) || //archive pages besides categories (tag, author, date, search) //http://codex.wordpress.org/Conditional_Tags ( is_archive() && ( $pblock_options['block_archives'] ) && ( is_tag() || is_author() || is_date() || is_search() ) ) ) { echo PBLOCK_META_TAG; return; } //Determine if block on current page from single post settings if ( get_post_meta( $postID, 'pblock_pinning_blocked', 1 ) ) { echo PBLOCK_META_TAG; } } add_action('wp_head', 'pblock_add_block');