Version Description
- Changed: Modified button JavaScript to be in line with Pinterest's current button embed JavaScript
- Changed: Split up internal code files for easier maintenance and updates
- Fixed: For the shortcode, if the attributes "url", "image_url" and/or "description" aren't specified, it will try and use the post's custom page url, image url and/or description if found. If not found it will default to the post's url, first image in post and post title.
- Fixed: Changed the way defaults are set upon install so it shouldn't override previous settings
- Fixed: Uninstall now removes custom post meta fields
Download this release
Release Info
Developer | pderksen |
Plugin | Pinterest "Pin It" Button |
Version | 1.3.1 |
Comparing to | |
See all releases |
Code changes from version 1.2.1 to 1.3.1
- css/pinterest-pin-it-button-admin.css +23 -112
- css/pinterest-pin-it-button.css +20 -23
- img/icon-external-link.gif +0 -0
- img/{pinit-button-icon-med.png → pinterest-button-icon-med.png} +0 -0
- img/{pinit-button-icon-small.png → pinterest-button-icon-small.png} +0 -0
- inc/admin-pin-it-button-iframe.html +2 -3
- inc/admin-settings.php +344 -0
- inc/category-meta-page.php +67 -0
- inc/pin-it-button-user-selects-image-iframe.html +203 -0
- inc/post-meta-page.php +103 -0
- inc/shortcode.php +73 -0
- inc/widget.php +142 -0
- js/pin-it-button-user-selects-image-assets.js +91 -0
- js/pin-it-button-user-selects-image.js +9 -0
- js/pinterest-pin-it-button-admin.js +13 -19
- pinterest-pin-it-button.php +229 -706
- readme.txt +102 -66
- screenshot-1.png +0 -0
- screenshot-2.jpg +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- screenshot-5.png +0 -0
- uninstall.php +9 -4
css/pinterest-pin-it-button-admin.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/* Pinterest Pin It Button Admin CSS */
|
2 |
|
3 |
.form-table {
|
4 |
margin-bottom: 10px !important;
|
@@ -21,131 +21,42 @@
|
|
21 |
width: 350px;
|
22 |
}
|
23 |
|
24 |
-
.pib-
|
25 |
-
|
26 |
}
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
line-height: 1.2em;
|
31 |
}
|
32 |
|
33 |
-
|
34 |
-
|
|
|
35 |
}
|
36 |
|
37 |
-
|
38 |
-
width:
|
39 |
}
|
40 |
|
41 |
-
.
|
42 |
-
|
43 |
-
background-color:#F1F1F1;
|
44 |
-
font-size:15px;
|
45 |
-
padding:7px 10px;
|
46 |
-
display:block;
|
47 |
-
margin-top:0px;
|
48 |
-
font-weight:normal;
|
49 |
-
cursor:default !important;
|
50 |
}
|
51 |
|
52 |
-
.
|
53 |
-
|
|
|
54 |
}
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
#email-signup {
|
59 |
-
/* background-color: #464646; */
|
60 |
-
background-color: #999;
|
61 |
-
background-image: none;
|
62 |
-
border: 0;
|
63 |
-
/* color: #ccc; */
|
64 |
-
color: #fff;
|
65 |
-
margin: 10px 10px 0 0;
|
66 |
-
padding: 5px 20px;
|
67 |
-
-webkit-border-radius: 3px;
|
68 |
-
-moz-border-radius: 3px;
|
69 |
-
border-radius: 3px;
|
70 |
-
}
|
71 |
-
|
72 |
-
#email-signup h4 {
|
73 |
-
color: #FCF9F9;
|
74 |
-
font-size: 18px;
|
75 |
-
margin-top: 15px;
|
76 |
-
}
|
77 |
-
|
78 |
-
#email-signup .large-text {
|
79 |
-
font-size: 15px;
|
80 |
-
}
|
81 |
-
|
82 |
-
/* Mailchimp original embed CSS at http://cdn-images.mailchimp.com/embedcode/slim-081711.css */
|
83 |
-
/* This is the same with some elements removed and some modified */
|
84 |
-
#mc_embed_signup form {display:block; position:relative; text-align:left; font: 14px Helvetica,Arial,sans-serif; padding:0}
|
85 |
-
#mc_embed_signup input {border:1px solid #999; -webkit-appearance:none;}
|
86 |
-
#mc_embed_signup input:focus {border-color:#333;}
|
87 |
-
#mc_embed_signup .small-meta {font-size: 11px;}
|
88 |
-
#mc_embed_signup .nowrap {white-space:nowrap;}
|
89 |
-
#mc_embed_signup .clear {clear:none; display:inline;}
|
90 |
-
#mc_embed_signup input.email {display:block; padding:8px 0; margin:0 4% 10px 0; text-indent:5px; width:58%; min-width:130px;}
|
91 |
-
|
92 |
-
/*
|
93 |
-
SUPER CONVERSION BUTTON
|
94 |
-
|
95 |
-
Conversion buttons made simple:
|
96 |
-
http://www.performable.com/buttons/
|
97 |
-
|
98 |
-
Awesome Button
|
99 |
-
|
100 |
-
This is a well-enhanced version of the awesome buttons found here:
|
101 |
-
http://www.zurb.com/article/266/super-awesome-buttons-with-css3-and-rgba
|
102 |
-
|
103 |
-
Awesome/Red: http://super.hubspot.com/buttons/code/N5XJeFJeRmnC/5L4hyT/
|
104 |
-
|
105 |
-
================================================================================ */
|
106 |
-
|
107 |
-
.awesome,
|
108 |
-
.awesome-link,
|
109 |
-
.awesome:visited {
|
110 |
-
font-family:"helvetica neue",arial,sans-serif !important;
|
111 |
-
/* font-family:"lucida grande","lucida sans unicode",arial,sans-serif !important; */
|
112 |
-
font-weight:bold !important;
|
113 |
-
font-size:18px !important;
|
114 |
-
/* font-size:20px !important; */
|
115 |
-
line-height:1 !important;
|
116 |
-
background: #222 url(button-shadow.png) repeat-x;
|
117 |
-
_background: #222 none;
|
118 |
-
display: inline-block;
|
119 |
-
color: #fff !important;
|
120 |
-
text-decoration: none !important;
|
121 |
-
margin:0 !important;
|
122 |
-
padding:.6em 1.3em .6em !important;
|
123 |
-
*padding:.7em 1.4em 1em !important;
|
124 |
-
-moz-border-radius: .4em !important;
|
125 |
-
-webkit-border-radius: .4em !important;
|
126 |
-
border-radius: 5px !important;
|
127 |
-
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.75) !important;
|
128 |
-
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.75) !important;
|
129 |
-
box-shadow: 0 1px 3px rgba(0,0,0,0.75) !important;
|
130 |
-
text-shadow: 0 -1px 1px rgba(0,0,0,0.3) !important;
|
131 |
-
border: none !important;
|
132 |
-
position: relative !important;
|
133 |
-
cursor: pointer !important;
|
134 |
-
width: auto !important;
|
135 |
-
overflow: visible !important;
|
136 |
-
vertical-align:baseline !important;
|
137 |
-
*vertical-align:middle !important;
|
138 |
}
|
139 |
|
140 |
-
.
|
141 |
-
|
142 |
-
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.75) !important;
|
143 |
-
box-shadow: 0 1px 3px rgba(0,0,0,0.75) !important;
|
144 |
}
|
145 |
|
146 |
-
|
147 |
-
|
|
|
|
|
148 |
}
|
149 |
-
|
150 |
-
.red.awesome,.red.awesome:visited{background-color:#CC1100 !important;}
|
151 |
-
.red.awesome:hover{background-color:#991100 !important;}
|
1 |
+
/* Pinterest "Pin It" Button Admin CSS */
|
2 |
|
3 |
.form-table {
|
4 |
margin-bottom: 10px !important;
|
21 |
width: 350px;
|
22 |
}
|
23 |
|
24 |
+
.postbox .pib-hndle {
|
25 |
+
cursor: pointer;
|
26 |
}
|
27 |
|
28 |
+
.pib-admin-banner {
|
29 |
+
margin-bottom: 15px;
|
|
|
30 |
}
|
31 |
|
32 |
+
table#share_plugin_buttons tr td {
|
33 |
+
padding-right: 10px;
|
34 |
+
vertical-align: top;
|
35 |
}
|
36 |
|
37 |
+
#pib-custom-css {
|
38 |
+
width: 100%;
|
39 |
}
|
40 |
|
41 |
+
td.pib-pad-cell-top {
|
42 |
+
padding-top: 7px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
|
45 |
+
label.pib-plain-label {
|
46 |
+
margin: 0;
|
47 |
+
padding: 0;
|
48 |
}
|
49 |
|
50 |
+
.inside ul li .label {
|
51 |
+
vertical-align: top;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
|
54 |
+
.submit-settings {
|
55 |
+
padding-bottom: 1.5em;
|
|
|
|
|
56 |
}
|
57 |
|
58 |
+
/* External link icon */
|
59 |
+
a.external {
|
60 |
+
background: url(../img/icon-external-link.gif) center right no-repeat;
|
61 |
+
padding-right: 17px;
|
62 |
}
|
|
|
|
|
|
css/pinterest-pin-it-button.css
CHANGED
@@ -2,35 +2,32 @@
|
|
2 |
|
3 |
/* DIV surrounding button */
|
4 |
.pin-it-btn-wrapper,
|
5 |
-
.pin-it-btn-shortcode
|
6 |
-
|
7 |
-
|
8 |
-
padding: 0;
|
9 |
}
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
position: absolute;
|
14 |
-
background: url(http://assets.pinterest.com/images/pinit6.png);
|
15 |
-
font: 11px Arial, sans-serif;
|
16 |
-
text-indent: -9999em;
|
17 |
-
font-size: .01em;
|
18 |
-
color: #CD1F1F;
|
19 |
-
height: 20px;
|
20 |
-
width: 43px;
|
21 |
-
background-position: 0 -7px;
|
22 |
}
|
23 |
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
-
|
29 |
-
|
30 |
}
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
.pib_widget_follow_button {
|
35 |
-
clear: both;
|
36 |
}
|
2 |
|
3 |
/* DIV surrounding button */
|
4 |
.pin-it-btn-wrapper,
|
5 |
+
.pin-it-btn-wrapper-shortcode,
|
6 |
+
.pin-it-btn-wrapper-widget {
|
7 |
+
|
|
|
8 |
}
|
9 |
|
10 |
+
.pin-it-btn-wrapper {
|
11 |
+
padding-bottom: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
}
|
13 |
|
14 |
+
/* Latest "clear fix" method: http://css-tricks.com/snippets/css/clear-fix/ */
|
15 |
+
.pib-clearfix:before,
|
16 |
+
.pib-clearfix:after {
|
17 |
+
content:"";
|
18 |
+
display:table;
|
19 |
+
}
|
20 |
+
.pib-clearfix:after {
|
21 |
+
clear:both;
|
22 |
+
}
|
23 |
+
.pib-clearfix {
|
24 |
+
zoom:1; /* For IE 6/7 (trigger hasLayout) */
|
25 |
}
|
26 |
|
27 |
+
.pib-float-left {
|
28 |
+
float: left;
|
29 |
}
|
30 |
|
31 |
+
.pib-float-right {
|
32 |
+
float: right;
|
|
|
|
|
33 |
}
|
img/icon-external-link.gif
ADDED
Binary file
|
img/{pinit-button-icon-med.png → pinterest-button-icon-med.png}
RENAMED
File without changes
|
img/{pinit-button-icon-small.png → pinterest-button-icon-small.png}
RENAMED
File without changes
|
inc/admin-pin-it-button-iframe.html
CHANGED
@@ -1,9 +1,8 @@
|
|
1 |
<html>
|
2 |
<body style="margin: 0; padding: 0;">
|
3 |
|
4 |
-
<a href="http://pinterest.com/pin/create/button/?url=http%3A%2F%2Fpinterestplugin.com&media=http%3A%2F%2Fpinterestplugin.com%2Fwp-content%2Fuploads%2F2012%2F02%2Fpinterest-pin-it-button-wordpress-plugin.jpg&description=Pinterest%20%22Pin%20It%22%20Button%20Plugin%20for%20WordPress"
|
5 |
-
|
6 |
-
<script type="text/javascript" async src="//assets.pinterest.com/js/pinit.js"></script>
|
7 |
|
8 |
</body>
|
9 |
</html>
|
1 |
<html>
|
2 |
<body style="margin: 0; padding: 0;">
|
3 |
|
4 |
+
<a href="http://pinterest.com/pin/create/button/?url=http%3A%2F%2Fpinterestplugin.com%2F&media=http%3A%2F%2Fpinterestplugin.com%2Fwp-content%2Fuploads%2F2012%2F02%2Fpinterest-pin-it-button-wordpress-plugin.jpg&description=Pinterest%20%22Pin%20It%22%20Button%20Plugin%20for%20WordPress%20--%20http%3A%2F%2Fpinterestplugin.com" class="pin-it-button" count-layout="horizontal">Pin It</a>
|
5 |
+
<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>
|
|
|
6 |
|
7 |
</body>
|
8 |
</html>
|
inc/admin-settings.php
ADDED
@@ -0,0 +1,344 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//Create settings page
|
4 |
+
|
5 |
+
function pib_create_settings_page() {
|
6 |
+
global $pib_options;
|
7 |
+
$custom_css = trim( $pib_options['custom_css'] );
|
8 |
+
?>
|
9 |
+
|
10 |
+
<div class="wrap">
|
11 |
+
<a href="http://pinterestplugin.com/" target="_blank"><div id="pinterest-button-icon-32" class="icon32"
|
12 |
+
style="background: url(<?php echo plugins_url( '/img/pinterest-button-icon-med.png', dirname( __FILE__ ) ); ?>) no-repeat;"></div></a>
|
13 |
+
<h2><?php _e( 'Pinterest "Pin It" Button Settings', 'pib' ); ?></h2>
|
14 |
+
|
15 |
+
<div id="poststuff" class="metabox-holder has-right-sidebar">
|
16 |
+
|
17 |
+
<!-- Fixed right sidebar like WP post edit screen -->
|
18 |
+
<div id="side-info-column" class="inner-sidebar">
|
19 |
+
<div id="side-sortables" class="meta-box-sortables ui-sortable">
|
20 |
+
<div class="pib-admin-banner">
|
21 |
+
<a href="http://pinterestplugin.com/ad-tpp-from-pib" target="_blank">
|
22 |
+
<img src="http://cdn.pinterestplugin.com/img/top-pinned-posts-ad-01.jpg" alt="Top Pinned Posts Pinterest Plugin for WordPress"></img>
|
23 |
+
</a>
|
24 |
+
</div>
|
25 |
+
|
26 |
+
<div class="postbox">
|
27 |
+
<div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
|
28 |
+
<h3 class="hndle pib-hndle"><?php _e( 'Spread the Word', 'pib' ); ?></h3>
|
29 |
+
|
30 |
+
<div class="inside">
|
31 |
+
<p><?php _e( 'Like this plugin? A share would be awesome!', 'pib' ); ?></p>
|
32 |
+
|
33 |
+
<table id="share_plugin_buttons">
|
34 |
+
<tr>
|
35 |
+
<td><?php echo pib_share_twitter(); ?></td>
|
36 |
+
<td><?php echo pib_share_pinterest(); ?></td>
|
37 |
+
<td><?php echo pib_share_facebook(); ?></td>
|
38 |
+
</tr>
|
39 |
+
</table>
|
40 |
+
|
41 |
+
<p>
|
42 |
+
» <a href="http://wordpress.org/extend/plugins/pinterest-pin-it-button/" target="_blank" class="external">
|
43 |
+
<?php _e( 'Rate it on WordPress', 'pib' ); ?></a>
|
44 |
+
</p>
|
45 |
+
</div>
|
46 |
+
</div>
|
47 |
+
|
48 |
+
<div class="postbox">
|
49 |
+
<div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
|
50 |
+
<h3 class="hndle pib-hndle"><?php _e( 'Plugin Support', 'tpp' ); ?></h3>
|
51 |
+
|
52 |
+
<div class="inside">
|
53 |
+
<p>
|
54 |
+
» <a href="http://pinterestplugin.com/support-pin-it-button" target="_blank" class="external">
|
55 |
+
<?php _e( 'Support & Knowledge Base', 'pib' ); ?></a>
|
56 |
+
</p>
|
57 |
+
<p>
|
58 |
+
<?php _e( 'Email support provided to licensed users only.', 'pib' ); ?>
|
59 |
+
</p>
|
60 |
+
<p>
|
61 |
+
» <strong><a href="http://pinterestplugin.com/buy-support-pin-it-button" target="_blank" class="external">
|
62 |
+
<?php _e( 'See Support Pricing', 'pib' ); ?></a></strong>
|
63 |
+
</p>
|
64 |
+
</div>
|
65 |
+
</div>
|
66 |
+
|
67 |
+
<div class="postbox">
|
68 |
+
<div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
|
69 |
+
<h3 class="hndle pib-hndle"><?php _e( 'More Pinterest Plugins', 'pib' ); ?></h3>
|
70 |
+
|
71 |
+
<div class="inside">
|
72 |
+
<ul>
|
73 |
+
<li>» <a href="http://pinterestplugin.com/top-pinned posts" target="_blank" class="external">Top Pinned Posts</a></li>
|
74 |
+
<li>» <a href="http://pinterestplugin.com/follow-button" target="_blank" class="external">"Follow" Button</a></li>
|
75 |
+
<li>» <a href="http://pinterestplugin.com/pinterest-block" target="_blank" class="external">Pinterest Block</a></li>
|
76 |
+
</ul>
|
77 |
+
</div>
|
78 |
+
</div>
|
79 |
+
|
80 |
+
<div class="postbox">
|
81 |
+
<div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
|
82 |
+
<h3 class="hndle pib-hndle"><?php _e( 'Pinterest Plugin News', 'pib' ); ?></h3>
|
83 |
+
|
84 |
+
<div class="inside">
|
85 |
+
<? echo pib_rss_news(); ?>
|
86 |
+
</div>
|
87 |
+
</div>
|
88 |
+
|
89 |
+
<div class="postbox">
|
90 |
+
<div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
|
91 |
+
<h3 class="hndle pib-hndle"><?php _e( 'Subscribe by Email', 'pib' ); ?></h3>
|
92 |
+
|
93 |
+
<div class="inside">
|
94 |
+
<p><?php _e( 'Want to know when new Pinterest plugins and features are released?', 'pib' ); ?></p>
|
95 |
+
» <strong><a href="http://pinterestplugin.com/newsletter-from-plugin" target="_blank" class="external">
|
96 |
+
<?php _e( 'Get Updates', 'pib' ); ?></a></strong>
|
97 |
+
</div>
|
98 |
+
</div>
|
99 |
+
</div>
|
100 |
+
</div>
|
101 |
+
|
102 |
+
<div id="post-body">
|
103 |
+
<div id="post-body-content">
|
104 |
+
<div class="meta-box-sortables ui-sortable">
|
105 |
+
<?php settings_errors(); //Display status messages after action ("settings saved", errors) ?>
|
106 |
+
|
107 |
+
<form method="post" action="options.php">
|
108 |
+
<?php settings_fields( 'pib-settings-group' ); ?>
|
109 |
+
|
110 |
+
<div id="button-type" class="postbox pib-postbox">
|
111 |
+
<div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
|
112 |
+
<h3 class="hndle pib-hndle"><?php _e( 'Button Style', 'pib' ); ?></h3>
|
113 |
+
|
114 |
+
<table class="form-table inside">
|
115 |
+
<tr valign="top">
|
116 |
+
<td>
|
117 |
+
<?php _e( 'What style of button would you like to use?', 'pib' ); ?>
|
118 |
+
</td>
|
119 |
+
</tr>
|
120 |
+
<tr valign="top">
|
121 |
+
<td>
|
122 |
+
<input type="radio" id="user_selects_image" value="user_selects_image" name="pib_options[button_style]"
|
123 |
+
<?php checked( ( $pib_options['button_style'] == 'user_selects_image' ) || empty( $pib_options['button_style'] ) ); ?> />
|
124 |
+
<label for="display_pinit_button"><strong>User selects image</strong> from popup</label>
|
125 |
+
</td>
|
126 |
+
</tr>
|
127 |
+
<tr valign="top">
|
128 |
+
<td>
|
129 |
+
<input type="radio" id="image_selected" value="image_selected" name="pib_options[button_style]"
|
130 |
+
<?php checked( $pib_options['button_style'], 'image_selected' ); ?> />
|
131 |
+
<label for="display_pinit_count_button">Image is <strong>pre-selected</strong></label>
|
132 |
+
</td>
|
133 |
+
</tr>
|
134 |
+
<tr valign="top">
|
135 |
+
<td class="pib-pad-cell-top">
|
136 |
+
<label for="pib_pin_count" class="pib-plain-label"><?php _e( 'Pin Count:' ); ?></label>
|
137 |
+
<select id="count_layout" name="pib_options[count_layout]">
|
138 |
+
<option value="none" <?php selected( ( $pib_options['count_layout'] == 'none' ) || empty( $pib_options['count_layout'] ) ); ?>><?php _e( 'No Count' ); ?></option>
|
139 |
+
<option value="horizontal" <?php selected( $pib_options['count_layout'], 'horizontal' ); ?>><?php _e( 'Horizontal' ); ?></option>
|
140 |
+
<option value="vertical" <?php selected( $pib_options['count_layout'], 'vertical' ); ?>><?php _e('Vertical'); ?></option>
|
141 |
+
</select>
|
142 |
+
</td>
|
143 |
+
</tr>
|
144 |
+
<tr valign="top">
|
145 |
+
<td>
|
146 |
+
<input id="always_show_count" name="pib_options[always_show_count]" type="checkbox" <?php if ( $pib_options['always_show_count'] ) echo 'checked="checked"'; ?> />
|
147 |
+
<label for="always_show_count">Always show pin count (currently works on vertical pin count only)</label>
|
148 |
+
</td>
|
149 |
+
</tr>
|
150 |
+
<tr valign="top">
|
151 |
+
<td class="pib-pad-cell-top">
|
152 |
+
To specify the website address (URL) to pin, image to pin and/or pin description (other than the defaults), go to the edit screen for those posts and pages
|
153 |
+
and scroll to the bottom.
|
154 |
+
</td>
|
155 |
+
</tr>
|
156 |
+
<tr valign="top">
|
157 |
+
<td>
|
158 |
+
The button style setting applies to <strong>ALL</strong> "Pin It" buttons displayed on the website (widgets and shortcodes included).
|
159 |
+
</td>
|
160 |
+
</tr>
|
161 |
+
</table>
|
162 |
+
|
163 |
+
</div>
|
164 |
+
|
165 |
+
<div id="pib-options" class="postbox pib-postbox">
|
166 |
+
<div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
|
167 |
+
<h3 class="hndle pib-hndle"><?php _e( 'Button Visibility', 'pib' ); ?></h3>
|
168 |
+
|
169 |
+
<table class="form-table inside">
|
170 |
+
<tr valign="top">
|
171 |
+
<td>
|
172 |
+
<?php _e( 'What types of pages should the button appear on?', 'pib' ); ?>
|
173 |
+
</td>
|
174 |
+
</tr>
|
175 |
+
<tr valign="top">
|
176 |
+
<td>
|
177 |
+
<input id="display_home_page" name="pib_options[display_home_page]" type="checkbox" value="1"
|
178 |
+
<?php checked( (bool)$pib_options['display_home_page'] ); ?> />
|
179 |
+
<label for="display_home_page">Blog Home Page (or Latest Posts Page)</label>
|
180 |
+
</td>
|
181 |
+
</tr>
|
182 |
+
<tr valign="top">
|
183 |
+
<td>
|
184 |
+
<input id="display_front_page" name="pib_options[display_front_page]" type="checkbox" value="1"
|
185 |
+
<?php checked( (bool)$pib_options['display_front_page'] ); ?> />
|
186 |
+
<label for="display_front_page">Front Page (different from Home Page only if set in Settings > Reading)</label>
|
187 |
+
</td>
|
188 |
+
</tr>
|
189 |
+
<tr valign="top">
|
190 |
+
<td>
|
191 |
+
<input id="display_posts" name="pib_options[display_posts]" type="checkbox" value="1"
|
192 |
+
<?php checked( (bool)$pib_options['display_posts'] ); ?> />
|
193 |
+
<label for="display_posts">Individual Posts</label>
|
194 |
+
</td>
|
195 |
+
</tr>
|
196 |
+
<tr valign="top">
|
197 |
+
<td>
|
198 |
+
<input id="display_pages" name="pib_options[display_pages]" type="checkbox" value="1"
|
199 |
+
<?php checked( (bool)$pib_options['display_pages'] ); ?> />
|
200 |
+
<label for="display_pages">WordPress Static "Pages"</label>
|
201 |
+
</td>
|
202 |
+
</tr>
|
203 |
+
<tr valign="top">
|
204 |
+
<td>
|
205 |
+
<input id="display_archives" name="pib_options[display_archives]" type="checkbox" value="1"
|
206 |
+
<?php checked( (bool)$pib_options['display_archives'] ); ?> />
|
207 |
+
<label for="display_archives">Archives (includes Category, Tag, Author and date-based pages)</label>
|
208 |
+
</td>
|
209 |
+
</tr>
|
210 |
+
<tr valign="top">
|
211 |
+
<td class="pib-pad-cell-top">
|
212 |
+
To hide the "Pin It" button for a specific post, page or category, go to the edit screen for that post, page or category,
|
213 |
+
scroll down to the bottom, and uncheck the "Show" checkbox.
|
214 |
+
</td>
|
215 |
+
</tr>
|
216 |
+
<tr valign="top">
|
217 |
+
<td>
|
218 |
+
Go to Appearance → <a href="<?php echo admin_url( 'widgets.php' ); ?>">Widgets</a> to add a "Pin It" button to your sidebar.
|
219 |
+
</td>
|
220 |
+
</tr>
|
221 |
+
</table>
|
222 |
+
</div>
|
223 |
+
|
224 |
+
<div id="button-show" class="postbox pib-postbox">
|
225 |
+
<div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
|
226 |
+
<h3 class="hndle pib-hndle"><?php _e( 'Button Placement', 'pib' ); ?></h3>
|
227 |
+
|
228 |
+
<table class="form-table inside">
|
229 |
+
<tr valign="top">
|
230 |
+
<td>
|
231 |
+
<?php _e( 'Where on each page should the button appear?', 'pib' ); ?>
|
232 |
+
</td>
|
233 |
+
</tr>
|
234 |
+
<tr valign="top">
|
235 |
+
<td>
|
236 |
+
<input id="display_above_content" name="pib_options[display_above_content]" type="checkbox" value="1"
|
237 |
+
<?php checked( (bool)$pib_options['display_above_content'] ); ?> />
|
238 |
+
<label for="display_above_content">Above Content</label>
|
239 |
+
</td>
|
240 |
+
</tr>
|
241 |
+
<tr valign="top">
|
242 |
+
<td>
|
243 |
+
<input id="display_below_content" name="pib_options[display_below_content]" type="checkbox" value="1"
|
244 |
+
<?php checked( (bool)$pib_options['display_below_content'] ); ?> />
|
245 |
+
<label for="display_below_content">Below Content</label>
|
246 |
+
</td>
|
247 |
+
</tr>
|
248 |
+
<tr valign="top">
|
249 |
+
<td>
|
250 |
+
<input id="display_on_post_excerpts" name="pib_options[display_on_post_excerpts]" type="checkbox" value="1"
|
251 |
+
<?php checked( (bool)$pib_options['display_on_post_excerpts'] ); ?> />
|
252 |
+
<label for="display_on_post_excerpts">On Post Excerpts</label>
|
253 |
+
</td>
|
254 |
+
</tr>
|
255 |
+
<tr valign="top">
|
256 |
+
<td>
|
257 |
+
Currently, only the button style <strong>"image is pre-selected"</strong> will use the individual post URL when a visitor
|
258 |
+
pins on a post excerpt.
|
259 |
+
</td>
|
260 |
+
</tr>
|
261 |
+
</table>
|
262 |
+
</div>
|
263 |
+
|
264 |
+
<div class="submit-settings">
|
265 |
+
<input name="submit" type="submit" value="Save Settings" class="button-primary" />
|
266 |
+
</div>
|
267 |
+
|
268 |
+
<div id="style-options" class="postbox pib-postbox">
|
269 |
+
<div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
|
270 |
+
<h3 class="hndle pib-hndle"><?php _e( 'Advanced Styling & CSS', 'pib' ); ?></h3>
|
271 |
+
|
272 |
+
<table class="form-table inside">
|
273 |
+
<tr valign="top">
|
274 |
+
<td>
|
275 |
+
<label for="custom_css">Custom CSS</label>
|
276 |
+
</td>
|
277 |
+
</tr>
|
278 |
+
<tr valign="top">
|
279 |
+
<td>
|
280 |
+
<textarea id="pib-custom-css" name="pib_options[custom_css]" rows="6"><?php echo $custom_css; ?></textarea>
|
281 |
+
</td>
|
282 |
+
</tr>
|
283 |
+
<tr valign="top">
|
284 |
+
<td>
|
285 |
+
<input id="remove_div" name="pib_options[remove_div]" type="checkbox" value="1"
|
286 |
+
<?php checked( (bool)$pib_options['remove_div'] ); ?> />
|
287 |
+
<label for="remove_div">Remove div tag surrounding regular button: <code><?php echo htmlentities('<div class="pin-it-btn-wrapper"></div>'); ?></code></label>
|
288 |
+
</td>
|
289 |
+
</tr>
|
290 |
+
|
291 |
+
<tr valign="top">
|
292 |
+
<td>
|
293 |
+
<a href="http://pinterestplugin.com/pin-it-button-custom-css/" target="_blank" class="external">
|
294 |
+
See custom CSS examples</a> aligning the button with other social sharing plugins.
|
295 |
+
</td>
|
296 |
+
</tr>
|
297 |
+
</table>
|
298 |
+
</div>
|
299 |
+
|
300 |
+
<div class="postbox pib-postbox">
|
301 |
+
<div class="handlediv pib-handlediv" title="Click to toggle"><br /></div>
|
302 |
+
<h3 class="hndle pib-hndle"><?php _e( 'Shortcode Instructions', 'pib' ); ?></h3>
|
303 |
+
|
304 |
+
<div class="inside">
|
305 |
+
<p>
|
306 |
+
Use the shortcode <code>[pinit]</code> to display the button within your content.
|
307 |
+
</p>
|
308 |
+
<p>
|
309 |
+
Use the function <code><?php echo htmlentities('<?php echo do_shortcode(\'[pinit]\'); ?>'); ?></code>
|
310 |
+
to display within template or theme files.
|
311 |
+
</p>
|
312 |
+
<p><strong>Shortcode parameters</strong></p>
|
313 |
+
<p>
|
314 |
+
- count: none (default), horizontal, vertical<br/>
|
315 |
+
- url: URL of the web page to be pinned (defaults to current post/page URL, but <em>must specify</em> if on home or index page)<br/>
|
316 |
+
- image_url: URL of the image to be pinned (defaults to first image in post)<br/>
|
317 |
+
- description: description of the pin (defaults to post title)<br/>
|
318 |
+
- float: none (default), left, right<br/>
|
319 |
+
- remove_div: false (default), true -- if true removes surrounding div tag
|
320 |
+
(<code><?php echo htmlentities('<div class="pin-it-btn-wrapper-shortcode"></div>'); ?></code>), which also removes float setting<br/>
|
321 |
+
- always_show_count: false (default), true -- if true will show count even if zero
|
322 |
+
</p>
|
323 |
+
<p><strong>Examples</strong></p>
|
324 |
+
<p>
|
325 |
+
<code>[pinit count="horizontal"]</code><br/>
|
326 |
+
<code>[pinit count="vertical" url="http://www.mysite.com" image_url="http://www.mysite.com/myimage.jpg"
|
327 |
+
description="My favorite image!" float="right"]</code><br/>
|
328 |
+
</p>
|
329 |
+
</div>
|
330 |
+
</div>
|
331 |
+
|
332 |
+
<div class="submit-settings">
|
333 |
+
<input name="submit" type="submit" value="Save Settings" class="button-primary" />
|
334 |
+
</div>
|
335 |
+
|
336 |
+
</form>
|
337 |
+
</div>
|
338 |
+
</div>
|
339 |
+
</div>
|
340 |
+
</div>
|
341 |
+
</div>
|
342 |
+
|
343 |
+
<?php
|
344 |
+
}
|
inc/category-meta-page.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//Option name
|
4 |
+
|
5 |
+
define('PIB_CATEGORY_FIELDS', 'pib_category_fields_option');
|
6 |
+
|
7 |
+
//Add Checkbox to Category Edit Screen
|
8 |
+
|
9 |
+
add_action('edit_category_form_fields', 'pib_category_fields');
|
10 |
+
|
11 |
+
function pib_category_fields($tag) {
|
12 |
+
$t_id = $tag->term_id;
|
13 |
+
$tag_extra_fields = get_option(PIB_CATEGORY_FIELDS);
|
14 |
+
|
15 |
+
if ( $tag_extra_fields[$t_id]['checkbox'] == true)
|
16 |
+
$pib_category_checked = '';
|
17 |
+
else
|
18 |
+
$pib_category_checked = 'checked="checked"';
|
19 |
+
|
20 |
+
?>
|
21 |
+
|
22 |
+
<table class="form-table">
|
23 |
+
<tr class="form-field">
|
24 |
+
<th scope="row" valign="top">
|
25 |
+
<h3>"Pin It" Button Settings</h3>
|
26 |
+
</th>
|
27 |
+
</tr>
|
28 |
+
<tbody>
|
29 |
+
<tr class="form-field">
|
30 |
+
<th scope="row" valign="top">
|
31 |
+
<label for="pib_category_field">Show "Pin It" Button</label>
|
32 |
+
</th>
|
33 |
+
<td>
|
34 |
+
<input name="pib_category_field" id="pib_category_field" type="checkbox" value="true" style="width: auto;"
|
35 |
+
<?php echo $pib_category_checked; ?> />
|
36 |
+
<p class="description">
|
37 |
+
If checked displays the button for this category (if <strong>Archives</strong> also checked in
|
38 |
+
<a href="<?php echo admin_url( 'admin.php?page=' . PIB_PLUGIN_BASENAME ); ?>">"Pin It" Button Settings</a>).
|
39 |
+
If unchecked the button will <strong>always</strong> be hidden for this category.
|
40 |
+
</p>
|
41 |
+
</td>
|
42 |
+
</tr>
|
43 |
+
</tbody>
|
44 |
+
</table>
|
45 |
+
|
46 |
+
<?php
|
47 |
+
}
|
48 |
+
|
49 |
+
// when the form gets submitted, and the category gets updated (in your case the option will get updated with the values of your custom fields above
|
50 |
+
|
51 |
+
add_action('edited_category', 'update_pib_category_fields');
|
52 |
+
|
53 |
+
function update_pib_category_fields($term_id) {
|
54 |
+
if ( $_POST['taxonomy'] == 'category' ) {
|
55 |
+
$tag_extra_fields = get_option(PIB_CATEGORY_FIELDS);
|
56 |
+
$tag_extra_fields[$term_id]['checkbox'] = strip_tags($_POST['pib_category_field']);
|
57 |
+
|
58 |
+
if ( $_POST['pib_category_field'] != true ) {
|
59 |
+
$tag_extra_fields[$term_id]['checkbox'] = true;
|
60 |
+
update_option( PIB_CATEGORY_FIELDS, $tag_extra_fields );
|
61 |
+
}
|
62 |
+
if ( $_POST['pib_category_field'] == true ) {
|
63 |
+
$tag_extra_fields[$term_id]['checkbox'] = "";
|
64 |
+
update_option( PIB_CATEGORY_FIELDS, $tag_extra_fields );
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
inc/pin-it-button-user-selects-image-iframe.html
ADDED
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<style type="text/css">
|
5 |
+
/*
|
6 |
+
This is a modified version of http://d3io1k5o0zdpqr.cloudfront.net/pinit.html
|
7 |
+
To avoid conflict with official Pinterest button behavior, a "2"
|
8 |
+
has been appended to many DOM IDs and JS function names.
|
9 |
+
*/
|
10 |
+
|
11 |
+
body {
|
12 |
+
margin: 0;
|
13 |
+
padding: 0;
|
14 |
+
}
|
15 |
+
#PinItButton2 {
|
16 |
+
position: absolute;
|
17 |
+
background: url(//d3io1k5o0zdpqr.cloudfront.net/images/pinit6.png);
|
18 |
+
font: 11px Arial, sans-serif;
|
19 |
+
text-indent: -9999em;
|
20 |
+
font-size: .01em;
|
21 |
+
color: #CD1F1F;
|
22 |
+
height: 20px;
|
23 |
+
width: 43px;
|
24 |
+
background-position: 0 -7px;
|
25 |
+
}
|
26 |
+
#PinItButton2:hover {
|
27 |
+
background-position: 0 -28px;
|
28 |
+
}
|
29 |
+
#PinItButton2:active {
|
30 |
+
background-position: 0 -49px;
|
31 |
+
}
|
32 |
+
#PinItButton2.pinned {
|
33 |
+
background-position: 0 -70px !important;
|
34 |
+
}
|
35 |
+
#CountPointer2 {
|
36 |
+
position: absolute;
|
37 |
+
z-index: 1;
|
38 |
+
background: url(//d3io1k5o0zdpqr.cloudfront.net/images/pinit6.png);
|
39 |
+
text-indent: -9999em;
|
40 |
+
font-size: .01em;
|
41 |
+
color: #FFF;
|
42 |
+
}
|
43 |
+
#CountBubble2 {
|
44 |
+
position: absolute;
|
45 |
+
border: 1px solid #C9C5C5;
|
46 |
+
color: #777;
|
47 |
+
background-color: #FCF9F9;
|
48 |
+
border-radius: 1px;
|
49 |
+
}
|
50 |
+
body.horizontal #CountPointer2 {
|
51 |
+
left: 43px;
|
52 |
+
height: 18px;
|
53 |
+
width: 4px;
|
54 |
+
background-position: -43px -8px;
|
55 |
+
}
|
56 |
+
body.horizontal #CountBubble2 {
|
57 |
+
top: 1px;
|
58 |
+
left: 46px;
|
59 |
+
height: 10px;
|
60 |
+
line-height: 10px;
|
61 |
+
padding: 2px 5px 4px 5px;
|
62 |
+
font: 10px Arial, Helvetica, sans-serif;
|
63 |
+
display: inline-block;
|
64 |
+
}
|
65 |
+
body.vertical #PinItButton2 {
|
66 |
+
top: 38px;
|
67 |
+
}
|
68 |
+
body.vertical #CountPointer2 {
|
69 |
+
top: 31px;
|
70 |
+
height: 7px;
|
71 |
+
width: 41px;
|
72 |
+
background-position: 0 0;
|
73 |
+
}
|
74 |
+
body.vertical #CountBubble2 {
|
75 |
+
left: 1px;
|
76 |
+
height: 21px;
|
77 |
+
width: 39px;
|
78 |
+
font: 12px Arial, Helvetica, sans-serif;
|
79 |
+
line-height: 12px;
|
80 |
+
padding: 9px 0 0;
|
81 |
+
text-align: center;
|
82 |
+
}
|
83 |
+
body.none #PinItCount2 {
|
84 |
+
display: none;
|
85 |
+
}
|
86 |
+
</style>
|
87 |
+
|
88 |
+
<script type="text/javascript">
|
89 |
+
var countLayout = 'horizontal';
|
90 |
+
var alwaysShowCount = false;
|
91 |
+
|
92 |
+
function pinIt2(pinItButton, pinUrl) {
|
93 |
+
return function(e) {
|
94 |
+
|
95 |
+
parent.execPinmarklet();
|
96 |
+
|
97 |
+
//Bookmarklet will open official create button popup after image selected,
|
98 |
+
//so this code not needed.
|
99 |
+
|
100 |
+
/*
|
101 |
+
var t;
|
102 |
+
if (e.target) t = e.target;
|
103 |
+
else t = e.srcElement;
|
104 |
+
if (t.id != pinItButton.id)
|
105 |
+
return false;
|
106 |
+
|
107 |
+
var modal = window.open(pinUrl, 'signin', 'width=665,height=300');
|
108 |
+
var wait = function() {
|
109 |
+
setTimeout(function() {
|
110 |
+
if (modal == null) {
|
111 |
+
failure();
|
112 |
+
return;
|
113 |
+
}
|
114 |
+
if (modal.closed)
|
115 |
+
pinItButton.setAttribute('class', 'pinned');
|
116 |
+
else
|
117 |
+
wait();
|
118 |
+
}, 25);
|
119 |
+
};
|
120 |
+
|
121 |
+
wait();
|
122 |
+
*/
|
123 |
+
|
124 |
+
return false;
|
125 |
+
};
|
126 |
+
}
|
127 |
+
|
128 |
+
function receiveCount(data) {
|
129 |
+
if (data['error'])
|
130 |
+
return;
|
131 |
+
|
132 |
+
var targetUrl = data['url'];
|
133 |
+
var pinItCount = document.getElementById('PinItCount2');
|
134 |
+
var countBubble = document.getElementById('CountBubble2');
|
135 |
+
|
136 |
+
if (!alwaysShowCount && data['count'] < 1 && countLayout === 'horizontal')
|
137 |
+
return;
|
138 |
+
|
139 |
+
pinItCount.style.display = 'block';
|
140 |
+
var count = data['count'];
|
141 |
+
if (count > 999 && count <= 999999)
|
142 |
+
count = Math.floor(count / 1000) + "K+";
|
143 |
+
else if (count > 999999 && count <= 999999999)
|
144 |
+
count = Math.floor(count / 1000000) + "M+";
|
145 |
+
else if (count > 999999999)
|
146 |
+
count = "++";
|
147 |
+
countBubble.innerHTML = count;
|
148 |
+
}
|
149 |
+
|
150 |
+
window.onload = function() {
|
151 |
+
var pinItButton = document.getElementById('PinItButton2');
|
152 |
+
var pinItCount = document.getElementById('PinItCount2');
|
153 |
+
|
154 |
+
// Parse args
|
155 |
+
var vars = {}, url = window.location.href;
|
156 |
+
var pairs = url.slice(url.indexOf('?') + 1).split('&');
|
157 |
+
for (var i = 0; i < pairs.length; i++) {
|
158 |
+
var parts = pairs[i].split('=');
|
159 |
+
vars[parts[0]] = parts[1];
|
160 |
+
}
|
161 |
+
|
162 |
+
countLayout = vars['layout'] || countLayout;
|
163 |
+
alwaysShowCount = vars['count'] || alwaysShowCount;
|
164 |
+
|
165 |
+
// Apply count layout class
|
166 |
+
document.body.className = countLayout;
|
167 |
+
|
168 |
+
// Build pin URL
|
169 |
+
delete vars['layout'];
|
170 |
+
delete vars['count'];
|
171 |
+
var sep = '?', pinUrl = 'http://pinterest.com/pin/create/button/';
|
172 |
+
for (var i in vars) {
|
173 |
+
pinUrl += sep + i + '=' + vars[i];
|
174 |
+
sep = '&';
|
175 |
+
}
|
176 |
+
|
177 |
+
// Button click handler
|
178 |
+
if (document.addEventListener)
|
179 |
+
pinItButton.addEventListener('click', pinIt2(pinItButton, pinUrl), false);
|
180 |
+
else if (document.attachEvent)
|
181 |
+
pinItButton.attachEvent('onclick', pinIt2(pinItButton, pinUrl));
|
182 |
+
|
183 |
+
// Request count from API
|
184 |
+
if (countLayout != 'none' || alwaysShowCount) {
|
185 |
+
var targetUrl = vars['url'] || vars['media'];
|
186 |
+
var snode = document.createElement('script');
|
187 |
+
var hnode = document.getElementsByTagName('head')[0];
|
188 |
+
snode.setAttribute('async', 'true');
|
189 |
+
snode.setAttribute('src', '//api.pinterest.com/v1/urls/count.json?callback=receiveCount&url='+targetUrl);
|
190 |
+
hnode.appendChild(snode);
|
191 |
+
}
|
192 |
+
};
|
193 |
+
</script>
|
194 |
+
</head>
|
195 |
+
|
196 |
+
<body>
|
197 |
+
<a href="javascript:void(0)" id="PinItButton2" title="Pin it on Pinterest">Pin it</a>
|
198 |
+
<div id="PinItCount2" style="display:none;">
|
199 |
+
<div id="CountPointer2">«</div>
|
200 |
+
<div id="CountBubble2">0</div>
|
201 |
+
</div>
|
202 |
+
</body>
|
203 |
+
</html>
|
inc/post-meta-page.php
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//Adds a meta box to the main column on the Post and Page edit screens
|
4 |
+
|
5 |
+
function pib_sharing_add_meta_box() {
|
6 |
+
add_meta_box( 'pib_sharing_meta','"Pin It" Button Settings', 'pib_sharing_meta_box_content', 'page', 'advanced', 'high' );
|
7 |
+
add_meta_box( 'pib_sharing_meta','"Pin It" Button Settings', 'pib_sharing_meta_box_content', 'post', 'advanced', 'high' );
|
8 |
+
}
|
9 |
+
|
10 |
+
//Renders the post/page meta box checkbox html
|
11 |
+
|
12 |
+
function pib_sharing_meta_box_content( $post ) {
|
13 |
+
global $pib_options;
|
14 |
+
|
15 |
+
$pib_sharing_checked = get_post_meta( $post->ID, 'pib_sharing_disabled', 1 );
|
16 |
+
$pib_url_of_webpage = get_post_meta( $post->ID, 'pib_url_of_webpage', true);
|
17 |
+
$pib_url_of_img = get_post_meta( $post->ID, 'pib_url_of_img', true);
|
18 |
+
$pib_description = get_post_meta( $post->ID, 'pib_description', true);
|
19 |
+
|
20 |
+
$pib_button_style = ( $pib_options['button_style'] == 'user_selects_image' ) ? 'User selects image' : 'Image pre-selected';
|
21 |
+
?>
|
22 |
+
|
23 |
+
<p>
|
24 |
+
<em>Button style is inherited from setting saved in <a href="<?php echo admin_url( 'admin.php?page=' . PIB_PLUGIN_BASENAME ); ?>">"Pin It" Button Settings</a>.
|
25 |
+
Current style: <strong><?php echo $pib_button_style; ?></strong></em>
|
26 |
+
</p>
|
27 |
+
<p>
|
28 |
+
<em>These 3 text fields will be used only if the button style is: <strong>Image pre-selected</strong></em>
|
29 |
+
</p>
|
30 |
+
<p>
|
31 |
+
<table class="form-table inside">
|
32 |
+
<tr valign="top">
|
33 |
+
<td>
|
34 |
+
<label for="pib_url_of_webpage">URL of the web page to be pinned (defaults to current post/page URL if left blank):</label><br/>
|
35 |
+
<input type="text" id="pib_url_of_webpage" name="pib_url_of_webpage" value="<?php echo $pib_url_of_webpage; ?>" class="widefat"/>
|
36 |
+
</td>
|
37 |
+
</tr>
|
38 |
+
<tr valign="top">
|
39 |
+
<td>
|
40 |
+
<label for="pib_url_of_img">URL of the image to be pinned (defaults to first image in post if left blank):</label><br/>
|
41 |
+
<input type="text" id="pib_url_of_img" name="pib_url_of_img" value="<?php echo $pib_url_of_img; ?>" class="widefat"/>
|
42 |
+
</td>
|
43 |
+
</tr>
|
44 |
+
<tr valign="top">
|
45 |
+
<td>
|
46 |
+
<label for="pib_description">Description of the pin (defaults to post title if left blank):</label><br/>
|
47 |
+
<input type="text" id="pib_description" name="pib_description" value="<?php echo $pib_description; ?>" class="widefat"/>
|
48 |
+
</td>
|
49 |
+
</tr>
|
50 |
+
</table>
|
51 |
+
</p>
|
52 |
+
|
53 |
+
<p>
|
54 |
+
<input name="pib_enable_post_sharing" id="pib_enable_post_sharing" type="checkbox" value="1"
|
55 |
+
<?php checked( empty( $pib_sharing_checked ) || ($pib_sharing_checked === false) ); ?> />
|
56 |
+
<label for="pib_enable_post_sharing">Show "Pin It" button on this post/page.</label>
|
57 |
+
<p class="description">
|
58 |
+
If checked displays the button for this post/page (if <strong>Individual Posts</strong> (for posts) or <strong>WordPress Static "Pages"</strong>
|
59 |
+
(for pages) is also checked in <a href="<?php echo admin_url( 'admin.php?page=' . PIB_PLUGIN_BASENAME ); ?>">"Pin It" Button Settings</a>).
|
60 |
+
If unchecked the button will <strong>always</strong> be hidden for this post/page.
|
61 |
+
</p>
|
62 |
+
<input type="hidden" name="pib_sharing_status_hidden" value="1" />
|
63 |
+
</p>
|
64 |
+
|
65 |
+
<?php
|
66 |
+
}
|
67 |
+
|
68 |
+
|
69 |
+
//Saves display option for individual post/page
|
70 |
+
|
71 |
+
function pib_sharing_meta_box_save( $post_id ) {
|
72 |
+
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
|
73 |
+
return $post_id;
|
74 |
+
|
75 |
+
// Record sharing disable
|
76 |
+
if ( isset( $_POST['post_type'] ) && ( 'post' == $_POST['post_type'] || 'page' == $_POST['post_type'] ) ) {
|
77 |
+
if ( current_user_can( 'edit_post', $post_id ) ) {
|
78 |
+
if ( isset( $_POST['pib_sharing_status_hidden'] ) ) {
|
79 |
+
if ( !isset( $_POST['pib_enable_post_sharing'] ) ) {
|
80 |
+
update_post_meta( $post_id, 'pib_sharing_disabled', 1 );
|
81 |
+
}
|
82 |
+
else {
|
83 |
+
delete_post_meta( $post_id, 'pib_sharing_disabled' );
|
84 |
+
}
|
85 |
+
|
86 |
+
if ( isset( $_POST['pib_url_of_webpage'] ) && isset( $_POST['pib_url_of_img'] ) && isset( $_POST['pib_description'] )) {
|
87 |
+
update_post_meta( $post_id, 'pib_url_of_webpage', $_POST['pib_url_of_webpage'] );
|
88 |
+
update_post_meta( $post_id, 'pib_url_of_img', $_POST['pib_url_of_img'] );
|
89 |
+
update_post_meta( $post_id, 'pib_description', $_POST['pib_description'] );
|
90 |
+
}
|
91 |
+
else {
|
92 |
+
delete_post_meta( $post_id, 'pib_url_of_webpage' );
|
93 |
+
delete_post_meta( $post_id, 'pib_url_of_img' );
|
94 |
+
delete_post_meta( $post_id, 'pib_description' );
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
return $post_id;
|
101 |
+
}
|
102 |
+
|
103 |
+
add_action( 'save_post', 'pib_sharing_meta_box_save' );
|
inc/shortcode.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//Register shortcode: [pinit url="" image_url="" description="" float="none" remove_div="false" always_show_count="false"]
|
4 |
+
|
5 |
+
function pib_button_shortcode_html( $attr ) {
|
6 |
+
global $pib_options;
|
7 |
+
global $post;
|
8 |
+
|
9 |
+
/*
|
10 |
+
For URL, image URL and Description, use in order:
|
11 |
+
1) attribute value
|
12 |
+
2) custom fields for post
|
13 |
+
3) inherit from post: permalink, first image, post title
|
14 |
+
*/
|
15 |
+
|
16 |
+
$url = $attr['url'];
|
17 |
+
|
18 |
+
if ( empty( $url ) ) {
|
19 |
+
$url = get_post_meta( $post->ID, 'pib_url_of_webpage', true);
|
20 |
+
if ( empty( $url ) ) {
|
21 |
+
$url = get_permalink( $post->ID );
|
22 |
+
}
|
23 |
+
}
|
24 |
+
$attr['url'] = $url;
|
25 |
+
|
26 |
+
$image_url = $attr['image_url'];
|
27 |
+
|
28 |
+
if ( empty( $image_url ) ) {
|
29 |
+
$image_url = get_post_meta( $post->ID, 'pib_url_of_img', true);
|
30 |
+
if ( empty( $image_url ) ) {
|
31 |
+
//Get url of img and compare width and height
|
32 |
+
$output = preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches );
|
33 |
+
$first_img = $matches [1] [0];
|
34 |
+
$image_url = $first_img;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
$attr['image_url'] = $image_url;
|
38 |
+
|
39 |
+
$description = $attr['description'];
|
40 |
+
|
41 |
+
if ( empty( $description ) ) {
|
42 |
+
$description = get_post_meta( $post->ID, 'pib_description', true);
|
43 |
+
if ( empty( $description ) ) {
|
44 |
+
$description = get_the_title( $post->ID );
|
45 |
+
}
|
46 |
+
}
|
47 |
+
$attr['description'] = $description;
|
48 |
+
|
49 |
+
$attr['count'] = ( empty( $attr['count'] ) ? 'none' : $attr['count'] );
|
50 |
+
$remove_div_bool = ( $attr['remove_div'] == 'true' );
|
51 |
+
$always_show_count_bool = ( $attr['always_show_count'] == 'true' );
|
52 |
+
|
53 |
+
$baseBtn = pib_button_base( $attr['url'], $attr['image_url'], $attr['description'], $attr['count'], $always_show_count_bool );
|
54 |
+
|
55 |
+
if ( $remove_div_bool ) {
|
56 |
+
return $baseBtn;
|
57 |
+
}
|
58 |
+
else {
|
59 |
+
//Surround with div tag
|
60 |
+
$float_class = '';
|
61 |
+
|
62 |
+
if ( $attr['float'] == 'left' ) {
|
63 |
+
$float_class = 'pib-float-left';
|
64 |
+
}
|
65 |
+
elseif ( $attr['float'] == 'right' ) {
|
66 |
+
$float_class = 'pib-float-right';
|
67 |
+
}
|
68 |
+
|
69 |
+
return '<div class="pin-it-btn-wrapper-shortcode ' . $float_class . '">' . $baseBtn . '</div>';
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
add_shortcode( 'pinit', 'pib_button_shortcode_html' );
|
inc/widget.php
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
//Add Pinterest Pin It Button widget
|
3 |
+
|
4 |
+
class Pib_Widget extends WP_Widget {
|
5 |
+
|
6 |
+
function __construct() {
|
7 |
+
$widget_ops = array('classname' => 'pib-clearfix', 'description' => __( 'Add a Pinterest "Pin It" button to your sidebar with this widget.') );
|
8 |
+
$control_ops = array('width' => 400); //doesn't use height
|
9 |
+
parent::__construct('pib_button', __('Pinterest "Pin It" Button'), $widget_ops, $control_ops);
|
10 |
+
}
|
11 |
+
|
12 |
+
function widget( $args, $instance ) {
|
13 |
+
extract($args);
|
14 |
+
|
15 |
+
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
|
16 |
+
$pib_url_of_webpage_widget = $instance['pib_url_of_webpage_widget'];
|
17 |
+
$pib_url_of_img_widget = $instance['pib_url_of_img_widget'];
|
18 |
+
$pib_description_widget = $instance['pib_description_widget'];
|
19 |
+
$count_layout = empty( $instance['count_layout'] ) ? 'none' : $instance['count_layout'];
|
20 |
+
$float = empty( $instance['float'] ) ? 'none' : $instance['float'];
|
21 |
+
$pib_remove_div = (bool)$instance['remove_div'];
|
22 |
+
$pib_always_show_count = (bool)$instance['always_show_count'];
|
23 |
+
|
24 |
+
$baseBtn = pib_button_base( $pib_url_of_webpage_widget, $pib_url_of_img_widget, $pib_description_widget, $count_layout, $pib_always_show_count );
|
25 |
+
|
26 |
+
echo $before_widget;
|
27 |
+
|
28 |
+
if ( $title ) {
|
29 |
+
echo $before_title . $title . $after_title;
|
30 |
+
}
|
31 |
+
|
32 |
+
if ( $pib_remove_div ) {
|
33 |
+
echo $baseBtn;
|
34 |
+
}
|
35 |
+
else {
|
36 |
+
//Surround with div tag
|
37 |
+
$float_class = '';
|
38 |
+
|
39 |
+
if ( $float == 'left' ) {
|
40 |
+
$float_class = 'pib-float-left';
|
41 |
+
}
|
42 |
+
elseif ( $float == 'right' ) {
|
43 |
+
$float_class = 'pib-float-right';
|
44 |
+
}
|
45 |
+
|
46 |
+
echo '<div class="pin-it-btn-wrapper-widget ' . $float_class . '">' . $baseBtn . '</div>';
|
47 |
+
}
|
48 |
+
|
49 |
+
echo $after_widget;
|
50 |
+
}
|
51 |
+
|
52 |
+
function update( $new_instance, $old_instance ) {
|
53 |
+
$instance = $old_instance;
|
54 |
+
$new_instance = wp_parse_args( (array) $new_instance, array( 'count_layout' => 'none', 'title' => '',
|
55 |
+
'pib_count_button_radio' => 'user_selects_image', 'float' => 'none') );
|
56 |
+
$instance['title'] = strip_tags($new_instance['title']);
|
57 |
+
$instance['pib_url_of_webpage_widget'] = strip_tags($new_instance['pib_url_of_webpage_widget']);
|
58 |
+
$instance['pib_url_of_img_widget'] = strip_tags($new_instance['pib_url_of_img_widget']);
|
59 |
+
$instance['pib_description_widget'] = strip_tags($new_instance['pib_description_widget']);
|
60 |
+
$instance['count_layout'] = $new_instance['count_layout'];
|
61 |
+
$instance['float'] = $new_instance['float'];
|
62 |
+
$instance['remove_div'] = ( $new_instance['remove_div'] ? 1 : 0 );
|
63 |
+
$instance['always_show_count'] = ( $new_instance['always_show_count'] ? 1 : 0 );
|
64 |
+
|
65 |
+
return $instance;
|
66 |
+
}
|
67 |
+
|
68 |
+
function form( $instance ) {
|
69 |
+
global $pib_options;
|
70 |
+
|
71 |
+
$instance = wp_parse_args( (array) $instance, array( 'count_layout' => 'none', 'title' => '',
|
72 |
+
'pib_count_button_radio' => 'user_selects_image', 'float' => 'none') );
|
73 |
+
$title = strip_tags($instance['title']);
|
74 |
+
$pib_url_of_webpage_widget = strip_tags($instance['pib_url_of_webpage_widget']);
|
75 |
+
$pib_url_of_img_widget = strip_tags($instance['pib_url_of_img_widget']);
|
76 |
+
$pib_description_widget = strip_tags($instance['pib_description_widget']);
|
77 |
+
$pib_button_style_widget = ( $pib_options['button_style'] == 'user_selects_image' ) ? 'User selects image' : 'Image pre-selected';
|
78 |
+
?>
|
79 |
+
|
80 |
+
<p>
|
81 |
+
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title (optional):'); ?></label>
|
82 |
+
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
|
83 |
+
</p>
|
84 |
+
<p>
|
85 |
+
<label for="<?php echo $this->get_field_id('count_layout'); ?>"><?php _e('Pin Count:'); ?></label>
|
86 |
+
<select name="<?php echo $this->get_field_name('count_layout'); ?>" id="<?php echo $this->get_field_id('count_layout'); ?>">
|
87 |
+
<option value="none" <?php selected( $instance['count_layout'], 'none' ); ?>><?php _e('No Count'); ?></option>
|
88 |
+
<option value="horizontal" <?php selected( $instance['count_layout'], 'horizontal' ); ?>><?php _e('Horizontal'); ?></option>
|
89 |
+
<option value="vertical" <?php selected( $instance['count_layout'], 'vertical' ); ?>><?php _e('Vertical'); ?></option>
|
90 |
+
</select>
|
91 |
+
</p>
|
92 |
+
<p>
|
93 |
+
<input class="checkbox" <?php checked($instance['always_show_count'], true) ?> id="<?php echo $this->get_field_id('always_show_count'); ?>" name="<?php echo $this->get_field_name('always_show_count'); ?>" type="checkbox"/>
|
94 |
+
<label for="<?php echo $this->get_field_id('always_show_count'); ?>">Always show pin count (even when zero)</label>
|
95 |
+
</p>
|
96 |
+
<div class="pib-widget-text-fields">
|
97 |
+
<p>
|
98 |
+
<em>Button style is inherited from setting saved in <a href="<?php echo admin_url( 'admin.php?page=' . PIB_PLUGIN_BASENAME ); ?>">"Pin It" Button Settings</a>.
|
99 |
+
Current style: <strong><?php echo $pib_button_style_widget; ?></strong></em>
|
100 |
+
</p>
|
101 |
+
<p>
|
102 |
+
<em>These 3 text fields will be used only if the button style is <strong>"Image pre-selected"</strong></em>
|
103 |
+
</p>
|
104 |
+
<p>
|
105 |
+
<label for="<?php echo $this->get_field_id('pib_url_of_webpage_widget'); ?>"><?php _e('URL of the web page to be pinned (<strong>required</strong>):'); ?></label>
|
106 |
+
<input class="widefat" id="<?php echo $this->get_field_id('pib_url_of_webpage_widget'); ?>" name="<?php echo $this->get_field_name('pib_url_of_webpage_widget'); ?>" type="text" value="<?php echo esc_attr($pib_url_of_webpage_widget); ?>" />
|
107 |
+
</p>
|
108 |
+
<p>
|
109 |
+
<label for="<?php echo $this->get_field_id('pib_url_of_img_widget'); ?>"><?php _e('URL of the image to be pinned (<strong>required</strong>):'); ?></label>
|
110 |
+
<input class="widefat" id="<?php echo $this->get_field_id('pib_url_of_img_widget'); ?>" name="<?php echo $this->get_field_name('pib_url_of_img_widget'); ?>" type="text" value="<?php echo esc_attr($pib_url_of_img_widget); ?>" />
|
111 |
+
</p>
|
112 |
+
<p>
|
113 |
+
<label for="<?php echo $this->get_field_id('pib_description_widget'); ?>"><?php _e('Description of the pin (optional):'); ?></label>
|
114 |
+
<input class="widefat" id="<?php echo $this->get_field_id('pib_description_widget'); ?>" name="<?php echo $this->get_field_name('pib_description_widget'); ?>" type="text" value="<?php echo esc_attr($pib_description_widget); ?>" />
|
115 |
+
</p>
|
116 |
+
</div>
|
117 |
+
|
118 |
+
<p>
|
119 |
+
<label for="<?php echo $this->get_field_id('float'); ?>"><?php _e('Align (float):'); ?></label>
|
120 |
+
<select name="<?php echo $this->get_field_name('float'); ?>" id="<?php echo $this->get_field_id('float'); ?>">
|
121 |
+
<option value="none" <?php selected( $instance['float'], 'none' ); ?>><?php _e('none (default)'); ?></option>
|
122 |
+
<option value="left" <?php selected( $instance['float'], 'left' ); ?>><?php _e('left'); ?></option>
|
123 |
+
<option value="right" <?php selected( $instance['float'], 'right' ); ?>><?php _e('right'); ?></option>
|
124 |
+
</select>
|
125 |
+
</p>
|
126 |
+
<p>
|
127 |
+
<input class="checkbox" <?php checked($instance['remove_div'], true) ?> id="<?php echo $this->get_field_id('remove_div'); ?>" name="<?php echo $this->get_field_name('remove_div'); ?>" type="checkbox"/>
|
128 |
+
<label for="<?php echo $this->get_field_id('remove_div'); ?>">Remove div tag surrounding this widget button (also removes <strong>float</strong> setting)</label>
|
129 |
+
</p>
|
130 |
+
<?php
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
|
135 |
+
// Function that register Pin It Button widget.
|
136 |
+
|
137 |
+
function pib_load_widgets() {
|
138 |
+
register_widget( 'Pib_Widget' );
|
139 |
+
}
|
140 |
+
|
141 |
+
//Add function to the widgets_init hook.
|
142 |
+
add_action( 'widgets_init', 'pib_load_widgets' );
|
js/pin-it-button-user-selects-image-assets.js
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
//Modified version of http://assets.pinterest.com/js/pinit.js
|
2 |
+
//Pinterest last updated 4/6/2012
|
3 |
+
//Points to local iFrame
|
4 |
+
|
5 |
+
(function (o, q, c) {
|
6 |
+
var s = function (h) {
|
7 |
+
var e = c.pinit,
|
8 |
+
m = "?",
|
9 |
+
a, i, f, b;
|
10 |
+
f = [];
|
11 |
+
b = [];
|
12 |
+
var j = {},
|
13 |
+
g = o.createElement("IFRAME"),
|
14 |
+
r = h.getAttribute(c.att.count) || false,
|
15 |
+
n = h.getAttribute(c.att.layout) || "horizontal";
|
16 |
+
if (q.location.protocol === "https:") e = c.pinit_secure;
|
17 |
+
f = h.href.split("?")[1].split("#")[0].split("&");
|
18 |
+
a = 0;
|
19 |
+
for (i = f.length; a < i; a += 1) {
|
20 |
+
b = f[a].split("=");
|
21 |
+
j[b[0]] = b[1]
|
22 |
+
}
|
23 |
+
a = f = 0;
|
24 |
+
for (i = c.vars.req.length; a < i; a += 1) {
|
25 |
+
b = c.vars.req[a];
|
26 |
+
if (j[b]) {
|
27 |
+
e = e + m + b + "=" + j[b];
|
28 |
+
m = "&"
|
29 |
+
}
|
30 |
+
f += 1
|
31 |
+
}
|
32 |
+
if (j.media && j.media.indexOf("http") !== 0) f = 0;
|
33 |
+
if (f === i) {
|
34 |
+
a = 0;
|
35 |
+
for (i = c.vars.opt.length; a < i; a += 1) {
|
36 |
+
b = c.vars.opt[a];
|
37 |
+
if (j[b]) e = e + m + b + "=" + j[b]
|
38 |
+
}
|
39 |
+
e = e + "&layout=" + n;
|
40 |
+
if (r !== false) e += "&count=1";
|
41 |
+
g.setAttribute("src", e);
|
42 |
+
g.setAttribute("scrolling", "no");
|
43 |
+
g.allowTransparency = true;
|
44 |
+
g.frameBorder = 0;
|
45 |
+
g.style.border = "none";
|
46 |
+
g.style.width = c.layout[n].width + "px";
|
47 |
+
g.style.height = c.layout[n].height + "px";
|
48 |
+
h.parentNode.replaceChild(g, h)
|
49 |
+
} else h.parentNode.removeChild(h)
|
50 |
+
},
|
51 |
+
p = o.getElementsByTagName("A"),
|
52 |
+
l, d, k = [];
|
53 |
+
d = 0;
|
54 |
+
for (l = p.length; d < l; d += 1) k.push(p[d]);
|
55 |
+
d = 0;
|
56 |
+
for (l = k.length; d < l; d += 1) k[d].href && k[d].href.indexOf(c.button) !== -1 && s(k[d])
|
57 |
+
})
|
58 |
+
|
59 |
+
(document, window, {
|
60 |
+
att: {
|
61 |
+
layout: "count-layout",
|
62 |
+
count: "always-show-count"
|
63 |
+
},
|
64 |
+
|
65 |
+
//pinit:"http://pinit-cdn.pinterest.com/pinit.html",
|
66 |
+
//pinit_secure:"https://assets.pinterest.com/pinit.html",
|
67 |
+
|
68 |
+
//Point to local iFrame
|
69 |
+
pinit: iFrameBtnUrl,
|
70 |
+
pinit_secure: iFrameBtnUrl,
|
71 |
+
|
72 |
+
button: "//pinterest.com/pin/create/button/?",
|
73 |
+
vars: {
|
74 |
+
req: ["url", "media"],
|
75 |
+
opt: ["title", "description"]
|
76 |
+
},
|
77 |
+
layout: {
|
78 |
+
none: {
|
79 |
+
width: 43,
|
80 |
+
height: 20
|
81 |
+
},
|
82 |
+
vertical: {
|
83 |
+
width: 43,
|
84 |
+
height: 58
|
85 |
+
},
|
86 |
+
horizontal: {
|
87 |
+
width: 90,
|
88 |
+
height: 20
|
89 |
+
}
|
90 |
+
}
|
91 |
+
});
|
js/pin-it-button-user-selects-image.js
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
//Added function for firing off pinmarklet.js for "user selects image" button type
|
2 |
+
|
3 |
+
function execPinmarklet() {
|
4 |
+
var e=document.createElement('script');
|
5 |
+
e.setAttribute('type','text/javascript');
|
6 |
+
e.setAttribute('charset','UTF-8');
|
7 |
+
e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r=' + Math.random()*99999999);
|
8 |
+
document.body.appendChild(e);
|
9 |
+
}
|
js/pinterest-pin-it-button-admin.js
CHANGED
@@ -2,24 +2,18 @@
|
|
2 |
//jQuery doc ready
|
3 |
//See http://digwp.com/2011/09/using-instead-of-jquery-in-wordpress/
|
4 |
jQuery(document).ready(function($) {
|
5 |
-
|
6 |
-
$("#mc-embedded-subscribe-link").click(function(event) {
|
7 |
-
event.preventDefault();
|
8 |
-
$("#mc-embedded-subscribe-form").submit();
|
9 |
-
});
|
10 |
-
|
11 |
//Enable collapse/expand toggle of admin boxes (like WP dashboard)
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
});
|
25 |
});
|
2 |
//jQuery doc ready
|
3 |
//See http://digwp.com/2011/09/using-instead-of-jquery-in-wordpress/
|
4 |
jQuery(document).ready(function($) {
|
5 |
+
|
|
|
|
|
|
|
|
|
|
|
6 |
//Enable collapse/expand toggle of admin boxes (like WP dashboard)
|
7 |
+
$(".pib-hndle").toggle(function() {
|
8 |
+
$(this).next(".inside").slideToggle("fast");
|
9 |
+
}, function () {
|
10 |
+
$(this).next(".inside").slideToggle("fast");
|
11 |
+
});
|
12 |
+
|
13 |
+
$(".pib-handlediv").toggle(function() {
|
14 |
+
$(this).next(".pib-hndle").next(".inside").slideToggle("fast");
|
15 |
+
}, function() {
|
16 |
+
$(this).next(".pib-hndle").next(".inside").slideToggle("fast");
|
17 |
+
});
|
18 |
+
|
|
|
19 |
});
|
pinterest-pin-it-button.php
CHANGED
@@ -1,95 +1,87 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Pinterest "Pin It" Button
|
4 |
-
Plugin URI: http://pinterestplugin.com
|
5 |
-
Description: Add a Pinterest "Pin It"
|
6 |
-
Version: 1.2.1
|
7 |
Author: Phil Derksen
|
8 |
-
Author URI: http://pinterestplugin.com
|
|
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
-
|
|
|
|
|
12 |
|
13 |
-
|
14 |
-
it under the terms of the GNU General Public License, version 2, as
|
15 |
-
published by the Free Software Foundation.
|
16 |
|
17 |
-
|
18 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20 |
-
GNU General Public License for more details.
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
*/
|
26 |
|
27 |
-
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
if ( ! defined( 'PIB_PLUGIN_BASENAME' ) )
|
30 |
-
define( 'PIB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
31 |
-
|
32 |
-
define( 'BASE_BTN_HTML', '<a href="javascript:void(0)" class="pin-it-btn" title="Pin It on Pinterest"></a>' );
|
33 |
-
|
34 |
//Plugin install/activation
|
35 |
|
36 |
function pib_install() {
|
37 |
-
|
|
|
38 |
//Deactivate plugin if WP version too low
|
39 |
if ( version_compare( get_bloginfo( 'version' ), '3.0', '<' ) ) {
|
40 |
deactivate_plugins( basename( __FILE__ ) );
|
41 |
}
|
42 |
-
|
43 |
-
//Setup default
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
'display_below_content' => 1,
|
53 |
-
'display_on_post_excerpts' => 0,
|
54 |
-
'remove_div' => 0,
|
55 |
-
'custom_css' => ''
|
56 |
-
);
|
57 |
-
|
58 |
//Save default option values
|
59 |
update_option( 'pib_options', $pib_options );
|
60 |
-
|
61 |
}
|
62 |
|
63 |
register_activation_hook( __FILE__, 'pib_install' );
|
64 |
|
65 |
-
//
|
66 |
-
//Using saved option instead of session which was causing errors for some
|
67 |
-
//TODO Removed until further testing
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
if ( !$pib_options['admin_activate_notice'] ) {
|
74 |
-
echo '<div class="updated"><p>' .
|
75 |
-
'<strong>Your "Pin It" Button is activated!</strong> ' .
|
76 |
-
sprintf( __( '<a href="%1$s" class="activate-notice-link">Customize Your Settings</a>' ),
|
77 |
-
'admin.php?page=' . PIB_PLUGIN_BASENAME ) .
|
78 |
-
'</p></div>';
|
79 |
-
|
80 |
-
$pib_options['admin_activate_notice'] = 1;
|
81 |
-
update_option( 'pib_options', $pib_options );
|
82 |
-
}
|
83 |
}
|
84 |
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
//Add settings page to admin menu
|
|
|
89 |
|
90 |
function pib_create_menu() {
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
|
95 |
add_action( 'admin_menu', 'pib_create_menu' );
|
@@ -103,248 +95,63 @@ function pib_add_admin_css_js() {
|
|
103 |
wp_enqueue_script( 'pinterest-pin-it-button', plugins_url( '/js/pinterest-pin-it-button-admin.js', __FILE__ ), array( 'jquery' ) );
|
104 |
}
|
105 |
|
106 |
-
|
107 |
-
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
113 |
}
|
114 |
|
115 |
-
add_action( '
|
116 |
|
117 |
-
//
|
118 |
|
119 |
-
function
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
<table class="form-table inside">
|
145 |
-
<tr valign="top">
|
146 |
-
<td>
|
147 |
-
<input id="display_home_page" name="pib_options[display_home_page]" type="checkbox"
|
148 |
-
<?php if ( $pib_options['display_home_page'] ) echo 'checked="checked"'; ?> />
|
149 |
-
<label for="display_home_page">Blog Home Page (or Latest Posts Page)</label>
|
150 |
-
</td>
|
151 |
-
</tr>
|
152 |
-
<tr valign="top">
|
153 |
-
<td>
|
154 |
-
<input id="display_front_page" name="pib_options[display_front_page]" type="checkbox"
|
155 |
-
<?php if ( $pib_options['display_front_page'] ) echo 'checked="checked"'; ?> />
|
156 |
-
<label for="display_front_page">Front Page (different from Home Page only if set in Settings > Reading)</label>
|
157 |
-
</td>
|
158 |
-
</tr>
|
159 |
-
<tr valign="top">
|
160 |
-
<td>
|
161 |
-
<input id="display_posts" name="pib_options[display_posts]" type="checkbox"
|
162 |
-
<?php if ( $pib_options['display_posts'] ) echo 'checked="checked"'; ?> />
|
163 |
-
<label for="display_posts">Individual Posts</label>
|
164 |
-
</td>
|
165 |
-
</tr>
|
166 |
-
<tr valign="top">
|
167 |
-
<td>
|
168 |
-
<input id="display_pages" name="pib_options[display_pages]" type="checkbox"
|
169 |
-
<?php if ( $pib_options['display_pages'] ) echo 'checked="checked"'; ?> />
|
170 |
-
<label for="display_pages">WordPress Static "Pages"</label>
|
171 |
-
</td>
|
172 |
-
</tr>
|
173 |
-
<tr valign="top">
|
174 |
-
<td>
|
175 |
-
<input id="display_archives" name="pib_options[display_archives]" type="checkbox"
|
176 |
-
<?php if ( $pib_options['display_archives'] ) echo 'checked="checked"'; ?> />
|
177 |
-
<label for="display_archives">Archives (includes Category, Tag, Author and time-based pages)</label>
|
178 |
-
</td>
|
179 |
-
</tr>
|
180 |
-
<tr valign="top">
|
181 |
-
<td>
|
182 |
-
When editing a post, page or category, scroll down to find the option to hide the "Pin It" button for it.
|
183 |
-
</td>
|
184 |
-
</tr>
|
185 |
-
<tr valign="top">
|
186 |
-
<td>
|
187 |
-
Go to <a href="<?php echo admin_url( 'widgets.php' ); ?>">Widgets</a> to add a "Pin It" button to the sidebar.
|
188 |
-
</td>
|
189 |
-
</tr>
|
190 |
-
</table>
|
191 |
-
</div>
|
192 |
-
|
193 |
-
<div id="button-show" class="postbox pib-postbox">
|
194 |
-
<div class="handlediv" title="Click to toggle"><br /></div>
|
195 |
-
<h3 class="hndle">Where on each page should the button appear?</h3>
|
196 |
-
|
197 |
-
<table class="form-table inside">
|
198 |
-
<tr valign="top">
|
199 |
-
<td>
|
200 |
-
<input id="display_above_content" name="pib_options[display_above_content]" type="checkbox" <?php if ( $pib_options['display_above_content'] ) echo 'checked="checked"'; ?> />
|
201 |
-
<label for="display_above_content">Above Content</label>
|
202 |
-
</td>
|
203 |
-
</tr>
|
204 |
-
<tr valign="top">
|
205 |
-
<td>
|
206 |
-
<input id="display_below_content" name="pib_options[display_below_content]" type="checkbox" <?php if ( $pib_options['display_below_content'] ) echo 'checked="checked"'; ?> />
|
207 |
-
<label for="display_below_content">Below Content</label>
|
208 |
-
</td>
|
209 |
-
</tr>
|
210 |
-
<tr valign="top">
|
211 |
-
<td>
|
212 |
-
<input id="display_on_post_excerpts" name="pib_options[display_on_post_excerpts]" type="checkbox" <?php if ( $pib_options['display_on_post_excerpts'] ) echo 'checked="checked"'; ?> />
|
213 |
-
<label for="display_on_post_excerpts">On Post Excerpts</label>
|
214 |
-
</td>
|
215 |
-
</tr>
|
216 |
-
<tr valign="top">
|
217 |
-
<td>
|
218 |
-
Use the shortcode <code>[pinit]</code> to display the button within content.<br/>
|
219 |
-
Use the function <code><?php echo htmlentities('<?php echo do_shortcode(\'[pinit]\'); ?>'); ?></code>
|
220 |
-
to display within template or theme files.
|
221 |
-
</td>
|
222 |
-
</tr>
|
223 |
-
</table>
|
224 |
-
</div>
|
225 |
-
|
226 |
-
<div id="style-options" class="postbox pib-postbox">
|
227 |
-
<div class="handlediv" title="Click to toggle"><br /></div>
|
228 |
-
<h3 class="hndle">Additional layout and styling options</h3>
|
229 |
-
|
230 |
-
<table class="form-table inside">
|
231 |
-
<tr valign="top">
|
232 |
-
<td>
|
233 |
-
<label for="custom_css">Custom CSS</label>
|
234 |
-
</td>
|
235 |
-
</tr>
|
236 |
-
<tr valign="top">
|
237 |
-
<td>
|
238 |
-
<textarea name="pib_options[custom_css]" rows="6" cols="8"><?php echo $custom_css; ?></textarea>
|
239 |
-
</td>
|
240 |
-
</tr>
|
241 |
-
<tr valign="top">
|
242 |
-
<td>
|
243 |
-
<input id="remove_div" name="pib_options[remove_div]" type="checkbox" <?php if ( $pib_options['remove_div'] ) echo 'checked="checked"'; ?> />
|
244 |
-
<label for="remove_div">Remove surrounding <code><?php echo htmlentities('<div class="pin-it-btn-wrapper"></div>'); ?></code> tag</label>
|
245 |
-
</td>
|
246 |
-
</tr>
|
247 |
-
<tr valign="top">
|
248 |
-
<td>
|
249 |
-
<a href="http://pinterestplugin.com/pin-it-button-custom-css/" target="_blank">See custom CSS examples</a> aligning the button
|
250 |
-
with other social sharing plugins.
|
251 |
-
</td>
|
252 |
-
</tr>
|
253 |
-
</table>
|
254 |
-
</div>
|
255 |
-
|
256 |
-
<table class="form-table inside">
|
257 |
-
<tr valign="top">
|
258 |
-
<td>
|
259 |
-
<input name="Submit" type="submit" value="Save Changes" class="button-primary" />
|
260 |
-
</td>
|
261 |
-
</tr>
|
262 |
-
</table>
|
263 |
-
</form>
|
264 |
-
</div>
|
265 |
-
</div>
|
266 |
-
<div class="pib-right-column postbox-container">
|
267 |
-
<div class="meta-box-sortables ui-sortable">
|
268 |
-
<div id="email-signup">
|
269 |
-
<h4>Like This Plugin?</h4>
|
270 |
-
|
271 |
-
<p class="large-text">
|
272 |
-
Join the mailing list to be notified when new features are released.
|
273 |
-
</p>
|
274 |
-
|
275 |
-
<!-- Begin MailChimp Signup Form -->
|
276 |
-
<div id="mc_embed_signup">
|
277 |
-
<form action="http://pinterestplugin.us1.list-manage.com/subscribe/post?u=bfa8cc8ba2614b0796d33a238&id=80e1043ae4" method="post"
|
278 |
-
id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank">
|
279 |
-
|
280 |
-
<input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
|
281 |
-
|
282 |
-
<div class="clear">
|
283 |
-
<input type="submit" value="Sign Up!" name="subscribe" id="mc-embedded-subscribe" class="awesome large red">
|
284 |
-
</div>
|
285 |
-
</form>
|
286 |
-
</div>
|
287 |
-
<!--End mc_embed_signup-->
|
288 |
-
|
289 |
-
<p>
|
290 |
-
No spam. Unsubscribe anytime.
|
291 |
-
</p>
|
292 |
-
</div>
|
293 |
-
|
294 |
-
<div id="promo-buttons" class="postbox pib-postbox">
|
295 |
-
<div class="handlediv" title="Click to toggle"><br /></div>
|
296 |
-
<h3 class="hndle">Spread the Word!</h3>
|
297 |
-
|
298 |
-
<div class="inside">
|
299 |
-
<p>The more people using this plugin the more we can add to it for you. Just take a sec and share it!</p>
|
300 |
-
|
301 |
-
<table>
|
302 |
-
<tr>
|
303 |
-
<td><?php echo pib_share_facebook(); ?></td>
|
304 |
-
</tr>
|
305 |
-
<tr>
|
306 |
-
<td><?php echo pib_share_twitter(); ?></td>
|
307 |
-
</tr>
|
308 |
-
<tr>
|
309 |
-
<td><?php echo pib_share_google_plus(); ?></td>
|
310 |
-
</tr>
|
311 |
-
<tr>
|
312 |
-
<td><?php echo pib_share_pinterest(); ?></td>
|
313 |
-
</tr>
|
314 |
-
</table>
|
315 |
-
</div>
|
316 |
-
</div>
|
317 |
-
|
318 |
-
<div id="other-links" class="postbox pib-postbox">
|
319 |
-
<div class="handlediv" title="Click to toggle"><br /></div>
|
320 |
-
<h3 class="hndle">Other Links</h3>
|
321 |
-
|
322 |
-
<div class="inside">
|
323 |
-
<ul>
|
324 |
-
<li><a href="http://pinterestplugin.com/" target="_blank">Official Site - PinterestPlugin.com</a></li>
|
325 |
-
<li><a href="https://pinterestplugin.uservoice.com/" target="_blank">User Support & Feature Requests</a></li>
|
326 |
-
</ul>
|
327 |
-
</div>
|
328 |
-
</div>
|
329 |
-
|
330 |
-
<div id="news-links" class="postbox pib-postbox">
|
331 |
-
<div class="handlediv" title="Click to toggle"><br /></div>
|
332 |
-
<h3 class="hndle">News from PinterestPlugin.com</h3>
|
333 |
-
|
334 |
-
<div class="inside">
|
335 |
-
<? echo pib_rss_news(); ?>
|
336 |
-
</div>
|
337 |
-
</div>
|
338 |
-
</div>
|
339 |
-
</div>
|
340 |
-
|
341 |
-
</div>
|
342 |
-
</div>
|
343 |
-
<?php
|
344 |
}
|
345 |
|
346 |
//Render rss items from pinterestplugin.com
|
347 |
//http://codex.wordpress.org/Function_Reference/fetch_feed
|
|
|
348 |
function pib_rss_news() {
|
349 |
// Get RSS Feed(s)
|
350 |
include_once(ABSPATH . WPINC . '/feed.php');
|
@@ -352,27 +159,30 @@ function pib_rss_news() {
|
|
352 |
// Get a SimplePie feed object from the specified feed source.
|
353 |
$rss = fetch_feed('http://pinterestplugin.com/feed/');
|
354 |
|
355 |
-
if (!is_wp_error( $rss ) )
|
|
|
356 |
// Figure out how many total items there are, but limit it to 5.
|
357 |
-
$maxitems = $rss->get_item_quantity(
|
358 |
|
359 |
// Build an array of all the items, starting with element 0 (first element).
|
360 |
$rss_items = $rss->get_items(0, $maxitems);
|
361 |
-
|
|
|
362 |
?>
|
363 |
|
364 |
<ul>
|
365 |
-
<?php if ($maxitems == 0)
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
|
|
376 |
</ul>
|
377 |
|
378 |
<?php
|
@@ -380,163 +190,81 @@ function pib_rss_news() {
|
|
380 |
|
381 |
//Render Facebook Share button
|
382 |
//http://developers.facebook.com/docs/share/
|
|
|
383 |
function pib_share_facebook() {
|
384 |
-
?>
|
385 |
-
|
386 |
<a name="fb_share" type="button" share_url="http://pinterestplugin.com/" alt="Share on Facebook"></a>
|
387 |
-
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
|
388 |
-
|
389 |
<?php
|
390 |
}
|
391 |
|
392 |
//Render Twitter button
|
393 |
//https://twitter.com/about/resources/buttons
|
394 |
-
function pib_share_twitter() {
|
395 |
-
?>
|
396 |
-
|
397 |
-
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://pinterestplugin.com/" data-text="Check out the Pinterest "Pin It" Button Plugin for WordPress" alt="Tweet this!">Tweet</a>
|
398 |
-
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
399 |
-
|
400 |
-
<?php
|
401 |
-
}
|
402 |
|
403 |
-
|
404 |
-
//http://www.google.com/intl/en/webmasters/+1/button/index.html
|
405 |
-
function pib_share_google_plus() {
|
406 |
?>
|
407 |
-
|
408 |
-
|
409 |
-
<div class="g-plusone" data-size="small" data-annotation="inline" data-href="http://pinterestplugin.com/"></div>
|
410 |
-
|
411 |
-
<!-- Place this render call where appropriate -->
|
412 |
-
<script type="text/javascript">
|
413 |
-
(function() {
|
414 |
-
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
|
415 |
-
po.src = 'https://apis.google.com/js/plusone.js';
|
416 |
-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
|
417 |
-
})();
|
418 |
-
</script>
|
419 |
-
|
420 |
<?php
|
421 |
}
|
422 |
|
423 |
//Render Pin It button
|
|
|
|
|
424 |
function pib_share_pinterest() {
|
425 |
?>
|
426 |
-
<
|
427 |
-
|
428 |
<?php
|
429 |
}
|
430 |
|
431 |
-
//
|
432 |
-
//http://developers.facebook.com/docs/reference/plugins/like/
|
433 |
-
//TODO Not using since correct image isn't coming up for now
|
434 |
-
function pib_like_facebook() {
|
435 |
-
?>
|
436 |
-
|
437 |
-
<div id="fb-root"></div>
|
438 |
-
<script>(function(d, s, id) {
|
439 |
-
var js, fjs = d.getElementsByTagName(s)[0];
|
440 |
-
if (d.getElementById(id)) return;
|
441 |
-
js = d.createElement(s); js.id = id;
|
442 |
-
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=144056775628952";
|
443 |
-
fjs.parentNode.insertBefore(js, fjs);
|
444 |
-
}(document, 'script', 'facebook-jssdk'));</script>
|
445 |
-
|
446 |
-
<div class="fb-like" data-href="http://pinterestplugin.com/" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false"></div>
|
447 |
-
|
448 |
-
<?php
|
449 |
-
}
|
450 |
-
|
451 |
-
//Add a link to the settings page to the plugins list
|
452 |
-
|
453 |
-
function pib_plugin_action_links( $links, $file ) {
|
454 |
-
if ( $file != PIB_PLUGIN_BASENAME )
|
455 |
-
return $links;
|
456 |
|
|
|
457 |
$url = admin_url( 'admin.php?page=' . PIB_PLUGIN_BASENAME );
|
458 |
-
$settings_link = '<a href="' .
|
459 |
-
|
460 |
array_unshift( $links, $settings_link );
|
461 |
-
|
462 |
return $links;
|
463 |
}
|
|
|
|
|
464 |
|
465 |
-
|
466 |
-
|
467 |
-
//Adds a meta box to the main column on the Post and Page edit screens
|
468 |
|
469 |
-
function
|
470 |
-
|
471 |
-
add_meta_box( 'pib_sharing_meta','"Pin It" Button Display', 'pib_sharing_meta_box_content', 'post', 'advanced', 'high' );
|
472 |
}
|
473 |
|
474 |
-
add_action( '
|
475 |
-
|
476 |
-
//Renders the post/page meta box checkbox html
|
477 |
|
478 |
-
|
479 |
-
$pib_sharing_checked = get_post_meta( $post->ID, 'pib_sharing_disabled', 1 );
|
480 |
|
481 |
-
|
482 |
-
|
483 |
-
else
|
484 |
-
$pib_sharing_checked = '';
|
485 |
-
?>
|
486 |
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
}
|
501 |
-
|
502 |
-
//Saves display option for individual post/page
|
503 |
-
|
504 |
-
function pib_sharing_meta_box_save( $post_id ) {
|
505 |
-
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
|
506 |
-
return $post_id;
|
507 |
-
|
508 |
-
// Record sharing disable
|
509 |
-
if ( isset( $_POST['post_type'] ) && ( 'post' == $_POST['post_type'] || 'page' == $_POST['post_type'] ) ) {
|
510 |
-
if ( current_user_can( 'edit_post', $post_id ) ) {
|
511 |
-
if ( isset( $_POST['pib_sharing_status_hidden'] ) ) {
|
512 |
-
if ( !isset( $_POST['pib_enable_post_sharing'] ) )
|
513 |
-
update_post_meta( $post_id, 'pib_sharing_disabled', 1 );
|
514 |
-
else
|
515 |
-
delete_post_meta( $post_id, 'pib_sharing_disabled' );
|
516 |
-
}
|
517 |
-
}
|
518 |
}
|
519 |
-
|
520 |
-
return $post_id;
|
521 |
}
|
522 |
|
523 |
-
add_action( '
|
524 |
-
|
525 |
-
//Add Public CSS/JS
|
526 |
-
|
527 |
-
function pib_add_public_css_js() {
|
528 |
-
wp_enqueue_script( 'jquery' );
|
529 |
-
|
530 |
-
wp_enqueue_style( 'pinterest-pin-it-button', plugins_url( '/css/pinterest-pin-it-button.css' , __FILE__ ) );
|
531 |
-
wp_enqueue_script( 'pinterest-pin-it-button', plugins_url( '/js/pinterest-pin-it-button.js', __FILE__ ), array( 'jquery' ) );
|
532 |
-
}
|
533 |
-
|
534 |
-
add_action( 'wp_enqueue_scripts', 'pib_add_public_css_js' );
|
535 |
|
536 |
//Add Custom CSS
|
537 |
|
538 |
function pib_add_custom_css() {
|
539 |
-
|
|
|
540 |
$custom_css = trim( $pib_options['custom_css'] );
|
541 |
|
542 |
if ( $custom_css != '' ) {
|
@@ -546,66 +274,102 @@ function pib_add_custom_css() {
|
|
546 |
|
547 |
add_action( 'wp_head', 'pib_add_custom_css' );
|
548 |
|
549 |
-
//
|
550 |
|
551 |
-
function
|
552 |
-
|
553 |
-
$pib_options = get_option( 'pib_options' );
|
554 |
-
|
555 |
-
|
556 |
-
if (get_post_meta($postID,'pib_sharing_disabled', 1)) {
|
557 |
-
|
558 |
-
return "";
|
559 |
-
}
|
560 |
-
else {
|
561 |
-
|
562 |
-
//Check that remove surrounding div checkbox is selected
|
563 |
-
if ( $pib_options['remove_div'] ) {
|
564 |
-
return BASE_BTN_HTML;
|
565 |
-
} else {
|
566 |
-
//Surround with div tag
|
567 |
-
return '<div class="pin-it-btn-wrapper">' . BASE_BTN_HTML . '</div>';
|
568 |
-
}
|
569 |
-
}
|
570 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
571 |
}
|
572 |
|
573 |
-
//
|
574 |
|
575 |
-
function
|
576 |
-
|
577 |
-
|
578 |
|
579 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
|
581 |
//Render button on pages with regular content
|
582 |
|
583 |
function pib_render_btn( $content ) {
|
584 |
-
|
585 |
-
$pib_options = get_option( 'pib_options' );
|
586 |
global $post;
|
|
|
587 |
$postID = $post->ID;
|
588 |
-
|
589 |
-
//Determine if displayed on current page
|
590 |
if (
|
591 |
( is_home() && ( $pib_options['display_home_page'] ) ) ||
|
592 |
( is_front_page() && ( $pib_options['display_front_page'] ) ) ||
|
593 |
( is_single() && ( $pib_options['display_posts'] ) ) ||
|
594 |
-
( is_page() && ( $pib_options['display_pages'] ) )
|
|
|
|
|
|
|
|
|
|
|
|
|
595 |
) {
|
596 |
if ( $pib_options['display_above_content'] ) {
|
597 |
-
$content = pib_button_html($postID) . $content;
|
598 |
}
|
599 |
-
|
600 |
if ( $pib_options['display_below_content'] ) {
|
601 |
-
$content .= pib_button_html($postID);
|
602 |
}
|
603 |
-
}
|
604 |
-
|
605 |
|
606 |
//Determine if displayed on Category on the base of category edit Screen Option
|
607 |
-
if( is_archive() && ( $pib_options['display_archives'] ) ) {
|
608 |
-
|
609 |
$tag_extra_fields = get_option(PIB_CATEGORY_FIELDS);
|
610 |
$category_ids = get_all_category_ids();
|
611 |
foreach($category_ids as $term_id) {
|
@@ -630,12 +394,10 @@ function pib_render_btn( $content ) {
|
|
630 |
|
631 |
add_filter( 'the_content', 'pib_render_btn' );
|
632 |
|
633 |
-
|
634 |
//Render button on pages with excerpts if option checked
|
635 |
|
636 |
function pib_render_btn_excerpt( $content ) {
|
637 |
-
|
638 |
-
$pib_options = get_option( 'pib_options' );
|
639 |
global $post;
|
640 |
$postID = $post->ID;
|
641 |
|
@@ -648,12 +410,10 @@ function pib_render_btn_excerpt( $content ) {
|
|
648 |
if ( $pib_options['display_above_content'] ) {
|
649 |
$content = pib_button_html($postID) . $content;
|
650 |
}
|
651 |
-
|
652 |
if ( $pib_options['display_below_content'] ) {
|
653 |
$content .= pib_button_html($postID);
|
654 |
}
|
655 |
-
}
|
656 |
-
|
657 |
|
658 |
//Determine if displayed on Category on the base of category edit Screen Option
|
659 |
if( is_archive() && ( $pib_options['display_archives'] ) ) {
|
@@ -675,8 +435,6 @@ function pib_render_btn_excerpt( $content ) {
|
|
675 |
}
|
676 |
}
|
677 |
}
|
678 |
-
|
679 |
-
|
680 |
}
|
681 |
}
|
682 |
}
|
@@ -684,238 +442,3 @@ function pib_render_btn_excerpt( $content ) {
|
|
684 |
}
|
685 |
|
686 |
add_filter( 'the_excerpt', 'pib_render_btn_excerpt' );
|
687 |
-
|
688 |
-
//Option name
|
689 |
-
define('PIB_CATEGORY_FIELDS', 'pib_category_fields_option');
|
690 |
-
|
691 |
-
//Add Checkbox to Category Edit Screen
|
692 |
-
add_action('edit_category_form_fields', 'pib_category_fields');
|
693 |
-
|
694 |
-
function pib_category_fields($tag) {
|
695 |
-
$t_id = $tag->term_id;
|
696 |
-
$tag_extra_fields = get_option(PIB_CATEGORY_FIELDS);
|
697 |
-
|
698 |
-
if ( $tag_extra_fields[$t_id]['checkbox'] == true)
|
699 |
-
$pib_category_checked = '';
|
700 |
-
else
|
701 |
-
$pib_category_checked = 'checked="checked"';
|
702 |
-
|
703 |
-
?>
|
704 |
-
|
705 |
-
<table class="form-table">
|
706 |
-
<tr class="form-field">
|
707 |
-
<th scope="row" valign="top">
|
708 |
-
<h3>"Pin It" Button Settings</h3>
|
709 |
-
</th>
|
710 |
-
</tr>
|
711 |
-
<tbody>
|
712 |
-
<tr class="form-field">
|
713 |
-
<th scope="row" valign="top">
|
714 |
-
<label for="pib_category_field">Show "Pin It" Button</label>
|
715 |
-
</th>
|
716 |
-
<td>
|
717 |
-
<input name="pib_category_field" id="pib_category_field" type="checkbox" value="true" <?php echo $pib_category_checked; ?>>
|
718 |
-
<p class="description">
|
719 |
-
If checked displays the button for this category (if <strong>Archives</strong> also checked in
|
720 |
-
<a href='<?php echo 'admin.php?page=' . PIB_PLUGIN_BASENAME ?>'>"Pin It" Button Settings</a>).
|
721 |
-
If unchecked the button will <strong>always</strong> be hidden for this category.
|
722 |
-
</p>
|
723 |
-
</td>
|
724 |
-
</tr>
|
725 |
-
</tbody>
|
726 |
-
</table>
|
727 |
-
|
728 |
-
<?php
|
729 |
-
}
|
730 |
-
|
731 |
-
// when the form gets submitted, and the category gets updated (in your case the option will get updated with the values of your custom fields above
|
732 |
-
add_action('edited_category', 'update_pib_category_fields');
|
733 |
-
|
734 |
-
function update_pib_category_fields($term_id) {
|
735 |
-
if($_POST['taxonomy'] == 'category'):
|
736 |
-
$tag_extra_fields = get_option(PIB_CATEGORY_FIELDS);
|
737 |
-
$tag_extra_fields[$term_id]['checkbox'] = strip_tags($_POST['pib_category_field']);
|
738 |
-
if( $_POST['pib_category_field'] != true){
|
739 |
-
$tag_extra_fields[$term_id]['checkbox'] = true;
|
740 |
-
update_option(PIB_CATEGORY_FIELDS, $tag_extra_fields );
|
741 |
-
}
|
742 |
-
if( $_POST['pib_category_field'] == true){
|
743 |
-
$tag_extra_fields[$term_id]['checkbox'] = "";
|
744 |
-
update_option(PIB_CATEGORY_FIELDS, $tag_extra_fields );
|
745 |
-
}
|
746 |
-
endif;
|
747 |
-
}
|
748 |
-
|
749 |
-
//Add Pinterest Pin It Button widget to sidebar
|
750 |
-
|
751 |
-
class Pib_Widget extends WP_Widget {
|
752 |
-
|
753 |
-
function __construct() {
|
754 |
-
$widget_ops = array('classname' => 'pib_widget_button', 'description' => __( 'Add a "Pin It" button to your sidebar with this widget') );
|
755 |
-
parent::__construct('pib_button', __('Pinterest - "Pin It" Button'), $widget_ops);
|
756 |
-
}
|
757 |
-
|
758 |
-
function widget( $args, $instance ) {
|
759 |
-
extract($args);
|
760 |
-
|
761 |
-
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
|
762 |
-
|
763 |
-
echo $before_widget;
|
764 |
-
if ( $title )
|
765 |
-
echo $before_title . $title . $after_title;
|
766 |
-
|
767 |
-
echo '<div class="pin-it-btn-wrapper">' . BASE_BTN_HTML . '</div>';
|
768 |
-
echo $after_widget;
|
769 |
-
}
|
770 |
-
|
771 |
-
function update( $new_instance, $old_instance ) {
|
772 |
-
$instance = $old_instance;
|
773 |
-
$new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '') );
|
774 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
775 |
-
|
776 |
-
return $instance;
|
777 |
-
}
|
778 |
-
|
779 |
-
function form( $instance ) {
|
780 |
-
$instance = wp_parse_args( (array) $instance, array( 'title' => '') );
|
781 |
-
$title = strip_tags($instance['title']);
|
782 |
-
|
783 |
-
?>
|
784 |
-
|
785 |
-
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
|
786 |
-
<p>
|
787 |
-
|
788 |
-
<?php
|
789 |
-
}
|
790 |
-
}
|
791 |
-
|
792 |
-
//Add function to the widgets_init hook.
|
793 |
-
add_action( 'widgets_init', 'pib_load_widgets' );
|
794 |
-
|
795 |
-
// Function that register Pin It Button widget.
|
796 |
-
function pib_load_widgets() {
|
797 |
-
register_widget( 'Pib_Widget' );
|
798 |
-
}
|
799 |
-
|
800 |
-
//Add Pinterest Follow Button Widget to sidebar
|
801 |
-
|
802 |
-
class Pib_Follow_Button_Widget extends WP_Widget {
|
803 |
-
|
804 |
-
function __construct() {
|
805 |
-
$widget_ops = array('classname' => 'pib_widget_follow_button', 'description' => __( 'Add a Pinterest "Follow" button to your sidebar with this widget') );
|
806 |
-
parent::__construct('pib_follow_button', __('Pinterest - "Follow" Button'), $widget_ops);
|
807 |
-
}
|
808 |
-
|
809 |
-
function widget( $args, $instance ) {
|
810 |
-
extract($args);
|
811 |
-
|
812 |
-
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
|
813 |
-
$pib_img_option = $instance['pib_follow_button_radio'];
|
814 |
-
$pibusername = $instance['pibusername'];
|
815 |
-
$newwindow = $instance['newwindow'] ? '1' : '0';
|
816 |
-
|
817 |
-
echo $before_widget;
|
818 |
-
if ( $title )
|
819 |
-
echo $before_title . $title . $after_title;
|
820 |
-
|
821 |
-
if($pib_img_option == 1){
|
822 |
-
if($newwindow){
|
823 |
-
echo '<a href="http://pinterest.com/'.$pibusername.'/" target="_blank"><img src="http://passets-cdn.pinterest.com/images/follow-on-pinterest-button.png" width="156" height="26" alt="Follow Me on Pinterest" /></a>';
|
824 |
-
}
|
825 |
-
else{
|
826 |
-
echo '<a href="http://pinterest.com/'.$pibusername.'/"><img src="http://passets-cdn.pinterest.com/images/follow-on-pinterest-button.png" width="156" height="26" alt="Follow Me on Pinterest" /></a>';
|
827 |
-
}
|
828 |
-
}
|
829 |
-
elseif($pib_img_option == 2){
|
830 |
-
if($newwindow){
|
831 |
-
echo'<a href="http://pinterest.com/'.$pibusername.'/" target="_blank"><img src="http://passets-cdn.pinterest.com/images/pinterest-button.png" width="78" height="26" alt="Follow Me on Pinterest" /></a>';
|
832 |
-
}
|
833 |
-
else {
|
834 |
-
echo'<a href="http://pinterest.com/'.$pibusername.'/"><img src="http://passets-cdn.pinterest.com/images/pinterest-button.png" width="78" height="26" alt="Follow Me on Pinterest" /></a>';
|
835 |
-
}
|
836 |
-
}
|
837 |
-
elseif($pib_img_option == 3){
|
838 |
-
if($newwindow){
|
839 |
-
echo'<a href="http://pinterest.com/'.$pibusername.'/" target="_blank"><img src="http://passets-cdn.pinterest.com/images/big-p-button.png" width="61" height="61" alt="Follow Me on Pinterest" /></a>';
|
840 |
-
}
|
841 |
-
else {
|
842 |
-
echo'<a href="http://pinterest.com/'.$pibusername.'/"><img src="http://passets-cdn.pinterest.com/images/big-p-button.png" width="61" height="61" alt="Follow Me on Pinterest" /></a>';
|
843 |
-
}
|
844 |
-
}
|
845 |
-
elseif($pib_img_option == 4){
|
846 |
-
if($newwindow){
|
847 |
-
echo'<a href="http://pinterest.com/'.$pibusername.'/" target="_blank"><img src="http://passets-cdn.pinterest.com/images/small-p-button.png" width="16" height="16" alt="Follow Me on Pinterest" /></a>';
|
848 |
-
}
|
849 |
-
else {
|
850 |
-
echo'<a href="http://pinterest.com/'.$pibusername.'/"><img src="http://passets-cdn.pinterest.com/images/small-p-button.png" width="16" height="16" alt="Follow Me on Pinterest" /></a>';
|
851 |
-
}
|
852 |
-
}
|
853 |
-
|
854 |
-
echo $after_widget;
|
855 |
-
}
|
856 |
-
|
857 |
-
function update( $new_instance, $old_instance ) {
|
858 |
-
$instance = $old_instance;
|
859 |
-
$new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '', 'pibusername' => '', 'pib_follow_button_radio' => '1') );
|
860 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
861 |
-
$instance['pibusername'] = strip_tags($new_instance['pibusername']);
|
862 |
-
$instance['pib_follow_button_radio'] = strip_tags($new_instance['pib_follow_button_radio']);
|
863 |
-
$instance['newwindow'] = !empty($new_instance['newwindow']) ? 1 : 0;
|
864 |
-
|
865 |
-
return $instance;
|
866 |
-
}
|
867 |
-
|
868 |
-
function form( $instance ) {
|
869 |
-
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'pibusername' => '', 'pib_follow_button_radio' => '1') );
|
870 |
-
$title = strip_tags($instance['title']);
|
871 |
-
$pibusername = strip_tags($instance['pibusername']);
|
872 |
-
$pib_follow_button_radio = $instance['pib_follow_button_radio'];
|
873 |
-
$newwindow = isset( $instance['newwindow'] ) ? (bool) $instance['newwindow'] : false;
|
874 |
-
|
875 |
-
?>
|
876 |
-
|
877 |
-
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
|
878 |
-
<p>
|
879 |
-
|
880 |
-
<p><label for="<?php echo $this->get_field_id('pibusername'); ?>"><?php _e('Pinterest Username:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('pibusername'); ?>" name="<?php echo $this->get_field_name('pibusername'); ?>" type="text" value="<?php echo esc_attr($pibusername); ?>" /></p>
|
881 |
-
<p>
|
882 |
-
|
883 |
-
<p><label>Button image:</label></p>
|
884 |
-
|
885 |
-
<table>
|
886 |
-
<tr>
|
887 |
-
<td><input type="radio" <?php if($pib_follow_button_radio == 1){ echo'checked="checked"';} ?> name="<?php echo $this->get_field_name('pib_follow_button_radio'); ?>" id="<?php echo $this->get_field_id('follow-on-pinterest-button'); ?>" value="1" /></td>
|
888 |
-
<td><img src="http://passets-cdn.pinterest.com/images/follow-on-pinterest-button.png" width="156" height="26" alt="Follow Me on Pinterest" /></td>
|
889 |
-
</tr>
|
890 |
-
<tr>
|
891 |
-
<td><input type="radio" <?php if($pib_follow_button_radio == 2){ echo'checked="checked"';} ?> name="<?php echo $this->get_field_name('pib_follow_button_radio'); ?>" id="<?php echo $this->get_field_id('pinterest-button'); ?>" value="2"/></td>
|
892 |
-
<td><img src="http://passets-cdn.pinterest.com/images/pinterest-button.png" width="78" height="26" alt="Follow Me on Pinterest" /></td>
|
893 |
-
</tr>
|
894 |
-
<tr>
|
895 |
-
<td><input type="radio" <?php if($pib_follow_button_radio == 3){ echo'checked="checked"';} ?> name="<?php echo $this->get_field_name('pib_follow_button_radio'); ?>" id="<?php echo $this->get_field_id('big-p-button'); ?>" value="3"/></td>
|
896 |
-
<td><img src="http://passets-cdn.pinterest.com/images/big-p-button.png" width="61" height="61" alt="Follow Me on Pinterest" /></td>
|
897 |
-
</tr>
|
898 |
-
<tr>
|
899 |
-
<td><input type="radio" <?php if($pib_follow_button_radio == 4){ echo'checked="checked"';} ?> name="<?php echo $this->get_field_name('pib_follow_button_radio'); ?>" id="<?php echo $this->get_field_id('small-p-button'); ?>" value="4"/></td>
|
900 |
-
<td><img src="http://passets-cdn.pinterest.com/images/small-p-button.png" width="16" height="16" alt="Follow Me on Pinterest" /></td>
|
901 |
-
</tr>
|
902 |
-
</table>
|
903 |
-
<br />
|
904 |
-
<p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('newwindow'); ?>" name="<?php echo $this->get_field_name('newwindow'); ?>" <?php checked( $newwindow ); ?> />
|
905 |
-
<label for="<?php echo $this->get_field_id('newwindow'); ?>"><?php _e( 'Open in a new window' ); ?></label><br />
|
906 |
-
|
907 |
-
<?php
|
908 |
-
}
|
909 |
-
}
|
910 |
-
|
911 |
-
//Add function to the widgets_init hook.
|
912 |
-
add_action( 'widgets_init', 'pib_load_follow_button_widget' );
|
913 |
-
|
914 |
-
// Function that registers Follow Button widget.
|
915 |
-
function pib_load_follow_button_widget() {
|
916 |
-
register_widget( 'Pib_Follow_Button_Widget' );
|
917 |
-
}
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
?>
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Pinterest "Pin It" Button
|
4 |
+
Plugin URI: http://pinterestplugin.com
|
5 |
+
Description: Add a Pinterest "Pin It" Button to your posts and pages allowing your readers easily pin your images. Includes shortcode and widget.
|
|
|
6 |
Author: Phil Derksen
|
7 |
+
Author URI: http://pinterestplugin.com
|
8 |
+
Version: 1.3.1
|
9 |
+
License: GPLv2
|
10 |
+
Copyright 2012 Phil Derksen (phil@pinterestplugin.com)
|
11 |
*/
|
12 |
|
13 |
+
/***************************
|
14 |
+
* Global Constants
|
15 |
+
***************************/
|
16 |
|
17 |
+
define( 'PIB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
|
|
|
|
18 |
|
19 |
+
$pib_options = get_option( 'pib_options' );
|
|
|
|
|
|
|
20 |
|
21 |
+
/***************************
|
22 |
+
* Includes
|
23 |
+
***************************/
|
|
|
24 |
|
25 |
+
require_once( 'inc/admin-settings.php' );
|
26 |
+
require_once( 'inc/widget.php' );
|
27 |
+
require_once( 'inc/shortcode.php' );
|
28 |
+
require_once( 'inc/post-meta-page.php' );
|
29 |
+
require_once( 'inc/category-meta-page.php' );
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
//Plugin install/activation
|
32 |
|
33 |
function pib_install() {
|
34 |
+
global $pib_options;
|
35 |
+
|
36 |
//Deactivate plugin if WP version too low
|
37 |
if ( version_compare( get_bloginfo( 'version' ), '3.0', '<' ) ) {
|
38 |
deactivate_plugins( basename( __FILE__ ) );
|
39 |
}
|
40 |
+
|
41 |
+
//Setup default options for values that don't exist and need to be set to 1/true/value (not 0/false/blank)
|
42 |
+
//Done this way to preseve options saved in previous versions
|
43 |
+
if ( !isset( $pib_options['display_home_page'] ) ) { $pib_options['display_home_page'] = 1; }
|
44 |
+
if ( !isset( $pib_options['display_posts'] ) ) { $pib_options['display_posts'] = 1; }
|
45 |
+
if ( !isset( $pib_options['display_pages'] ) ) { $pib_options['display_pages'] = 1; }
|
46 |
+
if ( !isset( $pib_options['display_below_content'] ) ) { $pib_options['display_below_content'] = 1; }
|
47 |
+
if ( !isset( $pib_options['button_style'] ) ) { $pib_options['button_style'] = 'user_selects_image'; }
|
48 |
+
if ( !isset( $pib_options['count_layout'] ) ) { $pib_options['count_layout'] = 'none'; }
|
49 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
//Save default option values
|
51 |
update_option( 'pib_options', $pib_options );
|
|
|
52 |
}
|
53 |
|
54 |
register_activation_hook( __FILE__, 'pib_install' );
|
55 |
|
56 |
+
//Debugging
|
|
|
|
|
57 |
|
58 |
+
function pib_debug_print( $value ) {
|
59 |
+
print_r( '<br/><br/>' );
|
60 |
+
print_r( $value );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
|
63 |
+
//Register settings
|
64 |
+
|
65 |
+
function pib_register_settings() {
|
66 |
+
register_setting( 'pib-settings-group', 'pib_options' );
|
67 |
+
}
|
68 |
+
|
69 |
+
// Tie into WordPress Hooks and any functions that should run on load
|
70 |
+
|
71 |
+
add_action( 'admin_init', 'pib_sharing_add_meta_box' );
|
72 |
+
add_action( 'admin_init', 'pib_register_settings' );
|
73 |
|
74 |
//Add settings page to admin menu
|
75 |
+
//Use $page variable to load CSS/JS ONLY for this plugin's admin page
|
76 |
|
77 |
function pib_create_menu() {
|
78 |
+
$capability = 'manage_options';
|
79 |
+
|
80 |
+
//add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position );
|
81 |
+
$page = add_menu_page( 'Pin It Button Settings', 'Pin It Button', $capability, __FILE__, 'pib_create_settings_page',
|
82 |
+
plugins_url( '/img/pinterest-button-icon-small.png', __FILE__ ) );
|
83 |
+
|
84 |
+
add_action( 'admin_print_styles-' . $page, 'pib_add_admin_css_js' );
|
85 |
}
|
86 |
|
87 |
add_action( 'admin_menu', 'pib_create_menu' );
|
95 |
wp_enqueue_script( 'pinterest-pin-it-button', plugins_url( '/js/pinterest-pin-it-button-admin.js', __FILE__ ), array( 'jquery' ) );
|
96 |
}
|
97 |
|
98 |
+
//Add first-install pointer CSS/JS & functionality
|
|
|
99 |
|
100 |
+
function pib_add_admin_css_js_pointer() {
|
101 |
+
wp_enqueue_style( 'wp-pointer' );
|
102 |
+
wp_enqueue_script( 'wp-pointer' );
|
103 |
+
|
104 |
+
add_action( 'admin_print_footer_scripts', 'pib_admin_print_footer_scripts' );
|
105 |
}
|
106 |
|
107 |
+
add_action( 'admin_enqueue_scripts', 'pib_add_admin_css_js_pointer' );
|
108 |
|
109 |
+
//Add pointer popup message when plugin first installed
|
110 |
|
111 |
+
function pib_admin_print_footer_scripts() {
|
112 |
+
//Check option to hide pointer after initial display
|
113 |
+
if ( !get_option( 'pib_hide_pointer' ) ) {
|
114 |
+
$pointer_content = '<h3>Ready to be Pinned?</h3>';
|
115 |
+
$pointer_content .= '<p>Congratulations. You have just installed the Pinterest "Pin It" Button Plugin. ' .
|
116 |
+
'Now just configure your settings and start getting Pinned!</p>';
|
117 |
+
|
118 |
+
$url = admin_url( 'admin.php?page=' . PIB_PLUGIN_BASENAME );
|
119 |
+
|
120 |
+
?>
|
121 |
|
122 |
+
<script type="text/javascript">
|
123 |
+
//<![CDATA[
|
124 |
+
jQuery(document).ready( function($) {
|
125 |
+
$("#menu-plugins").pointer({
|
126 |
+
content: '<?php echo $pointer_content; ?>',
|
127 |
+
buttons: function( event, t ) {
|
128 |
+
button = $('<a id="pointer-close" class="button-secondary">Close</a>');
|
129 |
+
button.bind("click.pointer", function() {
|
130 |
+
t.element.pointer("close");
|
131 |
+
});
|
132 |
+
return button;
|
133 |
+
},
|
134 |
+
position: "left",
|
135 |
+
close: function() { }
|
136 |
|
137 |
+
}).pointer("open");
|
138 |
+
|
139 |
+
$("#pointer-close").after('<a id="pointer-primary" class="button-primary" style="margin-right: 5px;" href="<?php echo $url; ?>">' +
|
140 |
+
'Pin It Button Settings');
|
141 |
+
});
|
142 |
+
//]]>
|
143 |
+
</script>
|
144 |
+
|
145 |
+
<?php
|
146 |
+
|
147 |
+
//Update option so this pointer is never seen again
|
148 |
+
update_option( 'pib_hide_pointer', 1 );
|
149 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
151 |
|
152 |
//Render rss items from pinterestplugin.com
|
153 |
//http://codex.wordpress.org/Function_Reference/fetch_feed
|
154 |
+
|
155 |
function pib_rss_news() {
|
156 |
// Get RSS Feed(s)
|
157 |
include_once(ABSPATH . WPINC . '/feed.php');
|
159 |
// Get a SimplePie feed object from the specified feed source.
|
160 |
$rss = fetch_feed('http://pinterestplugin.com/feed/');
|
161 |
|
162 |
+
if (!is_wp_error( $rss ) ) {
|
163 |
+
// Checks that the object is created correctly
|
164 |
// Figure out how many total items there are, but limit it to 5.
|
165 |
+
$maxitems = $rss->get_item_quantity(3);
|
166 |
|
167 |
// Build an array of all the items, starting with element 0 (first element).
|
168 |
$rss_items = $rss->get_items(0, $maxitems);
|
169 |
+
}
|
170 |
+
|
171 |
?>
|
172 |
|
173 |
<ul>
|
174 |
+
<?php if ($maxitems == 0): ?>
|
175 |
+
<li><?php _e( 'No items.', 'pib' ); ?></li>
|
176 |
+
<?php else: ?>
|
177 |
+
<?php
|
178 |
+
// Loop through each feed item and display each item as a hyperlink.
|
179 |
+
foreach ( $rss_items as $item ): ?>
|
180 |
+
<li>
|
181 |
+
» <a href="<?php echo esc_url( $item->get_permalink() ); ?>" target="_blank" class="external">
|
182 |
+
<?php echo esc_html( $item->get_title() ); ?></a>
|
183 |
+
</li>
|
184 |
+
<?php endforeach; ?>
|
185 |
+
<?php endif; ?>
|
186 |
</ul>
|
187 |
|
188 |
<?php
|
190 |
|
191 |
//Render Facebook Share button
|
192 |
//http://developers.facebook.com/docs/share/
|
193 |
+
|
194 |
function pib_share_facebook() {
|
195 |
+
?>
|
|
|
196 |
<a name="fb_share" type="button" share_url="http://pinterestplugin.com/" alt="Share on Facebook"></a>
|
197 |
+
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
|
|
|
198 |
<?php
|
199 |
}
|
200 |
|
201 |
//Render Twitter button
|
202 |
//https://twitter.com/about/resources/buttons
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
|
204 |
+
function pib_share_twitter() {
|
|
|
|
|
205 |
?>
|
206 |
+
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://pinterestplugin.com" data-text="I'm using the Pinterest "Pin It" Button Plugin for WordPress. It rocks!" data-count="none">Tweet</a>
|
207 |
+
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
<?php
|
209 |
}
|
210 |
|
211 |
//Render Pin It button
|
212 |
+
//Render in iFrame otherwise it messes up the WP admin left menu
|
213 |
+
|
214 |
function pib_share_pinterest() {
|
215 |
?>
|
216 |
+
<a href="http://pinterest.com/pin/create/button/?url=http%3A%2F%2Fpinterestplugin.com%2F&media=http%3A%2F%2Fpinterestplugin.com%2Fwp-content%2Fuploads%2F2012%2F02%2Fpinterest-pin-it-button-wordpress-plugin.jpg&description=Pinterest%20%22Pin%20It%22%20Button%20Plugin%20for%20WordPress%20--%20http%3A%2F%2Fpinterestplugin.com" class="pin-it-button" count-layout="none"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
|
217 |
+
<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>
|
218 |
<?php
|
219 |
}
|
220 |
|
221 |
+
//Add Settings link to the left of Deactivate on plugins list page
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
|
223 |
+
function pib_plugin_settings_link( $links ) {
|
224 |
$url = admin_url( 'admin.php?page=' . PIB_PLUGIN_BASENAME );
|
225 |
+
$settings_link = '<a href="' . $url . '">Settings</a>';
|
|
|
226 |
array_unshift( $links, $settings_link );
|
|
|
227 |
return $links;
|
228 |
}
|
229 |
+
|
230 |
+
add_filter('plugin_action_links_' . PIB_PLUGIN_BASENAME, 'pib_plugin_settings_link' );
|
231 |
|
232 |
+
//Add Public CSS/JS (to Header)
|
|
|
|
|
233 |
|
234 |
+
function pib_add_public_css_js() {
|
235 |
+
wp_enqueue_style( 'pinterest_pin_it_button', plugins_url( '/css/pinterest-pin-it-button.css' , __FILE__ ) );
|
|
|
236 |
}
|
237 |
|
238 |
+
add_action( 'wp_enqueue_scripts', 'pib_add_public_css_js' );
|
|
|
|
|
239 |
|
240 |
+
//Add Public JS (to Footer)
|
|
|
241 |
|
242 |
+
function pib_add_public_js_footer() {
|
243 |
+
global $pib_options;
|
|
|
|
|
|
|
244 |
|
245 |
+
// If option #1 selected (user selects image)
|
246 |
+
if ( ( $pib_options['button_style'] == 'user_selects_image' ) || empty( $pib_options['button_style'] ) ) {
|
247 |
+
//Save iFrame URL to JS variable
|
248 |
+
echo '<script type="text/javascript">' .
|
249 |
+
'var iFrameBtnUrl = "' . plugins_url( '/inc/pin-it-button-user-selects-image-iframe.html', __FILE__ ) . '"; ' .
|
250 |
+
'</script>' . "\n";
|
251 |
+
|
252 |
+
echo '<script type="text/javascript" src="' . plugins_url( '/js/pin-it-button-user-selects-image.js', __FILE__ ) . '"></script>' . "\n";
|
253 |
+
echo '<script type="text/javascript" src="' . plugins_url( '/js/pin-it-button-user-selects-image-assets.js', __FILE__ ) . '"></script>' . "\n";
|
254 |
+
}
|
255 |
+
// If option #2 selected (image pre-selected)
|
256 |
+
elseif ( $pib_options['button_style'] == 'image_selected' ) {
|
257 |
+
echo '<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>' . "\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
}
|
|
|
|
|
259 |
}
|
260 |
|
261 |
+
add_action( 'wp_footer', 'pib_add_public_js_footer' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
|
263 |
//Add Custom CSS
|
264 |
|
265 |
function pib_add_custom_css() {
|
266 |
+
global $pib_options;
|
267 |
+
|
268 |
$custom_css = trim( $pib_options['custom_css'] );
|
269 |
|
270 |
if ( $custom_css != '' ) {
|
274 |
|
275 |
add_action( 'wp_head', 'pib_add_custom_css' );
|
276 |
|
277 |
+
//Function for rendering "Pin It" button base html
|
278 |
|
279 |
+
function pib_button_base( $postUrl, $imageUrl, $description, $countLayout ) {
|
280 |
+
global $pib_options;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
|
282 |
+
//Change css class for "user selects image" button style to avoid conflicts
|
283 |
+
$buttonClass = 'pin-it-button';
|
284 |
+
|
285 |
+
if ( $pib_options['button_style'] == 'user_selects_image' ) {
|
286 |
+
$buttonClass = 'pin-it-button2';
|
287 |
+
}
|
288 |
+
|
289 |
+
//HTML from Pinterest Goodies 3/19/2012
|
290 |
+
//<a href="http://pinterest.com/pin/create/button/?url=PAGE&media=IMG&description=DESC" class="pin-it-button" count-layout="horizontal">
|
291 |
+
//<img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
|
292 |
+
|
293 |
+
$btn = '<a href="http://pinterest.com/pin/create/button/?url=' . urlencode( $postUrl ) .
|
294 |
+
'&media=' . urlencode( $imageUrl ) . '&description='. urlencode( $description ) . '" ' .
|
295 |
+
'count-layout="' . $countLayout . '" class="' . $buttonClass . '">' .
|
296 |
+
'<img border="0" style="border:0;" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>';
|
297 |
+
|
298 |
+
return $btn;
|
299 |
}
|
300 |
|
301 |
+
//Button html to render
|
302 |
|
303 |
+
function pib_button_html( $postID ) {
|
304 |
+
global $pib_options;
|
305 |
+
global $post;
|
306 |
|
307 |
+
$pib_url_of_webpage = get_post_meta( $postID, 'pib_url_of_webpage', true );
|
308 |
+
$pib_url_of_img = get_post_meta( $postID, 'pib_url_of_img', true );
|
309 |
+
$pib_description = get_post_meta( $postID, 'pib_description', true );
|
310 |
+
|
311 |
+
$countLayout = $pib_options['count_layout'];
|
312 |
+
$permalink = get_permalink( $postID );
|
313 |
+
$title = get_the_title( $postID );
|
314 |
+
$first_img = '';
|
315 |
+
|
316 |
+
//Get url of img and compare width and height
|
317 |
+
$output = preg_match_all( '/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches );
|
318 |
+
$first_img = $matches [1] [0];
|
319 |
+
|
320 |
+
//Determine if button displayed on current page from single post settings
|
321 |
+
if ( get_post_meta( $postID, 'pib_sharing_disabled', 1 ) ) {
|
322 |
+
return "";
|
323 |
+
}
|
324 |
+
else {
|
325 |
+
//if url_of_webpage, url_of_img or description are not set through pinit admin setting page then set default to post/page URL for the attribute url
|
326 |
+
$pib_url_of_webpage = ( empty( $pib_url_of_webpage ) ? $permalink : $pib_url_of_webpage );
|
327 |
+
$pib_url_of_img = ( empty( $pib_url_of_img ) ? $first_img : $pib_url_of_img );
|
328 |
+
$pib_description = ( empty( $pib_description ) ? $title : $pib_description );
|
329 |
+
|
330 |
+
$baseBtn = pib_button_base( $pib_url_of_webpage, $pib_url_of_img, $pib_description, $countLayout );
|
331 |
+
|
332 |
+
if ( $pib_options['remove_div'] ) {
|
333 |
+
return $baseBtn;
|
334 |
+
}
|
335 |
+
else {
|
336 |
+
//Surround with div tag
|
337 |
+
return '<div class="pin-it-btn-wrapper">' . $baseBtn . '</div>';
|
338 |
+
}
|
339 |
+
}
|
340 |
+
}
|
341 |
|
342 |
//Render button on pages with regular content
|
343 |
|
344 |
function pib_render_btn( $content ) {
|
345 |
+
global $pib_options;
|
|
|
346 |
global $post;
|
347 |
+
|
348 |
$postID = $post->ID;
|
349 |
+
|
350 |
+
//Determine if button displayed on current page from main admin settings
|
351 |
if (
|
352 |
( is_home() && ( $pib_options['display_home_page'] ) ) ||
|
353 |
( is_front_page() && ( $pib_options['display_front_page'] ) ) ||
|
354 |
( is_single() && ( $pib_options['display_posts'] ) ) ||
|
355 |
+
( is_page() && ( $pib_options['display_pages'] ) && !is_front_page() ) ||
|
356 |
+
|
357 |
+
//archive pages besides categories (tag, author, date, search)
|
358 |
+
//http://codex.wordpress.org/Conditional_Tags
|
359 |
+
( is_archive() && ( $pib_options['display_archives'] ) &&
|
360 |
+
( is_tag() || is_author() || is_date() || is_search() )
|
361 |
+
)
|
362 |
) {
|
363 |
if ( $pib_options['display_above_content'] ) {
|
364 |
+
$content = pib_button_html( $postID ) . $content;
|
365 |
}
|
|
|
366 |
if ( $pib_options['display_below_content'] ) {
|
367 |
+
$content .= pib_button_html( $postID );
|
368 |
}
|
369 |
+
}
|
|
|
370 |
|
371 |
//Determine if displayed on Category on the base of category edit Screen Option
|
372 |
+
if ( is_archive() && ( $pib_options['display_archives'] ) ) {
|
|
|
373 |
$tag_extra_fields = get_option(PIB_CATEGORY_FIELDS);
|
374 |
$category_ids = get_all_category_ids();
|
375 |
foreach($category_ids as $term_id) {
|
394 |
|
395 |
add_filter( 'the_content', 'pib_render_btn' );
|
396 |
|
|
|
397 |
//Render button on pages with excerpts if option checked
|
398 |
|
399 |
function pib_render_btn_excerpt( $content ) {
|
400 |
+
global $pib_options;
|
|
|
401 |
global $post;
|
402 |
$postID = $post->ID;
|
403 |
|
410 |
if ( $pib_options['display_above_content'] ) {
|
411 |
$content = pib_button_html($postID) . $content;
|
412 |
}
|
|
|
413 |
if ( $pib_options['display_below_content'] ) {
|
414 |
$content .= pib_button_html($postID);
|
415 |
}
|
416 |
+
}
|
|
|
417 |
|
418 |
//Determine if displayed on Category on the base of category edit Screen Option
|
419 |
if( is_archive() && ( $pib_options['display_archives'] ) ) {
|
435 |
}
|
436 |
}
|
437 |
}
|
|
|
|
|
438 |
}
|
439 |
}
|
440 |
}
|
442 |
}
|
443 |
|
444 |
add_filter( 'the_excerpt', 'pib_render_btn_excerpt' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -2,50 +2,68 @@
|
|
2 |
Contributors: pderksen
|
3 |
Tags: pinterest, pin it, social
|
4 |
Requires at least: 3.0
|
5 |
-
Tested up to: 3.3.
|
6 |
Stable tag: trunk
|
7 |
|
8 |
-
Add a Pinterest "Pin It" Button to your
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
-
Add a Pinterest "Pin It" Button to your
|
13 |
|
14 |
-
|
15 |
|
16 |
-
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
20 |
-
*
|
21 |
-
* Display within content with a shortcode
|
22 |
-
* Add custom CSS for fine-tuning layout and styling
|
23 |
-
* Add "Pin It" button as a sidebar widget
|
24 |
-
* Add a "Follow" on Pinterest button as a sidebar widget
|
25 |
|
26 |
= Resources =
|
27 |
|
28 |
-
*
|
29 |
-
*
|
30 |
-
* [User Support & Feature Requests](http://pinterestplugin.com/
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
Take advantage of the exploding traffic Pinterest is generating by encouraging your readers to pin your content using this simple "Pin It" button.
|
33 |
|
34 |
-
**Pinterest Drives More Traffic Than Google+, YouTube and LinkedIn Combined** - Mashable
|
|
|
|
|
35 |
|
36 |
-
**Pinterest
|
37 |
|
38 |
-
|
|
|
|
|
|
|
|
|
39 |
|
40 |
== Installation ==
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
1.
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
-
|
47 |
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
== Frequently Asked Questions ==
|
51 |
|
@@ -54,94 +72,112 @@ Note: If you overwrite the plugin using FTP upload, you may lose some saved sett
|
|
54 |
Here are some things to try. After each one re-test a couple pages on your site to see if that fixed it.
|
55 |
|
56 |
* Clear your browser cache.
|
|
|
57 |
* Test in a different browser.
|
58 |
* If using any WordPress caching plugin, please empty/clear it (examples: W3 Total Cache, WP-Cache and WP SuperCache).
|
59 |
-
*
|
60 |
* Disable other social sharing plugins being used.
|
61 |
* Disable other plugins one by one until the issue is fixed. (Please let us know if you find and incompatible plugin.
|
62 |
* Switch to a different theme temporarily, preferably the default WordPress TwentyEleven theme. Please let us know if you find an incompatible theme.
|
63 |
* If you find a different solution that fixes the issue for you (or find an incompatible plugin or theme), please let us know.
|
64 |
|
|
|
|
|
|
|
|
|
|
|
65 |
**How do I display the button in places other than above or below the content?**
|
66 |
|
67 |
-
* Use the shortcode `[pinit]` to display the button within content.
|
68 |
* Use the function `<?php echo do_shortcode('[pinit]'); ?>` to display within template or theme files.
|
69 |
|
70 |
**How do I get the "Pin It" button to line up next to my other social sharing icons?**
|
71 |
|
72 |
* Add custom CSS on the settings screen and optionally remove the surrounding `<div>` tag.
|
73 |
-
* See some of our [custom CSS examples](http://pinterestplugin.com/pin-it-button-custom-css).
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
**I'd like to report a bug or submit a feature request.**
|
76 |
|
77 |
-
* Go to the [User Support & Feature Requests Forum](http://pinterestplugin.com/
|
78 |
|
79 |
== Screenshots ==
|
80 |
|
81 |
1. Settings page
|
82 |
2. Button display below a post
|
83 |
-
3.
|
|
|
|
|
84 |
|
85 |
== Changelog ==
|
86 |
|
87 |
-
= 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
-
|
|
|
90 |
|
91 |
= 1.2.0 =
|
92 |
-
|
93 |
-
* Added option to hide button per
|
94 |
-
* Added
|
95 |
-
* Added widget to display "
|
96 |
-
*
|
97 |
-
* Added sharing buttons to settings page to promote plugin
|
98 |
-
* Fixed CSS where some blogs weren't displaying the button properly
|
99 |
|
100 |
= 1.1.3 =
|
101 |
-
|
102 |
-
* Added option to hide button on individual posts and pages (on post/page editing screen)
|
103 |
|
104 |
= 1.1.2 =
|
105 |
-
|
106 |
-
* Bug fix: Removed use of session state storing for now as it caused errors for some
|
107 |
|
108 |
= 1.1.1 =
|
109 |
-
|
110 |
-
* Updated jQuery coding method to avoid JavaScript conflicts with other plugins and themes some were getting
|
111 |
|
112 |
= 1.1.0 =
|
113 |
-
|
114 |
-
* Added
|
115 |
-
* Added
|
116 |
-
*
|
117 |
-
* Added additional message and link to settings page at top after plugin is activated
|
118 |
-
* Changed the way the button click is called to solve pinning issues in Internet Explorer
|
119 |
-
* Now using table layout on settings page like WordPress dashboard page (with collapsible boxes)
|
120 |
-
* Added mailing list signup form, other links, and rss feed in right column on settings page
|
121 |
|
122 |
= 1.0.2 =
|
123 |
-
|
124 |
-
*
|
125 |
-
* "Pin It" links generated by the shortcode should not show up when viewing the post in RSS readers
|
126 |
-
* Settings link added to the plugin entry on the plugins page
|
127 |
|
128 |
= 1.0.1 =
|
129 |
-
|
130 |
-
* Added checkbox option to display/hide button on "front page" (sometimes different than home page)
|
131 |
|
132 |
= 1.0.0 =
|
133 |
-
|
134 |
-
* Added
|
135 |
-
*
|
136 |
-
* Added shortcode [pinit] to display button within content
|
137 |
-
* Settings page is now under main admin menu (was under Settings menu)
|
138 |
-
* Added icons to admin menu item and settings page title
|
139 |
|
140 |
= 0.1.2 =
|
141 |
-
* Moved javascript that fires on button click to a separate file
|
142 |
|
143 |
= 0.1.1 =
|
144 |
* Fixed style sheet reference
|
145 |
|
146 |
-
= 0.1 =
|
147 |
* Initial release
|
2 |
Contributors: pderksen
|
3 |
Tags: pinterest, pin it, social
|
4 |
Requires at least: 3.0
|
5 |
+
Tested up to: 3.3.2
|
6 |
Stable tag: trunk
|
7 |
|
8 |
+
Add a Pinterest "Pin It" Button to your site to let your visitors easily pin your awesome content!
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
+
Add a Pinterest "Pin It" Button to your site to let your visitors easily pin your awesome content!
|
13 |
|
14 |
+
### "Pin It" Button Features: ###
|
15 |
|
16 |
+
* Specify image to pin or let the reader select
|
17 |
+
* Add horizontal or vertical pin count
|
18 |
+
* Display or hide on any post, page or category
|
19 |
+
* Custom CSS for aligning just right
|
20 |
+
* Includes widget and full shortcode support
|
|
|
|
|
|
|
|
|
21 |
|
22 |
= Resources =
|
23 |
|
24 |
+
* [View Live Demo »](http://bruisesandbandaids.com/2011/newborn-photography-props/)
|
25 |
+
* [Pinterest Plugin Updates »](http://pinterestplugin.com)
|
26 |
+
* [User Support & Feature Requests »](http://pinterestplugin.com/support)
|
27 |
+
|
28 |
+
= More Features =
|
29 |
+
|
30 |
+
* Display above and/or below content
|
31 |
+
* Optionally display on post excerpts
|
32 |
+
* Optionally specify URL, image and description for each button
|
33 |
|
34 |
Take advantage of the exploding traffic Pinterest is generating by encouraging your readers to pin your content using this simple "Pin It" button.
|
35 |
|
36 |
+
**Pinterest Drives More Traffic Than Google+, YouTube and LinkedIn Combined** - Mashable [[link]](http://mashable.com/2012/02/01/pinterest-traffic-study/)
|
37 |
+
|
38 |
+
**Pinterest Rate of Referral Now Close to Twitter, Google+** - The Wall Street Journal [[link]](http://blogs.wsj.com/tech-europe/2012/02/03/pinterest-rate-of-referral-now-close-to-twitter-google/)
|
39 |
|
40 |
+
**Pinterest Hits 10 Million U.S. Monthly Uniques Faster Than Any Standalone Site Ever** - TechCrunch [[link]](http://techcrunch.com/2012/02/07/pinterest-monthly-uniques/)
|
41 |
|
42 |
+
= More Pinterest Plugins =
|
43 |
+
|
44 |
+
* [Top Pinned Posts](http://pinterestplugin.com/)
|
45 |
+
* ["Follow" Button](http://pinterestplugin.com/follow-button)
|
46 |
+
* [Pinterest Block](http://pinterestplugin.com/pinterest-block)
|
47 |
|
48 |
== Installation ==
|
49 |
|
50 |
+
**Finding and installing through the WordPress admin:**
|
51 |
+
|
52 |
+
1. If searching for this plugin in your WordPress admin, search for "pin it button".
|
53 |
+
1. Find the plugin that's labeled *Pinterest "Pin It" Button" with "Pin It" in quotes.
|
54 |
+
1. Also look for my name as the author (*Phil Derksen*). There are other "Pin It" button plugins which is why this can be confusing.
|
55 |
+
1. Click "Install Now", then Activate, then head to the new menu item on the left labeled "Pin It Button".
|
56 |
+
|
57 |
+
Here's a video walkthrough of the install process:
|
58 |
|
59 |
+
http://www.youtube.com/watch?v=NsEGeVpmD0Y
|
60 |
|
61 |
+
**Alternative installation methods:**
|
62 |
+
|
63 |
+
* Download this plugin, then upload through the WordPress admin (Plugins > Add New > Upload)
|
64 |
+
* Download this plugin, unzip the contents, then FTP upload to the `/wp-content/plugins/` directory
|
65 |
+
|
66 |
+
Note: If you overwrite the plugin using an FTP upload, you may lose some saved settings.
|
67 |
|
68 |
== Frequently Asked Questions ==
|
69 |
|
72 |
Here are some things to try. After each one re-test a couple pages on your site to see if that fixed it.
|
73 |
|
74 |
* Clear your browser cache.
|
75 |
+
* Log out of your WordPress admin and refresh the page with the button(s).
|
76 |
* Test in a different browser.
|
77 |
* If using any WordPress caching plugin, please empty/clear it (examples: W3 Total Cache, WP-Cache and WP SuperCache).
|
78 |
+
* See known plugin conflicts below.
|
79 |
* Disable other social sharing plugins being used.
|
80 |
* Disable other plugins one by one until the issue is fixed. (Please let us know if you find and incompatible plugin.
|
81 |
* Switch to a different theme temporarily, preferably the default WordPress TwentyEleven theme. Please let us know if you find an incompatible theme.
|
82 |
* If you find a different solution that fixes the issue for you (or find an incompatible plugin or theme), please let us know.
|
83 |
|
84 |
+
**Known plugin conflicts**
|
85 |
+
|
86 |
+
* W3 Total Cache: Make sure Minify mode is set to Manual, not Auto.
|
87 |
+
* Google Analytics for WordPress: Make sure "Track outbound clicks as pageviews" is un-checked under Advanced Settings.
|
88 |
+
|
89 |
**How do I display the button in places other than above or below the content?**
|
90 |
|
91 |
+
* Use the shortcode `[pinit]` to display the button within content. See shortcode instructions on settings page for attributes you can specify.
|
92 |
* Use the function `<?php echo do_shortcode('[pinit]'); ?>` to display within template or theme files.
|
93 |
|
94 |
**How do I get the "Pin It" button to line up next to my other social sharing icons?**
|
95 |
|
96 |
* Add custom CSS on the settings screen and optionally remove the surrounding `<div>` tag.
|
97 |
+
* See some of our [custom CSS examples](http://pinterestplugin.com/pin-it-button-custom-css/).
|
98 |
+
|
99 |
+
**I had an old version of the plugin that worked and now it doesn't. Can I get it back?
|
100 |
+
|
101 |
+
* Yes, you can [download previous versions here](http://wordpress.org/extend/plugins/pinterest-pin-it-button/download/).
|
102 |
+
* You'll need to deactivate and delete the current plugin, then go to Plugins > Add New > Upload to upload the zip file to your site.
|
103 |
|
104 |
**I'd like to report a bug or submit a feature request.**
|
105 |
|
106 |
+
* Go to the [User Support & Feature Requests Forum](http://pinterestplugin.com/support)
|
107 |
|
108 |
== Screenshots ==
|
109 |
|
110 |
1. Settings page
|
111 |
2. Button display below a post
|
112 |
+
3. Widget options
|
113 |
+
4. Per page settings
|
114 |
+
5. Advanced settings
|
115 |
|
116 |
== Changelog ==
|
117 |
|
118 |
+
= 1.3.1 =
|
119 |
+
* Changed: Modified button JavaScript to be in line with Pinterest's current button embed JavaScript
|
120 |
+
* Changed: Split up internal code files for easier maintenance and updates
|
121 |
+
* Fixed: For the shortcode, if the attributes "url", "image_url" and/or "description" aren't specified, it will try and use the post's custom page url, image url and/or description if found. If not found it will default to the post's url, first image in post and post title.
|
122 |
+
* Fixed: Changed the way defaults are set upon install so it shouldn't override previous settings
|
123 |
+
* Fixed: Uninstall now removes custom post meta fields
|
124 |
+
|
125 |
+
= 1.3.0 =
|
126 |
+
* Added: Added a Pin Count option (horizontal or vertical)
|
127 |
+
* Added: Added new button style where image is pre-selected (like official Pinterest button)
|
128 |
+
* Added: Added fields for specifying URL, image URL and description for new button style **image pre-selected**
|
129 |
+
* Added: Added float option for alignment (none, left or right) to widget and shortcode
|
130 |
+
* Added: Can now remove div tag wrapper surrounding shortcode
|
131 |
+
* Added: Can now remove widget surrounding div tag wrapper
|
132 |
+
* Changed: Moved "Follow" button widget to separate plugin: [Pinterest "Follow" Button](http://wordpress.org/extend/plugins/pinterest-follow-button/)
|
133 |
+
* Changed: Both button styles now embed iframe (like official Pinterest button)
|
134 |
+
* Changed: External JavaScript now loads in footer for better performance
|
135 |
+
* Fixed: Fixed bug where front page was still showing button even when Front Page was unchecked
|
136 |
+
* Fixed: Fixed bug where some settings weren't saved when upgrading the plugin
|
137 |
+
* Fixed: Fixed bug where tag, author, date and search archive pages were not displaying the button
|
138 |
|
139 |
+
= 1.2.1 =
|
140 |
+
* Fixed: Fixed bug with hiding posts/pages/categories when upgrading from a previous version
|
141 |
|
142 |
= 1.2.0 =
|
143 |
+
* Added: Added option to hide button per page/post
|
144 |
+
* Added: Added option to hide button per category
|
145 |
+
* Added: Added widget to display "Pin It" button
|
146 |
+
* Added: Added widget to display "Follow" on Pinterest button
|
147 |
+
* Fixed: Fixed CSS where some blogs weren't displaying the button properly
|
|
|
|
|
148 |
|
149 |
= 1.1.3 =
|
150 |
+
* Added: Added option to hide button on individual posts and pages (on post/page editing screen)
|
|
|
151 |
|
152 |
= 1.1.2 =
|
153 |
+
* Fixed: Removed use of session state storing for now as it caused errors for some
|
|
|
154 |
|
155 |
= 1.1.1 =
|
156 |
+
* Fixed: Updated jQuery coding method to avoid JavaScript conflicts with other plugins and themes some were getting
|
|
|
157 |
|
158 |
= 1.1.0 =
|
159 |
+
* Added: Added custom CSS area for advanced layout and styling
|
160 |
+
* Added: Added checkbox option to remove the button's surrounding `<div>` tag
|
161 |
+
* Added: Button image and style updated to match Pinterest's current embed code
|
162 |
+
* Fixed: Changed the way the button click is called to solve pinning issues in Internet Explorer
|
|
|
|
|
|
|
|
|
163 |
|
164 |
= 1.0.2 =
|
165 |
+
* Added: Added checkbox option to display/hide button on post excerpts
|
166 |
+
* Fixed: "Pin It" links generated by the shortcode should not show up when viewing the post in RSS readers
|
|
|
|
|
167 |
|
168 |
= 1.0.1 =
|
169 |
+
* Added: Added checkbox option to display/hide button on "front page" (sometimes different than home page)
|
|
|
170 |
|
171 |
= 1.0.0 =
|
172 |
+
* Added: Added checkbox options to select what types of pages the button should appear on
|
173 |
+
* Added: Display options above and below content are now checkboxes (one or both can be selected)
|
174 |
+
* Added: Added shortcode [pinit] to display button within content
|
|
|
|
|
|
|
175 |
|
176 |
= 0.1.2 =
|
177 |
+
* Changed: Moved javascript that fires on button click to a separate file
|
178 |
|
179 |
= 0.1.1 =
|
180 |
* Fixed style sheet reference
|
181 |
|
182 |
+
= 0.1.0 =
|
183 |
* Initial release
|
screenshot-1.png
CHANGED
Binary file
|
screenshot-2.jpg
CHANGED
Binary file
|
screenshot-3.png
CHANGED
Binary file
|
screenshot-4.png
ADDED
Binary file
|
screenshot-5.png
ADDED
Binary file
|
uninstall.php
CHANGED
@@ -1,15 +1,20 @@
|
|
1 |
<?php
|
|
|
2 |
//If uninstall/delete not called from WordPress then exit
|
3 |
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
4 |
exit;
|
5 |
}
|
6 |
|
7 |
-
//Note this will run on manual deactivate, but should not run when upgrading/overwriting plugin
|
8 |
-
|
9 |
//Remove option records from options table
|
10 |
delete_option( 'pib_options' );
|
11 |
delete_option( 'pib_category_fields_option' );
|
12 |
|
13 |
-
//Remove
|
|
|
14 |
|
15 |
-
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
|
3 |
//If uninstall/delete not called from WordPress then exit
|
4 |
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
5 |
exit;
|
6 |
}
|
7 |
|
|
|
|
|
8 |
//Remove option records from options table
|
9 |
delete_option( 'pib_options' );
|
10 |
delete_option( 'pib_category_fields_option' );
|
11 |
|
12 |
+
//Remove custom post meta fields
|
13 |
+
$posts = get_posts( array( 'numberposts' => -1 ) );
|
14 |
|
15 |
+
foreach( $posts as $post ) {
|
16 |
+
delete_post_meta( $post->ID, 'pib_sharing_disabled' );
|
17 |
+
delete_post_meta( $post->ID, 'pib_url_of_webpage' );
|
18 |
+
delete_post_meta( $post->ID, 'pib_url_of_img' );
|
19 |
+
delete_post_meta( $post->ID, 'pib_description' );
|
20 |
+
}
|