Posts in Page - Version 1.4.1

Version Description

  • Fix wp_reset_query bug
  • Patch pagination to make it more reliable across themes.
Download this release

Release Info

Developer sewmyheadon
Plugin Icon 128x128 Posts in Page
Version 1.4.1
Comparing to
See all releases

Code changes from version 1.3.1 to 1.4.1

admin/assets/css/post-page_styles.css CHANGED
@@ -1,95 +1,217 @@
 
 
 
 
 
 
1
 
 
 
 
 
 
2
 
3
- .postbox .ivy_social li {
4
- list-style-type:none;
5
- text-indent:-9999px;
6
- display:inline;
7
  }
8
- .postbox .ivy_social li a {
9
- display:block;
10
- float:left;
11
- width:16px;
12
- height:16px;
13
- margin:0 12px;
14
  }
15
- .postbox .ivy_social li.ic_fb a {
16
- background: url("../images/facebook.png") no-repeat top left;
 
 
 
 
 
 
17
  }
18
- .postbox .ivy_social li.ic_tw a {
19
- background: url("../images/twitter.png") no-repeat top left;
 
20
  }
21
- .postbox .ivy_social li.ic_li a {
22
- background: url("../images/linkedin.png") no-repeat top left;
 
 
 
 
 
23
  }
24
- .postbox .ivy_social li.ic_mc a {
25
- background: url("../images/email.png") no-repeat top left;
 
 
 
 
 
26
  }
27
- .postbox .ivy_social li.ic_rss a {
28
- background: url("../images/feed.png") no-repeat top left;
 
29
  }
30
 
31
- /* Clearfix */
32
- .clearfix:before, .clearfix:after {
33
- content: ""; display: table;
34
- }
35
- .clearfix:after {
36
- clear: both;
37
- }
38
- .clearfix {
39
- *zoom: 1;
40
- }
41
 
42
  /* MailChimp Form Embed Code - Slim - 08/17/2011 */
43
  #mc_embed_signup form {
44
- display:block; position:relative; text-align:left; padding:10px 0 10px 0;width: 250px;
45
- }
 
 
 
 
 
46
  #mc_embed_signup h2 {
47
- font-weight:bold; padding:0; margin:15px 0; font-size:1.4em;
48
- }
 
 
 
 
49
  #mc_embed_signup input {
50
- border:1px solid #999; -webkit-appearance:none;
 
51
  }
 
52
  #mc_embed_signup input[type=checkbox] {
53
- -webkit-appearance:checkbox;
54
  }
 
55
  #mc_embed_signup input[type=radio] {
56
- -webkit-appearance:radio;
57
  }
 
58
  #mc_embed_signup input:focus {
59
- border-color:#333;
60
  }
 
61
  #mc_embed_signup .button {
62
- clear:both; background-color: #aaa; border: 0 none; border-radius:4px; color: #FFF; cursor: pointer; display: inline-block; font-size:15px; font-weight: bold; height: 32px; line-height: 32px; margin: 0 5px 10px 0; padding:0; text-align: center; text-decoration: none; vertical-align: top; white-space: nowrap; width: auto;
63
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  #mc_embed_signup .button:hover {
65
- background-color:#777;
66
  }
 
67
  #mc_embed_signup .small-meta {
68
- font-size: 11px;
69
- }
 
70
  #mc_embed_signup .nowrap {
71
- white-space:nowrap;
72
- }
 
73
  #mc_embed_signup label {
74
- display:block; font-size:14px; padding-bottom:10px; font-weight:bold;color:#464646
75
- }
 
 
 
 
 
76
  #mc_embed_signup input.email {
77
- display:block; padding:8px 0; margin:0 0 10px 0; text-indent:5px; width:58%; min-width:130px;float:left;
78
- }
 
 
 
 
 
 
 
79
  #mc_embed_signup input.button {
80
- display:block; clear:none; background:#628C29; width:35%; margin:0 0 10px 0; min-width:90px;float:right;text-shadow:0 1px 0 #666;
81
- }
 
 
 
 
 
 
 
 
82
  #mc_embed_signup div#mce-responses {
83
- float:left; top:-1.4em; padding:0em .5em 0em .5em; overflow:hidden; width:90%;margin: 0 5%; clear: both;}
 
 
 
 
 
 
 
 
84
  #mc_embed_signup div.response {
85
- margin:1em 0; padding:1em .5em .5em 0; font-weight:bold; float:left; top:-1.5em; z-index:1; width:80%;
86
- }
 
 
 
 
 
 
 
87
  #mc_embed_signup #mce-error-response {
88
- display:none;
89
- }
 
90
  #mc_embed_signup #mce-success-response {
91
- color:#529214; display:none;
92
- }
 
 
93
  #mc_embed_signup label.error {
94
- display:block; float:none; width:auto; margin-left:1.05em; text-align:left; padding:.5em 0;
95
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Admin page styles
3
+ */
4
+ .settings_page_posts_in_page th {
5
+ width: 33%
6
+ }
7
 
8
+ /* Clearfix */
9
+ .clearfix:before, .clearfix:after {
10
+ content: "";
11
+ display: table;
12
+ }
13
 
14
+ .clearfix:after {
15
+ clear: both;
 
 
16
  }
17
+
18
+ .clearfix {
19
+ *zoom: 1;
 
 
 
20
  }
21
+
22
+ /**
23
+ * Help & Support metabox styles
24
+ */
25
+ #ivycat_contribute .dashicons {
26
+ font-size: 48px;
27
+ margin-top: -.75em;
28
+ color: #f1f1f1;
29
  }
30
+
31
+ #ivycat_contribute h4 {
32
+ margin-top: 0
33
  }
34
+
35
+ /**
36
+ * Connect with IvyCat metabox styles
37
+ */
38
+ .ivycat-social {
39
+ margin: 0;
40
+ padding: 0;
41
  }
42
+
43
+ .ivycat-social li {
44
+ float: left;
45
+ line-height: 1;
46
+ margin: 0 .6em;
47
+ padding: 0;
48
+ display: inline-block;
49
  }
50
+
51
+ .ivycat-social a {
52
+ text-decoration: none;
53
  }
54
 
55
+ .ivycat-social .dashicons {
56
+ font-size: 32px;
57
+ width: 32px;
58
+ height: 32px;
59
+ }
 
 
 
 
 
60
 
61
  /* MailChimp Form Embed Code - Slim - 08/17/2011 */
62
  #mc_embed_signup form {
63
+ display: block;
64
+ position: relative;
65
+ text-align: left;
66
+ padding: 10px 0 10px 0;
67
+ width: 250px;
68
+ }
69
+
70
  #mc_embed_signup h2 {
71
+ font-weight: bold;
72
+ padding: 0;
73
+ margin: 15px 0;
74
+ font-size: 1.4em;
75
+ }
76
+
77
  #mc_embed_signup input {
78
+ border: 1px solid #e5e5e5;
79
+ -webkit-appearance: none;
80
  }
81
+
82
  #mc_embed_signup input[type=checkbox] {
83
+ -webkit-appearance: checkbox;
84
  }
85
+
86
  #mc_embed_signup input[type=radio] {
87
+ -webkit-appearance: radio;
88
  }
89
+
90
  #mc_embed_signup input:focus {
91
+ border-color: #333;
92
  }
93
+
94
  #mc_embed_signup .button {
95
+ clear: both;
96
+ background-color: #aaa;
97
+ border: 0 none;
98
+ border-radius: 4px;
99
+ color: #FFF;
100
+ cursor: pointer;
101
+ display: inline-block;
102
+ font-size: 16px;
103
+ height: 34px;
104
+ line-height: 34px;
105
+ margin: 0 5px 10px 0;
106
+ padding: 0;
107
+ text-align: center;
108
+ text-decoration: none;
109
+ vertical-align: top;
110
+ white-space: nowrap;
111
+ width: auto;
112
+ }
113
+
114
  #mc_embed_signup .button:hover {
115
+ background-color: #777;
116
  }
117
+
118
  #mc_embed_signup .small-meta {
119
+ font-size: 11px;
120
+ }
121
+
122
  #mc_embed_signup .nowrap {
123
+ white-space: nowrap;
124
+ }
125
+
126
  #mc_embed_signup label {
127
+ display: block;
128
+ font-size: 14px;
129
+ padding-bottom: 10px;
130
+ font-weight: bold;
131
+ color: #464646
132
+ }
133
+
134
  #mc_embed_signup input.email {
135
+ display: block;
136
+ padding: 8px 0;
137
+ margin: 0 0 10px 0;
138
+ text-indent: 5px;
139
+ width: 62%;
140
+ min-width: 130px;
141
+ float: left;
142
+ }
143
+
144
  #mc_embed_signup input.button {
145
+ display: block;
146
+ clear: none;
147
+ background: #628C29;
148
+ width: 35%;
149
+ margin: 0 0 10px 0;
150
+ min-width: 90px;
151
+ float: right;
152
+ text-shadow: 0 1px 0 #666;
153
+ }
154
+
155
  #mc_embed_signup div#mce-responses {
156
+ float: left;
157
+ top: -1.4em;
158
+ padding: 0em .5em 0em .5em;
159
+ overflow: hidden;
160
+ width: 90%;
161
+ margin: 0 5%;
162
+ clear: both;
163
+ }
164
+
165
  #mc_embed_signup div.response {
166
+ margin: 1em 0;
167
+ padding: 1em .5em .5em 0;
168
+ font-weight: bold;
169
+ float: left;
170
+ top: -1.5em;
171
+ z-index: 1;
172
+ width: 80%;
173
+ }
174
+
175
  #mc_embed_signup #mce-error-response {
176
+ display: none;
177
+ }
178
+
179
  #mc_embed_signup #mce-success-response {
180
+ color: #529214;
181
+ display: none;
182
+ }
183
+
184
  #mc_embed_signup label.error {
185
+ display: block;
186
+ float: none;
187
+ width: auto;
188
+ margin-left: 1.05em;
189
+ text-align: left;
190
+ padding: .5em 0;
191
+ }
192
+
193
+ /**
194
+ * Spread the Word styles & Support metabox styles
195
+ */
196
+ .ivycat-rating {
197
+ display: inline;
198
+ color: #ffb900;
199
+ }
200
+
201
+ .ivycat-rating .dashicons {
202
+ width: 16px;
203
+ height: 16px;
204
+ font-size: 16px;
205
+ }
206
+
207
+ /**
208
+ IvyCat metabox styles
209
+ */
210
+ .signature .inside {
211
+ text-align: center;
212
+ }
213
+
214
+ .signature img {
215
+ margin-left: -.95em;
216
+ margin-right: .5em;
217
+ }
admin/assets/images/email.png DELETED
Binary file
admin/assets/images/facebook.png DELETED
Binary file
admin/assets/images/feed.png DELETED
Binary file
admin/assets/images/ic-logo.jpg DELETED
Binary file
admin/assets/images/ivycat-sq.png ADDED
Binary file
admin/assets/images/linkedin.png DELETED
Binary file
admin/assets/images/twitter.png DELETED
Binary file
admin/assets/js/post-page_scripts.js CHANGED
@@ -1,10 +1,10 @@
1
- jQuery( 'document' ).ready( function( $ ){
2
- $( '#posts-in-page-settings .top-menu li a' ).click( function(){
3
- var toshow = $( this ).attr( 'href' ).replace( '#', '' );
4
- $( '.top-menu li' ).removeClass( 'current-menu-tab' );
5
- $( this ).parent( 'li' ).addClass( 'current-menu-tab' );
6
- $( '.group' ).hide().removeClass( 'current-tab' );
7
- $( '.' + toshow ).show().addClass( 'current-tab' );
8
- return false;
9
- } );
10
  });
1
+ jQuery('document').ready(function ($) {
2
+ $('#posts-in-page-settings .top-menu li a').click(function () {
3
+ var toshow = $(this).attr('href').replace('#', '');
4
+ $('.top-menu li').removeClass('current-menu-tab');
5
+ $(this).parent('li').addClass('current-menu-tab');
6
+ $('.group').hide().removeClass('current-tab');
7
+ $('.' + toshow).show().addClass('current-tab');
8
+ return false;
9
+ });
10
  });
admin/views/help-main.php CHANGED
@@ -1,285 +1,346 @@
1
  <?php
2
  /**
3
- * @package Posts_in_Page
4
- * @author Eric Amundson <eric@ivycat.com>
5
- * @copyright Copyright (c) 2017, IvyCat, Inc.
6
- * @license http://www.gnu.org/licenses/gpl-2.0.html
7
  *
8
- */
 
 
 
 
 
 
9
  ?>
10
 
11
  <div class="wrap">
12
 
13
- <div id="icon-options-general" class="icon32"></div>
14
- <h1><?php esc_attr_e( 'Posts in Page', 'wp_admin_style' ); ?></h1>
15
-
16
- <div id="poststuff">
17
-
18
- <div id="post-body" class="metabox-holder columns-2">
19
-
20
- <!-- main content -->
21
- <div id="post-body-content">
22
-
23
- <div class="meta-box-sortables ui-sortable">
24
-
25
- <div class="postbox">
26
-
27
- <div class="handlediv" title="Click to toggle"><br></div>
28
- <!-- Toggle -->
29
-
30
- <h2 class="hndle"><span><?php esc_attr_e( 'How to use Posts in Page', 'wp_admin_style' ); ?></span>
31
- </h2>
32
-
33
- <div class="inside">
34
-
35
- <p>To 'pull' posts into a page, you can either:</p>
36
-
37
- <ol>
38
- <li><a href="#place-a-shortcode-wordpress-editor">Place a shortcode in the WordPress editor</a>, or </li>
39
- <li><a href="#embed-php-function-wordpress-editor">Embed a PHP function in a theme template file</a></li>
40
- </ol>
41
-
42
- <h4 name="place-a-shortcode-wordpress-editor" id="place-a-shortcode-wordpress-editor">Place a Shortcode in the WordPress Editor</h4>
43
-
44
- <table class="widefat">
45
- <thead>
46
- <tr>
47
- <th>Task</th>
48
- <th>Shortcode</th>
49
- <th>Notes</th>
50
- </tr>
51
- </thead>
52
- <tfoot>
53
- <tr>
54
- <th>Task</th>
55
- <th>Shortcode</th>
56
- <th>Notes</th>
57
- </tr>
58
- </tfoot>
59
- <tbody>
60
- <tr>
61
- <td>Add all posts</td>
62
- <td><code>[ic_add_posts]</code></td>
63
- <td><?php _e( 'Add all posts to a page (limit to what number posts in WordPress is set to), essentially adds blog "page" to page.', 'posts-in-page' ); ?></td>
64
- </tr>
65
- <tr>
66
- <td>Show posts by ID</td>
67
- <td><code>[ic_add_posts ids='1,2,3']</code></td>
68
- <td><?php _e( 'show one or many posts by specifying the post ID(s) ( specify all post types )', 'posts-in-page' ); ?></td>
69
- </tr>
70
- <tr>
71
- <td>Show posts by Post Type</td>
72
- <td><code>[ic_add_posts post_type='post_type']</code></td>
73
- <td><?php _e( 'show posts from a custom post type by specifying the post type slug ( must give post type if not a standard post ) add multiple post types by separating with commas (ex.', 'posts-in-page' ); ?> <code>post_type='post_type1,post_type2'</code>)</td>
74
- </tr>
75
- <tr>
76
- <td>Show specific number of posts</td>
77
- <td><code>[ic_add_posts showposts='5']</code></td>
78
- <td><?php _e( 'limit number of posts (or override default setting)', 'posts-in-page' ); ?></td>
79
- </tr>
80
- <tr>
81
- <td>Change post order </td>
82
- <td><code>[ic_add_posts orderby='title' order='ASC']</code></td>
83
- <td><?php _e( 'orderby title - supports all WP orderby variables. Order is optional, WP default', 'posts-in-page' ); ?></td>
84
- </tr>
85
- <tr>
86
- <td>Specify categories</td>
87
- <td><code>[ic_add_posts category='category-slug']</code></td>
88
- <td><?php _e( 'Show posts within a specific category. Uses slugs, can have multiple but separate by commas. category-1,category2, etc (no spaces.)', 'posts-in-page' ); ?></td>
89
- </tr>
90
- <tr>
91
- <td>Specify tags</td>
92
- <td><code>[ic_add_posts tag='tag-slug']</code></td>
93
- <td><?php _e( 'Show posts using a specific tag. Like categories, it uses slugs, and can accommodate multiple tags separate by commas. tag-1,tag-2, etc (no spaces.)', 'posts-in-page' ); ?></td>
94
- </tr>
95
- <tr>
96
- <td>Specify custom taxonomy</td>
97
- <td><code>[ic_add_posts tax='taxonomy' term='term']</code></td>
98
- <td><?php _e( 'limit posts to those that exist in a taxonomy and have a specific term. Both are required for either one to work', 'posts-in-page' ); ?></td>
99
- </tr>
100
- <tr>
101
- <td>Change output template</td>
102
- <td><code>[ic_add_posts template='template-in-theme-dir.php']</code></td>
103
- <td><?php _e( 'In case you want to style your markup, add meta data, etc. Each shortcode can reference a different template. These templates must exist in the theme directory.', 'posts-in-page' ); ?></td>
104
- </tr>
105
- <tr>
106
- <td>Sticky posts</td>
107
- <td><code>[ic_add_posts ignore_sticky_posts='no']</code></td>
108
- <td><?php _e( "Show sticky posts too (they're ignored by default)", 'posts-in-page' ); ?></td>
109
- </tr>
110
- <tr>
111
- <td>Post status</td>
112
- <td><code>[ic_add_posts post_status='private']</code></td>
113
- <td><?php _e( "Show posts with the specified status(es); the default is to only show posts with status 'publish'. To choose more than one status, separate them with commas. For example: <code>post_status='private,publish'</code>.", 'posts-in-page' ); ?></td>
114
- </tr>
115
- <tr>
116
- <td>Pagination</td>
117
- <td><code>[ic_add_posts paginate='yes']</code></td>
118
- <td><?php _e( 'use pagination links (off by default)', 'posts-in-page' ); ?></td>
119
- </tr>
120
- <tr>
121
- <td>Post offset</td>
122
- <td><code>[ic_add_posts offset='3']</code></td>
123
- <td><?php _e( 'Display posts from the 4th one', 'posts-in-page' ); ?></td>
124
- </tr>
125
- <tr>
126
- <td>Dates</td>
127
- <td><code>[ic_add_posts Date='today']</code></td>
128
- <td><?php _e( "Show's post associated (published) on specified date period, today, 'today-1' show's posts published yesterday, 'today-2' shows posts published two days ago, etc. Also 'week(-n)' shows posts n weeks ago. Also available 'month(-n)' and 'year(-n)'", 'posts-in-page' ); ?></td>
129
- </tr>
130
- <tr>
131
- <td>Post IDs</td>
132
- <td><code>[ic_add_posts exclude_ids='25,15']</code></td>
133
- <td><?php _e( 'exclude by post ID one or more.', 'posts-in-page' ); ?></td>
134
- </tr>
135
- <tr>
136
- <td>Custom error message</td>
137
- <td><code>[ic_add_posts none_found='No Posts Found']</code></td>
138
- <td><?php _e( 'Custom message to display if no posts are found', 'posts-in-page' ); ?></td>
139
- </tbody>
140
- </table>
141
- <p><?php _e( 'Or any combination of the above.', 'posts-in-page' ); ?></p>
142
-
143
- <h4 name="embed-php-function-wordpress-editor" id="embed-php-function-wordpress-editor"><?php _e( 'Embed a PHP function in a theme template file', 'posts-in-page' ); ?></h4>
144
-
145
- <p><?php _e( 'If you\'d like to use this plugin to pull posts directly into your theme\'s template files, you can drop the following WordPress function in your template files, replacing the <code>[shortcode]</code> part with your, custom shortcode.', 'posts-in-page' ); ?></p>
146
-
147
- <pre><code>&lt;?php echo do_shortcode("[shortcode]"); ?&gt;</code></pre>
148
- </div>
149
- <!-- .inside -->
150
-
151
- </div>
152
- <!-- .postbox -->
153
-
154
- </div>
155
- <!-- .meta-box-sortables .ui-sortable -->
156
-
157
- </div>
158
- <!-- post-body-content -->
159
-
160
- <!-- sidebar -->
161
- <div id="postbox-container-1" class="postbox-container">
162
-
163
- <div class="meta-box-sortables">
164
-
165
- <div class="postbox">
166
-
167
- <div class="handlediv" title="Click to toggle"><br></div>
168
- <!-- Toggle -->
169
-
170
- <h2 class="hndle"><span><?php esc_attr_e(
171
- 'Help & Support', 'wp_admin_style'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  ); ?></span></h2>
173
 
174
- <div class="inside">
175
- <div class="meta-box-sortables" style="min-height: 0">
176
- <div id="ivycat_donate">
177
- <div class="inside_wrap">
178
- <h4>Questions, bugs, or great ideas?</h4>
179
- <ul>
180
- <li><a href="https://wordpress.org/support/plugin/posts-in-page">Visit our plugin support page</a> or</li>
181
- <li><a href="https://github.com/ivycat/Posts-in-Page">Contribute on Github</a></li>
182
- </div>
183
- </div>
184
- </div>
185
- </div>
186
- <!-- .inside -->
187
-
188
- </div>
189
- <!-- .postbox -->
190
- <div class="postbox">
191
-
192
- <div class="handlediv" title="Click to toggle"><br></div>
193
- <!-- Toggle -->
194
-
195
- <h2 class="hndle"><span><?php esc_attr_e(
 
 
 
 
196
  'Connect with IvyCat!', 'wp_admin_style'
197
  ); ?></span></h2>
198
 
199
- <div class="inside">
200
- <div class="inside_wrap">
201
- <!-- Begin MailChimp Signup Form -->
202
- <div id="mc_embed_signup" class="clearfix">
203
- <form action="//ivycat.us1.list-manage.com/subscribe/post?u=599f2f6b712f346e11c2930d4&amp;id=6ee02404ab" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
204
- <label for="mce-EMAIL">Signup for email updates</label>
205
- <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
206
- <input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
207
- </form>
208
- </div>
209
- <!--End mc_embed_signup-->
210
-
211
- <hr />
212
-
213
- <ul class="ivy_social clearfix">
214
- <li class="ic_fb"><a href="https://www.facebook.com/ivycatweb">Facebook</a></li>
215
- <li class="ic_tw"><a href="https://twitter.com/ivycatweb">Twitter</a></li>
216
- <li class="ic_li"><a href="https://www.linkedin.com/company/ivycat-web-services">LinkedIn</a></li>
217
- <li class="ic_rss"><a href="https://ivycat.com/feed">RSS Feed</a></li>
218
- <li class="ic_mc"><!-- // MAILCHIMP SUBSCRIBE CODE \\ --><a href="http://eepurl.com/b3_65" target="_blank">Sign up for our free newsletter!</a><!-- \\ MAILCHIMP SUBSCRIBE CODE // --></li>
219
- </ul>
220
-
221
- </div>
222
- </div>
223
- <!-- .inside -->
224
-
225
- </div>
226
- <!-- .postbox -->
227
-
228
- <div class="postbox">
229
-
230
- <div class="handlediv" title="Click to toggle"><br></div>
231
- <!-- Toggle -->
232
-
233
- <h2 class="hndle"><span><?php esc_attr_e(
234
- 'Contribute', 'wp_admin_style'
 
 
 
 
 
 
 
 
 
 
 
 
235
  ); ?></span></h2>
236
 
237
- <div class="inside">
238
- <div class="inside_wrap">
239
- <h4>Help make this plugin better</h4>
240
- <ul>
241
- <li><a href="https://wordpress.org/plugins/posts-in-page/">Rate Posts in Page on WordPress.org</a></li>
242
- <li><a href="https://twitter.com/home/?status=Check%20out%20the%20Posts%20in%20Page%20WordPress%20plugin%20from%20IvyCat!%20http%3A%2F%2Fbit.ly%2F1bmI8pS">Tweet about Posts in Page</a></li>
243
- </ul>
244
- </div>
245
- </div>
246
- <!-- .inside -->
247
-
248
- </div>
249
- <!-- .postbox -->
250
- <div class="postbox">
251
-
252
- <div class="handlediv" title="Click to toggle"><br></div>
253
- <!-- Toggle -->
254
-
255
- <h2 class="hndle"><span><?php esc_attr_e(
256
- 'IvyCat Services', 'wp_admin_style'
 
 
 
 
 
 
 
 
 
257
  ); ?></span></h2>
258
 
259
- <div class="inside">
260
- <div class="inside_wrap">
261
- <h4><a href="https://ivycat.com/contact/">Contact us</a> if you need:</h4>
262
- <ul class="link-list">
263
- <li><a href="https://ivycat.com/wordpress/wordpress-support-maintenance/">WordPress Maintenance &amp; Support</a></li>
264
- <li><a href="http://ivycat.com/web-design/">Web Design &amp; Development</a></li>
265
- </ul>
266
- </div>
267
- </div>
268
- <!-- .inside -->
269
-
270
- </div>
271
- <!-- .postbox -->
272
- </div>
273
- <!-- .meta-box-sortables -->
274
-
275
- </div>
276
- <!-- #postbox-container-1 .postbox-container -->
277
-
278
- </div>
279
- <!-- #post-body .metabox-holder .columns-2 -->
280
-
281
- <br class="clear">
282
- </div>
283
- <!-- #poststuff -->
 
 
 
 
284
 
285
  </div> <!-- .wrap -->
1
  <?php
2
  /**
3
+ * Main admin help screen located at: Settings > Posts in Page.
 
 
 
4
  *
5
+ * @package Posts_in_Page
6
+ * @author Eric Amundson <eric@ivycat.com>
7
+ * @copyright Copyright (c) 2019, IvyCat, Inc.
8
+ * @link https://ivycat.com
9
+ * @since 1.0.0
10
+ * @license GPL-2.0+
11
+ */
12
  ?>
13
 
14
  <div class="wrap">
15
 
16
+ <div id="icon-options-general" class="icon32"></div>
17
+ <h1><?php esc_attr_e( 'Posts in Page', 'wp_admin_style' ); ?></h1>
18
+
19
+ <div id="poststuff">
20
+
21
+ <div id="post-body" class="metabox-holder columns-2">
22
+
23
+ <!-- main content -->
24
+ <div id="post-body-content">
25
+
26
+ <div class="meta-box-sortables ui-sortable">
27
+
28
+ <div class="postbox">
29
+
30
+ <div class="handlediv" title="Click to toggle"><br></div>
31
+ <!-- Toggle -->
32
+
33
+ <h2 class="hndle">
34
+ <span><?php esc_attr_e( 'How to use Posts in Page', 'wp_admin_style' ); ?></span>
35
+ </h2>
36
+
37
+ <div class="inside">
38
+
39
+ <p>To 'pull' posts into a page, you can either:</p>
40
+
41
+ <ol>
42
+ <li><a href="#place-a-shortcode-wordpress-editor">Place a shortcode in the WordPress
43
+ editor</a>, or
44
+ </li>
45
+ <li><a href="#embed-php-function-wordpress-editor">Embed a PHP function in a theme
46
+ template file</a></li>
47
+ </ol>
48
+
49
+ <h4 name="place-a-shortcode-wordpress-editor" id="place-a-shortcode-wordpress-editor">Place
50
+ a Shortcode in the WordPress Editor</h4>
51
+
52
+ <table class="widefat">
53
+ <thead>
54
+ <tr>
55
+ <th>Task</th>
56
+ <th>Shortcode</th>
57
+ <th>Notes</th>
58
+ </tr>
59
+ </thead>
60
+ <tfoot>
61
+ <tr>
62
+ <th>Task</th>
63
+ <th>Shortcode</th>
64
+ <th>Notes</th>
65
+ </tr>
66
+ </tfoot>
67
+ <tbody>
68
+ <tr>
69
+ <td>Add all posts</td>
70
+ <td><code>[ic_add_posts]</code></td>
71
+ <td><?php _e( 'Add all posts to a page (limit to what number posts in WordPress is set to), essentially adds blog "page" to page.', 'posts-in-page' ); ?></td>
72
+ </tr>
73
+ <tr>
74
+ <td>Show posts by Post Type</td>
75
+ <td><code>[ic_add_posts post_type='post_type']</code></td>
76
+ <td><?php _e( 'Show posts from a custom post type by specifying the post type slug ( must give post type if not a standard post ) add multiple post types by separating with commas (ex.', 'posts-in-page' ); ?>
77
+ <code>post_type='post_type1,post_type2'</code>)
78
+ </td>
79
+ </tr>
80
+ <tr>
81
+ <td>Show specific number of posts</td>
82
+ <td><code>[ic_add_posts showposts='5']</code></td>
83
+ <td><?php _e( 'Limit number of posts (or override default setting)', 'posts-in-page' ); ?></td>
84
+ </tr>
85
+ <tr>
86
+ <td>Change post order</td>
87
+ <td><code>[ic_add_posts orderby='title' order='ASC']</code></td>
88
+ <td><?php _e( 'orderby title - supports all WP orderby variables. Order is optional, WP default', 'posts-in-page' ); ?></td>
89
+ </tr>
90
+ <tr>
91
+ <td>Show posts by ID</td>
92
+ <td><code>[ic_add_posts ids='1,2,3']</code></td>
93
+ <td><?php _e( 'Show one or many posts by specifying the post ID(s) ( specify all post types )', 'posts-in-page' ); ?></td>
94
+ </tr>
95
+ <tr>
96
+ <td>Exclude posts by ID</td>
97
+ <td><code>[ic_add_posts exclude_ids='4,5,6']</code></td>
98
+ <td><?php _e( 'Exclude one or more posts by specifying the post ID(s) ( specify all post types )', 'posts-in-page' ); ?></td>
99
+ </tr>
100
+ <tr>
101
+ <td>Include posts from specific categories</td>
102
+ <td><code>[ic_add_posts category='category-slug']</code></td>
103
+ <td><?php _e( 'Show posts within a specific category. Uses slugs, can have multiple but separate by commas. category-1,category2, etc (no spaces.)', 'posts-in-page' ); ?></td>
104
+ </tr>
105
+ <tr>
106
+ <td>Exclude posts from specific categories</td>
107
+ <td><code>[ic_add_posts exclude_category='category-slug']</code></td>
108
+ <td><?php _e( 'Show posts within a specific category. Uses slugs, can have multiple but separate by commas. category-1,category2, etc (no spaces.)', 'posts-in-page' ); ?></td>
109
+ </tr>
110
+ <tr>
111
+ <td>Specify tags</td>
112
+ <td><code>[ic_add_posts tag='tag-slug']</code></td>
113
+ <td><?php _e( 'Show posts using a specific tag. Like categories, it uses slugs, and can accommodate multiple tags separate by commas. tag-1,tag-2, etc (no spaces.)', 'posts-in-page' ); ?></td>
114
+ </tr>
115
+ <tr>
116
+ <td>Specify custom taxonomy</td>
117
+ <td><code>[ic_add_posts tax='taxonomy' term='term']</code></td>
118
+ <td><?php _e( 'Limit posts to those that exist in a taxonomy and have a specific term. Both are required for either one to work', 'posts-in-page' ); ?></td>
119
+ </tr>
120
+ <tr>
121
+ <td>Change output template</td>
122
+ <td><code>[ic_add_posts template='template-in-theme-dir.php']</code></td>
123
+ <td><?php _e( 'In case you want to style your markup, add meta data, etc. Each shortcode can reference a different template. These templates must exist in the theme directory or in a subfolder named posts-in-page.', 'posts-in-page' ); ?></td>
124
+ </tr>
125
+ <tr>
126
+ <td>Sticky posts</td>
127
+ <td><code>[ic_add_posts ignore_sticky_posts='no']</code></td>
128
+ <td><?php _e( "Show sticky posts too (they're ignored by default)", 'posts-in-page' ); ?></td>
129
+ </tr>
130
+ <tr>
131
+ <td>Pagination</td>
132
+ <td><code>[ic_add_posts paginate='yes']</code></td>
133
+ <td><?php _e( 'use pagination links (off by default)', 'posts-in-page' ); ?></td>
134
+ </tr>
135
+ <tr>
136
+ <td>Pagination - Post navigation links</td>
137
+ <td><code>[ic_add_posts label_next='Next' label_previous='Previous']</code></td>
138
+ <td><?php _e( 'Change the post navigation labels', 'posts-in-page' ); ?></td>
139
+ </tr>
140
+ <tr>
141
+ <td>Post status</td>
142
+ <td><code>[ic_add_posts post_status='private']</code></td>
143
+ <td><?php _e( "Show posts with the specified status(es); the default is to only show posts with status 'publish'. To choose more than one status, separate them with commas. For example: <code>post_status='private,publish'</code>.", 'posts-in-page' ); ?></td>
144
+ </tr>
145
+ <tr>
146
+ <td>Post offset</td>
147
+ <td><code>[ic_add_posts offset='3']</code></td>
148
+ <td><?php _e( 'Displays posts after the offset. An offset=\'3\' will show all posts from the 4th one onward.', 'posts-in-page' ); ?></td>
149
+ </tr>
150
+ <tr>
151
+ <td>Specific Dates</td>
152
+ <td><code>[ic_add_posts date='today']</code></td>
153
+ <td><?php _e( "Shows posts associated (published) on specified date period, today, 'today-1' show's posts published yesterday, 'today-2' shows posts published two days ago, etc. Also 'week(-n)' shows posts n weeks ago. Also available 'month(-n)' and 'year(-n)'", 'posts-in-page' ); ?></td>
154
+ </tr>
155
+ <tr>
156
+ <td>Date Ranges</td>
157
+ <td><code>[ic_add_posts from_date='15-01-2016' to_date='31-12-2016']</code></td>
158
+ <td><?php _e( 'Shows posts published within a specified absolute date range', 'posts-in-page' ); ?></td>
159
+ </tr>
160
+ <tr>
161
+ <td>Read more</td>
162
+ <td><code>[ic_add_posts more_tag='Read more...']</code></td>
163
+ <td><?php _e( 'Set the link text for read more links shown after an excerpt', 'posts-in-page' ); ?></td>
164
+ </tr>
165
+ <tr>
166
+ <td>Custom error message</td>
167
+ <td><code>[ic_add_posts none_found='No Posts Found']</code></td>
168
+ <td><?php _e( 'Custom message to display if no posts are found', 'posts-in-page' ); ?></td>
169
+ </tr>
170
+ </tbody>
171
+ </table>
172
+ <p><?php _e( 'Or any combination of the above.', 'posts-in-page' ); ?></p>
173
+
174
+ <h4 name="embed-php-function-wordpress-editor"
175
+ id="embed-php-function-wordpress-editor"><?php _e( 'Embed a PHP function in a theme template file', 'posts-in-page' ); ?></h4>
176
+
177
+ <p><?php _e( 'If you\'d like to use this plugin to pull posts directly into your theme\'s template files, you can drop the following WordPress function in your template files, replacing the <code>[shortcode]</code> part with your, custom shortcode.', 'posts-in-page' ); ?></p>
178
+
179
+ <pre><code>&lt;?php echo do_shortcode("[shortcode]"); ?&gt;</code></pre>
180
+ </div>
181
+ <!-- .inside -->
182
+
183
+ </div>
184
+ <!-- .postbox -->
185
+
186
+ </div>
187
+ <!-- .meta-box-sortables .ui-sortable -->
188
+
189
+ </div>
190
+ <!-- post-body-content -->
191
+
192
+ <!-- sidebar -->
193
+ <div id="postbox-container-1" class="postbox-container">
194
+
195
+ <div class="meta-box-sortables">
196
+
197
+ <div class="postbox help-contributing">
198
+
199
+ <div class="handlediv" title="Click to toggle"><br></div>
200
+ <!-- Toggle -->
201
+
202
+ <h2><span><?php esc_attr_e(
203
+ 'Help & Contributing', 'wp_admin_style'
204
  ); ?></span></h2>
205
 
206
+ <div class="inside">
207
+ <div class="meta-box-sortables" style="min-height: 0">
208
+ <div id="ivycat_contribute">
209
+ <div class="inside_wrap">
210
+ <h4>Questions, bugs, or great ideas? <span
211
+ class="dashicons dashicons-format-status"></span></h4>
212
+ <ul>
213
+ <li><a href="https://wordpress.org/support/plugin/posts-in-page"> Get help
214
+ on our plugin support page</a> or
215
+ </li>
216
+ <li><a href="https://github.com/ivycat/posts-in-page/"> Report bugs and
217
+ contribute on Github</a></li>
218
+ </div>
219
+ </div>
220
+ </div>
221
+ </div>
222
+ <!-- .inside -->
223
+
224
+ </div>
225
+ <!-- .postbox -->
226
+ <div class="postbox">
227
+
228
+ <div class="handlediv" title="Click to toggle"><br></div>
229
+ <!-- Toggle -->
230
+
231
+ <h2 class="hndle"><span><?php esc_attr_e(
232
  'Connect with IvyCat!', 'wp_admin_style'
233
  ); ?></span></h2>
234
 
235
+ <div class="inside">
236
+ <div class="inside_wrap">
237
+ <!-- Begin MailChimp Signup Form -->
238
+ <div id="mc_embed_signup" class="clearfix">
239
+ <form action="//ivycat.us1.list-manage.com/subscribe/post?u=599f2f6b712f346e11c2930d4&amp;id=6ee02404ab"
240
+ method="post" id="mc-embedded-subscribe-form"
241
+ name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
242
+ <label for="mce-EMAIL">Signup for email updates</label>
243
+ <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL"
244
+ placeholder="email address" required>
245
+ <input type="submit" value="Subscribe" name="subscribe"
246
+ id="mc-embedded-subscribe" class="button">
247
+ </form>
248
+ </div>
249
+ <!--End mc_embed_signup-->
250
+
251
+ <hr/>
252
+
253
+ <ul class="ivycat-social clearfix">
254
+ <li><a href="https://twitter.com/ivycatweb"><span
255
+ class="dashicons dashicons-twitter"></span> <span
256
+ class="screen-reader-text">Twitter</span></span></a></li>
257
+ <li><a href="https://www.facebook.com/ivycatweb"><span
258
+ class="dashicons dashicons-facebook"></span> <span
259
+ class="screen-reader-text">Facebook</span></a></li>
260
+ <li><a href="https://profiles.wordpress.org/ivycat"><span
261
+ class="dashicons dashicons-wordpress"></span> <span
262
+ class="screen-reader-text">WordPress.org</span></a></li>
263
+ <li class="ic_mc"><a href="http://eepurl.com/b3_65" target="_blank"><span
264
+ class="dashicons dashicons-email"></span> <span
265
+ class="screen-reader-text">Sign up for our free newsletter!</span></a>
266
+ </li>
267
+ </ul>
268
+
269
+ </div>
270
+ </div>
271
+ <!-- .inside -->
272
+
273
+ </div>
274
+ <!-- .postbox -->
275
+
276
+ <div class="postbox">
277
+
278
+ <div class="handlediv" title="Click to toggle"><br></div>
279
+ <!-- Toggle -->
280
+
281
+ <h2 class="hndle"><span><?php esc_attr_e(
282
+ 'Spread the word', 'wp_admin_style'
283
  ); ?></span></h2>
284
 
285
+ <div class="inside">
286
+ <div class="inside_wrap">
287
+ <h4>Help make this plugin better</h4>
288
+ <ul>
289
+ <li><a href="https://wordpress.org/support/plugin/posts-in-page/reviews/#new-post">Rate
290
+ <div class="ivycat-rating"><span
291
+ class="dashicons dashicons-star-filled"></span><span
292
+ class="dashicons dashicons-star-filled"></span><span
293
+ class="dashicons dashicons-star-filled"></span><span
294
+ class="dashicons dashicons-star-filled"></span><span
295
+ class="dashicons dashicons-star-filled"></span></div>
296
+ on WordPress.org</a></li>
297
+ <li>
298
+ <a href="https://twitter.com/home/?status=Check%20out%20the%20Posts%20in%20Page%20WordPress%20plugin%20from%20IvyCat!%20http%3A%2F%2Fbit.ly%2F1bmI8pS">Tweet
299
+ about Posts in Page</a></li>
300
+ </ul>
301
+ </div>
302
+ </div>
303
+ <!-- .inside -->
304
+
305
+ </div>
306
+ <!-- .postbox -->
307
+ <div class="postbox signature clearfix">
308
+
309
+ <div class="handlediv" title="Click to toggle"><br></div>
310
+ <!-- Toggle -->
311
+
312
+ <h2 class="hndle"><span><?php esc_attr_e(
313
+ 'IvyCat Web Services', 'wp_admin_style'
314
  ); ?></span></h2>
315
 
316
+ <div class="inside">
317
+ <div class="inside_wrap">
318
+ <img src="https://s.gravatar.com/avatar/f1c6ff76072edfd217215f3acd412c26?s=80?s=200"
319
+ class="ivycat-gravatar alignleft"/>
320
+ <div class="ivycat_text_wrap alignleft">
321
+ <ul class="link-list">
322
+ <li><a href="https://ivycat.com/wordpress/wordpress-support-maintenance/">WP
323
+ Maintenance & Support</a></li>
324
+ <li><a href="http://ivycat.com/web-design/">WordPress Development</a></li>
325
+ </ul>
326
+ </div>
327
+ </div>
328
+ </div>
329
+ <!-- .inside -->
330
+
331
+ </div>
332
+ <!-- .postbox -->
333
+ </div>
334
+ <!-- .meta-box-sortables -->
335
+
336
+ </div>
337
+ <!-- #postbox-container-1 .postbox-container -->
338
+
339
+ </div>
340
+ <!-- #post-body .metabox-holder .columns-2 -->
341
+
342
+ <br class="clear">
343
+ </div>
344
+ <!-- #poststuff -->
345
 
346
  </div> <!-- .wrap -->
includes/class-page-posts.php CHANGED
@@ -1,294 +1,395 @@
1
- <?php
2
- /**
3
- * Page Posts Class, main workhorse for the ic_add_posts shortcode.
4
- */
5
-
6
- if ( ! function_exists( 'add_action' ) ) {
7
- wp_die( 'You are trying to access this file in a manner not allowed.', 'Direct Access Forbidden', array( 'response' => '403' ) );
8
- }
9
-
10
- class ICPagePosts {
11
-
12
- protected $args = array();
13
-
14
- public function __construct( $atts ) {
15
- $this->set_default_args(); //set default args
16
- $this->set_args( $atts );
17
- }
18
-
19
- protected function set_default_args() {
20
- $this->args = array(
21
- 'post_type' => 'post',
22
- 'post_status' => 'publish',
23
- 'orderby' => 'date',
24
- 'order' => 'DESC',
25
- 'paginate' => false,
26
- 'template' => false,
27
- 'label_next' => __( 'Next', 'posts-in-page' ),
28
- 'label_previous' => __( 'Previous', 'posts-in-page' ),
29
- 'none_found' => '',
30
- );
31
- }
32
-
33
- /**
34
- * Output's the posts
35
- *
36
- * @return string output of template file
37
- */
38
- public function output_posts() {
39
- if ( ! $this->args ) {
40
- return '';
41
- }
42
- $page_posts = apply_filters( 'posts_in_page_results', new WP_Query( $this->args ) ); // New WP_Query object
43
- $output = '';
44
- if ( $page_posts->have_posts() ) {
45
- while ( $page_posts->have_posts() ):
46
- $output .= self::add_template_part( $page_posts );
47
- endwhile;
48
- $output .= ( $this->args['paginate'] ) ? '<div class="pip-nav">' . apply_filters( 'posts_in_page_paginate', $this->paginate_links( $page_posts ) ) . '</div>' : '';
49
- } else {
50
- $output = '<div class="post hentry ivycat-post"><span class="pip-not-found">' . esc_html( $this->args['none_found'] ) . '</span></div>';
51
- }
52
- wp_reset_postdata();
53
-
54
- remove_filter( 'excerpt_more', array( &$this, 'custom_excerpt_more' ) );
55
-
56
- return $output;
57
- }
58
-
59
- protected function paginate_links( $posts ) {
60
- global $wp_query;
61
- $page_url = home_url( '/' . $wp_query->post->post_name . '/' );
62
- $page = isset( $_GET['page'] ) ? $_GET['page'] : 1;
63
- $total_pages = $posts->max_num_pages;
64
- $per_page = $posts->query_vars['posts_per_page'];
65
- $curr_page = ( isset( $posts->query_vars['paged'] ) && $posts->query_vars['paged'] > 0 ) ? $posts->query_vars['paged'] : 1;
66
- $prev = ( $curr_page && $curr_page > 1 ) ? '<li><a href="' . $page_url . '?page=' . ( $curr_page - 1 ) . '">' . $this->args['label_previous'] . '</a></li>' : '';
67
- $next = ( $curr_page && $curr_page < $total_pages ) ? '<li><a href="' . $page_url . '?page=' . ( $curr_page + 1 ) . '">' . $this->args['label_next'] . '</a></li>' : '';
68
- return '<ul>' . $prev . $next . '</ul>';
69
- }
70
-
71
-
72
- /**
73
- * Build additional Arguments for the WP_Query object
74
- *
75
- * @param array $atts Attritubes for building the $args array.
76
- */
77
- protected function set_args( $atts ) {
78
- global $wp_query;
79
- $this->args['posts_per_page'] = get_option( 'posts_per_page' );
80
- // parse the arguments using the defaults
81
- $this->args = wp_parse_args( $atts, $this->args );
82
- // multiple post types are indicated, pass as an array
83
- if ( strpos( ',', $this->args['post_type'] ) ) {
84
- $post_types = explode( ',', $this->args['post_type'] );
85
- $this->args['post_type'] = $post_types;
86
- }
87
-
88
- // Show specific posts by ID
89
- if ( isset( $atts['ids'] ) ) {
90
- $post_ids = explode( ',', $atts['ids'] );
91
- $this->args['post__in'] = $post_ids;
92
- $this->args['posts_per_page'] = count( $post_ids );
93
- }
94
-
95
- // Use a specified template
96
- if ( isset( $atts['template'] ) ) {
97
- $this->args['template'] = $atts['template'];
98
- }
99
-
100
- // get posts in a certain category by name (slug)
101
- if ( isset( $atts['category'] ) ) {
102
- $this->args['category_name'] = $atts['category'];
103
- } elseif ( isset( $atts['cats'] ) ) {
104
- // get posts in a certain category by id
105
- $this->args['cat'] = $atts['cats'];
106
- }
107
-
108
- // Do a tax query, tax and term a required.
109
- if ( isset( $atts['tax'] ) ) {
110
- if ( isset( $atts['term'] ) ) {
111
- $terms = explode( ',', $atts['term'] );
112
- $this->args['tax_query'] = array(
113
- array( 'taxonomy' => $atts['tax'], 'field' => 'slug', 'terms' => ( count( $terms ) > 1 ) ? $terms : $atts['term'] )
114
- );
115
- }
116
- }
117
-
118
- // get posts with a certain tag
119
- if ( isset( $atts['tag'] ) ) {
120
- $this->args['tag'] = $atts['tag'];
121
- }
122
-
123
- // override default post_type argument ('publish')
124
- if ( isset( $atts['post_status'] ) ) {
125
- $this->args['post_status'] = $atts['post_status'];
126
- }
127
-
128
- // exclude posts with certain category by name (slug)
129
- if ( isset( $atts['exclude_category'] ) ) {
130
- $category = $atts['exclude_category'];
131
- if ( strpos( ',', $category ) ) {
132
- // multiple
133
- $category = explode( ',', $category );
134
-
135
- foreach ( $category AS $cat ) {
136
- $term = get_category_by_slug( $cat );
137
- $exclude[] = '-' . $term->term_id;
138
- }
139
- $category = implode( ',', $exclude );
140
-
141
- } else {
142
- // single
143
- $term = get_category_by_slug( $category );
144
- $category = '-' . $term->term_id;
145
- }
146
-
147
- if ( ! is_null( $this->args['cat'] ) ) {
148
- // merge lists
149
- $this->args['cat'] .= ',' . $category;
150
- }
151
- $this->args['cat'] = $category;
152
- // unset our unneeded variables
153
- unset( $category, $term, $exclude );
154
- }
155
-
156
- // show number of posts (default is 10, showposts or posts_per_page are both valid, only one is needed)
157
- if ( isset( $atts['showposts'] ) ) {
158
- $this->args['posts_per_page'] = $atts['showposts'];
159
- }
160
-
161
- // handle pagination (for code, template pagination is in the template)
162
- if ( isset( $wp_query->query_vars['page'] ) && $wp_query->query_vars['page'] > 1 ) {
163
- $this->args['paged'] = $wp_query->query_vars['page'];
164
- }
165
-
166
- if ( ! ( isset( $this->args['ignore_sticky_posts'] ) &&
167
- ( strtolower( $this->args['ignore_sticky_posts'] ) === 'no' ||
168
- strtolower( $this->args['ignore_sticky_posts'] ) === 'false' ) ) ) {
169
-
170
- $this->args['post__not_in'] = get_option( 'sticky_posts' );
171
- }
172
-
173
- $this->args['ignore_sticky_posts'] = isset( $this->args['ignore_sticky_posts'] ) ? $this->shortcode_bool( $this->args['ignore_sticky_posts'] ) : true;
174
-
175
- if ( isset( $this->args['more_tag'] ) ) {
176
- add_filter( 'excerpt_more', array( &$this, 'custom_excerpt_more' ), 1 );
177
- }
178
-
179
- if ( isset( $atts['exclude_ids'] ) ) {
180
- $exclude_posts = explode( ',', $atts['exclude_ids'] );
181
- if ( isset( $this->args['post__not_in'] ) ) {
182
- $this->args['post__not_in'] = array_merge( $this->args['post__not_in'], $exclude_posts );
183
- } else {
184
- $this->args['post__not_in'] = $exclude_posts;
185
- }
186
- }
187
-
188
- $current_time_value = current_time( 'timestamp' );
189
- if ( isset( $atts['date'] ) ) {
190
- $date_data = explode( '-', $atts['date'] );
191
- if ( ! isset( $date_data[1] ) ) {
192
- $date_data[1] = 0;
193
- }
194
- switch ( $date_data[0] ) {
195
- case 'today':
196
- $today = getdate( $current_time_value - ( $date_data[1] * DAY_IN_SECONDS ) );
197
- $this->args['date_query'] = array(
198
- 'year' => $today['year'],
199
- 'month' => $today['mon'],
200
- 'day' => $today['mday'],
201
- );
202
- break;
203
- case 'week':
204
- $week = date( 'W', $current_time_value - $date_data[1] * WEEK_IN_SECONDS );
205
- $year = date( 'Y', $current_time_value - $date_data[1] * WEEK_IN_SECONDS );
206
- $this->args['date_query'] = array(
207
- 'year' => $year,
208
- 'week' => $week,
209
- );
210
- break;
211
- case 'month':
212
- $month = date( 'm', strtotime( ( strval( - $date_data[1] ) . ' Months' ), $current_time_value ) );
213
- $year = date( 'Y', strtotime( ( strval( - $date_data[1] ) . ' Months' ), $current_time_value ) );
214
- $this->args['date_query'] = array(
215
- 'monthnum' => $month,
216
- 'year' => $year,
217
- );
218
- break;
219
- case 'year':
220
- $year = date( 'Y', strtotime( ( strval( - $date_data[1] ) . ' Years' ), $current_time_value ) );
221
- $this->args['date_query'] = array(
222
- 'year' => $year,
223
- );
224
- break;
225
- }
226
- }
227
- $this->args = apply_filters( 'posts_in_page_args', $this->args );
228
- }
229
-
230
- /**
231
- * Sets a shortcode boolean value to a real boolean
232
- *
233
- * @return bool
234
- */
235
- public function shortcode_bool( $var ) {
236
- $falsey = array( 'false', '0', 'no', 'n' );
237
- return ( ! $var || in_array( strtolower( $var ), $falsey ) ) ? false : true;
238
- }
239
-
240
- /**
241
- * Tests if a theme has a theme template file that exists
242
- *
243
- * @return string|true if template exists, false otherwise.
244
- */
245
- protected function has_theme_template() {
246
-
247
- if ( ! empty( $this->args['template'] ) ) {
248
-
249
- $template_file = get_stylesheet_directory() . '/' . $this->args['template'];
250
-
251
- // check for traversal attack by getting the basename without the path and reassembling. If it looks wrong, go with the default
252
-
253
- $path_parts = pathinfo( $template_file );
254
-
255
- if ( $template_file != get_stylesheet_directory() . '/' . $path_parts['filename'] . '.' . $path_parts['extension'] ) {
256
-
257
- $template_file = get_stylesheet_directory() . '/posts_loop_template.php';
258
-
259
- }
260
- } else {
261
- $template_file = get_stylesheet_directory() . '/posts_loop_template.php'; // use default template file
262
- }
263
-
264
- return ( file_exists( $template_file ) ) ? $template_file : false;
265
- }
266
-
267
- /**
268
- * Retrieves the post loop template and returns the output
269
- *
270
- * @return string results of the output
271
- */
272
- protected function add_template_part( $ic_posts, $singles = false ) {
273
- if ( $singles ) {
274
- setup_postdata( $ic_posts );
275
- } else {
276
- $ic_posts->the_post();
277
- }
278
- $output = '';
279
- ob_start();
280
- $output .= apply_filters( 'posts_in_page_pre_loop', '' );
281
- require ( $file_path = self::has_theme_template() )
282
- ? $file_path // use template file in theme
283
- : POSTSPAGE_DIR . '/posts_loop_template.php'; // use default plugin template file
284
- $output .= ob_get_contents();
285
- $output .= apply_filters( 'posts_in_page_post_loop', '' );
286
- return ob_get_clean();
287
- }
288
-
289
- public function custom_excerpt_more( $more ) {
290
- $more_tag = $this->args['more_tag'];
291
- return ' <a class="read-more" href="' . get_permalink( get_the_ID() ) . '">' . $more_tag . '</a>';
292
- }
293
-
294
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Page posts class, the main workhorse for the ic_add_posts shortcode.
4
+ *
5
+ * @package Posts_in_Page
6
+ * @author Eric Amundson <eric@ivycat.com>
7
+ * @copyright Copyright (c) 2019, IvyCat, Inc.
8
+ * @link https://ivycat.com
9
+ * @since 1.0.0
10
+ * @license GPL-2.0+
11
+ */
12
+
13
+ if ( ! function_exists( 'add_action' ) ) {
14
+ wp_die( 'You are trying to access this file in a manner not allowed.', 'Direct Access Forbidden', array( 'response' => '403' ) );
15
+ }
16
+
17
+ class ICPagePosts {
18
+
19
+ protected $args = array();
20
+
21
+ public function __construct( $atts ) {
22
+ $this->set_default_args(); //set default args
23
+ $this->set_args( $atts );
24
+ }
25
+
26
+ protected function set_default_args() {
27
+ $this->args = array(
28
+ 'post_type' => 'post',
29
+ 'post_status' => 'publish',
30
+ 'orderby' => 'date',
31
+ 'order' => 'DESC',
32
+ 'paginate' => false,
33
+ 'template' => false,
34
+ 'label_next' => __( 'Next', 'posts-in-page' ),
35
+ 'label_previous' => __( 'Previous', 'posts-in-page' ),
36
+ 'date_query' => '',
37
+ 'none_found' => '',
38
+ 'paged' => false,
39
+ );
40
+ }
41
+
42
+ protected function get_paged_query_var() {
43
+ if ( get_query_var( 'paged' ) ) {
44
+ $paged = get_query_var( 'paged' );
45
+ } elseif ( get_query_var( 'page' ) ) {
46
+ $paged = get_query_var( 'page' );
47
+ } else {
48
+ $paged = 1;
49
+ }
50
+
51
+ return $paged;
52
+ }
53
+ /**
54
+ * Spits out the posts, in a gentlemanly way
55
+ *
56
+ * @return string output of template file
57
+ */
58
+ public function output_posts() {
59
+ if ( ! $this->args ) {
60
+ return '';
61
+ }
62
+ if ( $this->args['paginate'] ) {
63
+ $this->get_paged_query_var();
64
+ $this->args['paged'] = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
65
+ }
66
+ // commandeering wp_query for pagination quirkiness
67
+ global $wp_query;
68
+ $temp = $wp_query;
69
+ $wp_query = null;
70
+ $wp_query = apply_filters( 'posts_in_page_results', new WP_Query( $this->args ) ); // New WP_Query object
71
+
72
+ $output = '';
73
+ if ( have_posts() ) {
74
+ while ( have_posts() ):
75
+ $output .= self::add_template_part( $wp_query );
76
+ endwhile;
77
+
78
+ if ( $this->args['paginate'] ) {
79
+ $output .= apply_filters( 'posts_in_page_paginate', $this->paginate_links() );
80
+ }
81
+ } else {
82
+ $output = '<div class="post hentry ivycat-post"><span class="pip-not-found">' . esc_html( $this->args['none_found'] ) . '</span></div>';
83
+ }
84
+
85
+ // restore wp_query
86
+ $wp_query = null;
87
+ $wp_query = $temp;
88
+ wp_reset_query();
89
+ remove_filter( 'excerpt_more', array( &$this, 'custom_excerpt_more' ) );
90
+
91
+ return $output;
92
+ }
93
+
94
+
95
+ protected function paginate_links() {
96
+
97
+ $prev = get_previous_posts_link( $this->args['label_previous'] );
98
+ $next = get_next_posts_link( $this->args['label_next'] );
99
+
100
+ if ( $prev || $next ) {
101
+ $prev_link = $prev ? "<li class='pip-nav-prev'>$prev</li>" : '';
102
+ $next_link = $next ? "<li class='pip-nav-next'>$next</li>" : '';
103
+
104
+ return "<ul class='pip-nav'>$prev_link $next_link</ul>";
105
+ }
106
+
107
+ return '';
108
+
109
+ }
110
+
111
+
112
+ /**
113
+ * Build additional Arguments for the WP_Query object
114
+ *
115
+ * @param array $atts Attributes for building the $args array.
116
+ */
117
+ protected function set_args( $atts ) {
118
+ global $wp_query;
119
+ $this->args['posts_per_page'] = get_option( 'posts_per_page' );
120
+ // parse the arguments using the defaults
121
+ $this->args = wp_parse_args( $atts, $this->args );
122
+ // multiple post types are indicated, pass as an array
123
+ if ( strpos( $this->args['post_type'], ',' ) ) {
124
+ $post_types = explode( ',', $this->args['post_type'] );
125
+ $this->args['post_type'] = $post_types;
126
+ }
127
+
128
+ // Show specific posts by ID
129
+ if ( isset( $atts['ids'] ) ) {
130
+ $post_ids = explode( ',', $atts['ids'] );
131
+ $this->args['post__in'] = $post_ids;
132
+ $this->args['posts_per_page'] = count( $post_ids );
133
+ }
134
+
135
+ // Use a specified template
136
+ if ( isset( $atts['template'] ) ) {
137
+ $this->args['template'] = $atts['template'];
138
+ }
139
+
140
+ // get posts in a certain category by name (slug)
141
+ if ( isset( $atts['category'] ) ) {
142
+ $this->args['category_name'] = $atts['category'];
143
+ } elseif ( isset( $atts['cats'] ) ) {
144
+ // get posts in a certain category by id
145
+ $this->args['cat'] = $atts['cats'];
146
+ }
147
+
148
+ // Do a tax query, tax and term a required.
149
+ if ( isset( $atts['tax'] ) ) {
150
+ if ( isset( $atts['term'] ) ) {
151
+ $terms = explode( ',', $atts['term'] );
152
+ $this->args['tax_query'] = array(
153
+ array(
154
+ 'taxonomy' => $atts['tax'],
155
+ 'field' => 'slug',
156
+ 'terms' => ( count( $terms ) > 1 ) ? $terms : $atts['term'],
157
+ )
158
+ );
159
+ }
160
+ }
161
+
162
+ // get posts with a certain tag
163
+ if ( isset( $atts['tag'] ) ) {
164
+ $this->args['tag'] = $atts['tag'];
165
+ }
166
+
167
+ // override default post_type argument ('publish')
168
+ if ( isset( $atts['post_status'] ) ) {
169
+ $this->args['post_status'] = $atts['post_status'];
170
+ }
171
+
172
+ // exclude posts with certain category by name (slug)
173
+ if ( isset( $atts['exclude_category'] ) ) {
174
+ $category = $atts['exclude_category'];
175
+ if ( strpos( $category, ',' ) ) {
176
+ // multiple
177
+ $category = explode( ',', $category );
178
+ foreach ( $category AS $cat ) {
179
+ $term = get_category_by_slug( $cat );
180
+ $exclude[] = '-' . $term->term_id;
181
+ }
182
+ $category = implode( ',', $exclude );
183
+ } else {
184
+ // single
185
+ $term = get_category_by_slug( $category );
186
+ $category = '-' . $term->term_id;
187
+ }
188
+ if ( isset( $this->args['cat'] ) && ! is_null( $this->args['cat'] ) ) {
189
+ // merge lists
190
+ $this->args['cat'] .= ',' . $category;
191
+ }
192
+ $this->args['cat'] = $category;
193
+ // unset our unneeded variables
194
+ unset( $category, $term, $exclude );
195
+ }
196
+
197
+ // show number of posts (default is 10, showposts or posts_per_page are both valid, only one is needed)
198
+ if ( isset( $atts['showposts'] ) ) {
199
+ $this->args['posts_per_page'] = $atts['showposts'];
200
+ }
201
+
202
+ // handle pagination (for code, template pagination is in the template)
203
+ if ( isset( $wp_query->query_vars['page'] ) && $wp_query->query_vars['page'] > 1 ) {
204
+ $this->args['paged'] = $wp_query->query_vars['page'];
205
+ }
206
+
207
+ if ( ! ( isset( $this->args['ignore_sticky_posts'] ) &&
208
+ ( 'no' === strtolower( $this->args['ignore_sticky_posts'] ) ||
209
+ 'false' === strtolower( $this->args['ignore_sticky_posts'] ) ) ) ) {
210
+
211
+ $this->args['post__not_in'] = get_option( 'sticky_posts' );
212
+ }
213
+
214
+ $this->args['ignore_sticky_posts'] = isset( $this->args['ignore_sticky_posts'] ) ? $this->shortcode_bool( $this->args['ignore_sticky_posts'] ) : true;
215
+
216
+ if ( isset( $this->args['more_tag'] ) ) {
217
+ add_filter( 'excerpt_more', array( &$this, 'custom_excerpt_more' ), 11 );
218
+ }
219
+
220
+ if ( isset( $atts['exclude_ids'] ) ) {
221
+ $exclude_posts = explode( ',', $atts['exclude_ids'] );
222
+ if ( isset( $this->args['post__not_in'] ) ) {
223
+ $this->args['post__not_in'] = array_merge( $this->args['post__not_in'], $exclude_posts );
224
+ } else {
225
+ $this->args['post__not_in'] = $exclude_posts;
226
+ }
227
+ }
228
+
229
+ if ( isset( $atts['from_date'] ) && isset( $atts['to_date'] ) ) {
230
+ $r_from = explode( '-', $atts['from_date'] );
231
+ $r_to = explode( '-', $atts['to_date'] );
232
+ $this->args['date_query'] = array(
233
+ array(
234
+ 'after' => array(
235
+ 'year' => $r_from[2],
236
+ 'month' => $r_from[1],
237
+ 'day' => $r_from[0],
238
+ ),
239
+ 'before' => array(
240
+ 'year' => $r_to[2],
241
+ 'month' => $r_to[1],
242
+ 'day' => $r_to[0],
243
+ ),
244
+ 'inclusive' => true,
245
+ ),
246
+ );
247
+ } else if ( isset( $atts['from_date'] ) ) {
248
+ $r_from = explode( '-', $atts['from_date'] );
249
+ $r_to = explode( '-', $atts['to_date'] );
250
+ $this->args['date_query'] = array(
251
+ array(
252
+ 'after' => array(
253
+ 'year' => $r_from[2],
254
+ 'month' => $r_from[1],
255
+ 'day' => $r_from[0],
256
+ ),
257
+ 'inclusive' => true,
258
+ ),
259
+ );
260
+ }
261
+
262
+ $current_time_value = current_time( 'timestamp' );
263
+ if ( isset( $atts['date'] ) ) {
264
+ $date_data = explode( '-', $atts['date'] );
265
+ if ( ! isset( $date_data[1] ) ) {
266
+ $date_data[1] = 0;
267
+ }
268
+ switch ( $date_data[0] ) {
269
+ case 'today':
270
+ $today = getdate( $current_time_value - ( $date_data[1] * DAY_IN_SECONDS ) );
271
+ $this->args['date_query'] = array(
272
+ 'year' => $today['year'],
273
+ 'month' => $today['mon'],
274
+ 'day' => $today['mday'],
275
+ );
276
+ break;
277
+ case 'week':
278
+ $week = date( 'W', $current_time_value - $date_data[1] * WEEK_IN_SECONDS );
279
+ $year = date( 'Y', $current_time_value - $date_data[1] * WEEK_IN_SECONDS );
280
+ $this->args['date_query'] = array(
281
+ 'year' => $year,
282
+ 'week' => $week,
283
+ );
284
+ break;
285
+ case 'month':
286
+ $month = date( 'm', strtotime( ( strval( - $date_data[1] ) . ' Months' ), $current_time_value ) );
287
+ $year = date( 'Y', strtotime( ( strval( - $date_data[1] ) . ' Months' ), $current_time_value ) );
288
+ $this->args['date_query'] = array(
289
+ 'monthnum' => $month,
290
+ 'year' => $year,
291
+ );
292
+ break;
293
+ case 'year':
294
+ $year = date( 'Y', strtotime( ( strval( - $date_data[1] ) . ' Years' ), $current_time_value ) );
295
+ $this->args['date_query'] = array(
296
+ 'year' => $year,
297
+ );
298
+ break;
299
+ }
300
+ }
301
+ $this->args = apply_filters( 'posts_in_page_args', $this->args );
302
+
303
+ }
304
+
305
+ /**
306
+ * Sets a shortcode boolean value to a real boolean
307
+ *
308
+ * @return bool
309
+ */
310
+ public function shortcode_bool( $var ) {
311
+
312
+ $falsey = array( 'false', '0', 'no', 'n' );
313
+
314
+ return ( ! $var || in_array( strtolower( $var ), $falsey ) ) ? false : true;
315
+
316
+ }
317
+
318
+ /**
319
+ * Tests if a theme has a template file that exists in one of two locations
320
+ * 1- posts-in-page directory or 2- theme directory
321
+ *
322
+ * @return true if template exists, false otherwise.
323
+ */
324
+ protected function has_theme_template() {
325
+
326
+ // try default template filename if empty
327
+ $filename = empty( $this->args['template'] ) ? 'posts_loop_template.php' : $this->args['template'];
328
+
329
+ // Checking first of two locations - theme root
330
+ $template_file = get_stylesheet_directory() . '/' . $filename;
331
+
332
+ // check for traversal attack
333
+ $path_parts = pathinfo( $template_file );
334
+ if ( $template_file != get_stylesheet_directory() . '/' .
335
+ $path_parts['filename'] . '.' . $path_parts['extension']
336
+ ) {
337
+ // something fishy
338
+ return false;
339
+ }
340
+
341
+ return ( file_exists( $template_file ) ) ? $template_file : false;
342
+
343
+ }
344
+
345
+ /**
346
+ * Retrieves the post loop template and returns the output
347
+ *
348
+ * @return string results of the output
349
+ */
350
+ protected function add_template_part( $ic_posts, $singles = false ) {
351
+ if ( $singles ) {
352
+ setup_postdata( $ic_posts );
353
+ } else {
354
+ $ic_posts->the_post();
355
+ }
356
+ /**
357
+ * Because legacy versions of pip forced users to echo content in the filter callback
358
+ * we are using both the filters and the output buffer to cover all bases of usage.
359
+ */
360
+ ob_start();
361
+ $output_start = apply_filters( 'posts_in_page_pre_loop', '' );
362
+ require ( $file_path = self::has_theme_template() )
363
+ ? $file_path // use template file in theme
364
+ : POSTSPAGE_DIR . '/templates/posts_loop_template.php'; // use default plugin template file
365
+ $output_start .= ob_get_clean();
366
+ /*
367
+ * Output buffering to handle legacy versions which forced filter callbacks to echo content rather than return it.
368
+ */
369
+ ob_start();
370
+ /**
371
+ * Standard use of filter
372
+ */
373
+ $output = apply_filters( 'posts_in_page_post_loop', $output_start );
374
+ /**
375
+ * Just in case someone has a legacy callback that doesn't return anything...
376
+ */
377
+ if ( empty( $output ) ) {
378
+ $output = $output_start;
379
+ }
380
+ /**
381
+ * Allow for legacy use of filter which forced echoing content
382
+ */
383
+ $output .= ob_get_clean();
384
+
385
+ return $output;
386
+ }
387
+
388
+ public function custom_excerpt_more( $more ) {
389
+ $more_tag = $this->args['more_tag'];
390
+
391
+ return ' <a class="read-more" href="' . get_permalink( get_the_ID() ) . '">' . $more_tag . '</a>';
392
+ }
393
+
394
+
395
+ }
index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // silence is golden.
languages/Posts-in-Page.pot CHANGED
@@ -1,118 +1,141 @@
1
- # Copyright (C) 2017 IvyCat, Inc.
2
  # This file is distributed under the GNU General Public License v2.0.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Posts in Page 1.3.0\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/posts_in_page\n"
7
- "POT-Creation-Date: 2017-02-15 00:16:27+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
- "X-Generator: grunt-wp-i18n 0.4.9\n"
15
 
16
  #. Plugin Name of the plugin/theme
17
  msgid "Posts in Page"
18
  msgstr ""
19
 
20
- #: admin/views/help-main.php:30
21
  msgid "How to use Posts in Page"
22
  msgstr ""
23
 
24
- #: admin/views/help-main.php:63
25
  msgid ""
26
  "Add all posts to a page (limit to what number posts in WordPress is set "
27
  "to), essentially adds blog \"page\" to page."
28
  msgstr ""
29
 
30
- #: admin/views/help-main.php:68
31
  msgid ""
32
- "show one or many posts by specifying the post ID(s) ( specify all post "
33
- "types )"
34
- msgstr ""
35
-
36
- #: admin/views/help-main.php:73
37
- msgid ""
38
- "show posts from a custom post type by specifying the post type slug ( must "
39
  "give post type if not a standard post ) add multiple post types by "
40
  "separating with commas (ex."
41
  msgstr ""
42
 
43
- #: admin/views/help-main.php:78
44
- msgid "limit number of posts (or override default setting)"
45
  msgstr ""
46
 
47
- #: admin/views/help-main.php:83
48
  msgid ""
49
  "orderby title - supports all WP orderby variables. Order is optional, WP "
50
  "default"
51
  msgstr ""
52
 
53
- #: admin/views/help-main.php:88
 
 
 
 
 
 
 
 
 
 
 
 
54
  msgid ""
55
- "Show posts within a specific category. Uses slugs, can have multiple but "
56
  "separate by commas. category-1,category2, etc (no spaces.)"
57
  msgstr ""
58
 
59
- #: admin/views/help-main.php:93
60
  msgid ""
61
  "Show posts using a specific tag. Like categories, it uses slugs, and can "
62
  "accommodate multiple tags separate by commas. tag-1,tag-2, etc (no "
63
  "spaces.)"
64
  msgstr ""
65
 
66
- #: admin/views/help-main.php:98
67
  msgid ""
68
- "limit posts to those that exist in a taxonomy and have a specific term. "
69
  "Both are required for either one to work"
70
  msgstr ""
71
 
72
- #: admin/views/help-main.php:103
73
  msgid ""
74
  "In case you want to style your markup, add meta data, etc. Each shortcode "
75
  "can reference a different template. These templates must exist in the "
76
- "theme directory."
77
  msgstr ""
78
 
79
- #: admin/views/help-main.php:108
80
  msgid "Show sticky posts too (they're ignored by default)"
81
  msgstr ""
82
 
83
- #: admin/views/help-main.php:113
84
  msgid "use pagination links (off by default)"
85
  msgstr ""
86
 
87
- #: admin/views/help-main.php:118
88
- msgid "Display posts from the 4th one"
89
  msgstr ""
90
 
91
- #: admin/views/help-main.php:123
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  msgid ""
93
- "Show's post associated (published) on specified date period, today, "
94
  "'today-1' show's posts published yesterday, 'today-2' shows posts published "
95
  "two days ago, etc. Also 'week(-n)' shows posts n weeks ago. Also available "
96
  "'month(-n)' and 'year(-n)'"
97
  msgstr ""
98
 
99
- #: admin/views/help-main.php:128
100
- msgid "exclude by post ID one or more."
101
  msgstr ""
102
 
103
- #: admin/views/help-main.php:133
 
 
 
 
104
  msgid "Custom message to display if no posts are found"
105
  msgstr ""
106
 
107
- #: admin/views/help-main.php:136
108
  msgid "Or any combination of the above."
109
  msgstr ""
110
 
111
- #: admin/views/help-main.php:138
112
  msgid "Embed a PHP function in a theme template file"
113
  msgstr ""
114
 
115
- #: admin/views/help-main.php:140
116
  msgid ""
117
  "If you'd like to use this plugin to pull posts directly into your theme's "
118
  "template files, you can drop the following WordPress function in your "
@@ -120,55 +143,55 @@ msgid ""
120
  "custom shortcode."
121
  msgstr ""
122
 
123
- #: admin/views/help-main.php:165
124
- msgid "Help & Support"
125
  msgstr ""
126
 
127
- #: admin/views/help-main.php:190
128
  msgid "Connect with IvyCat!"
129
  msgstr ""
130
 
131
- #: admin/views/help-main.php:228
132
- msgid "Contribute"
133
  msgstr ""
134
 
135
- #: admin/views/help-main.php:250
136
- msgid "IvyCat Services"
137
  msgstr ""
138
 
139
- #: includes/class-page-posts.php:26
140
  msgid "Next"
141
  msgstr ""
142
 
143
- #: includes/class-page-posts.php:27
144
  msgid "Previous"
145
  msgstr ""
146
 
147
- #: posts_in_page.php:46
148
  msgid " Help"
149
  msgstr ""
150
 
151
- #: posts_loop_template.php:29
152
  msgid "<span class=\"%1$s\">Posted in</span> %2$s"
153
  msgstr ""
154
 
155
- #: posts_loop_template.php:37
156
  msgid "<span class=\"%1$s\">Tagged</span> %2$s"
157
  msgstr ""
158
 
159
- #: posts_loop_template.php:41
160
  msgid "Leave a comment"
161
  msgstr ""
162
 
163
- #: posts_loop_template.php:41
164
  msgid "1 Comment"
165
  msgstr ""
166
 
167
- #: posts_loop_template.php:41
168
  msgid "% Comments"
169
  msgstr ""
170
 
171
- #: posts_loop_template.php:42
172
  msgid "Edit"
173
  msgstr ""
174
 
@@ -187,5 +210,5 @@ msgid "IvyCat, Inc."
187
  msgstr ""
188
 
189
  #. Author URI of the plugin/theme
190
- msgid "https://ivycat.com"
191
  msgstr ""
1
+ # Copyright (C) 2019 IvyCat, Inc.
2
  # This file is distributed under the GNU General Public License v2.0.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Posts in Page 1.4.1\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/posts-in-page\n"
7
+ "POT-Creation-Date: 2019-03-08 17:09:17+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "X-Generator: grunt-wp-i18n1.0.2\n"
15
 
16
  #. Plugin Name of the plugin/theme
17
  msgid "Posts in Page"
18
  msgstr ""
19
 
20
+ #: admin/views/help-main.php:34
21
  msgid "How to use Posts in Page"
22
  msgstr ""
23
 
24
+ #: admin/views/help-main.php:71
25
  msgid ""
26
  "Add all posts to a page (limit to what number posts in WordPress is set "
27
  "to), essentially adds blog \"page\" to page."
28
  msgstr ""
29
 
30
+ #: admin/views/help-main.php:76
31
  msgid ""
32
+ "Show posts from a custom post type by specifying the post type slug ( must "
 
 
 
 
 
 
33
  "give post type if not a standard post ) add multiple post types by "
34
  "separating with commas (ex."
35
  msgstr ""
36
 
37
+ #: admin/views/help-main.php:83
38
+ msgid "Limit number of posts (or override default setting)"
39
  msgstr ""
40
 
41
+ #: admin/views/help-main.php:88
42
  msgid ""
43
  "orderby title - supports all WP orderby variables. Order is optional, WP "
44
  "default"
45
  msgstr ""
46
 
47
+ #: admin/views/help-main.php:93
48
+ msgid ""
49
+ "Show one or many posts by specifying the post ID(s) ( specify all post "
50
+ "types )"
51
+ msgstr ""
52
+
53
+ #: admin/views/help-main.php:98
54
+ msgid ""
55
+ "Exclude one or more posts by specifying the post ID(s) ( specify all post "
56
+ "types )"
57
+ msgstr ""
58
+
59
+ #: admin/views/help-main.php:103 admin/views/help-main.php:108
60
  msgid ""
61
+ "Show posts within a specific category. Uses slugs, can have multiple but "
62
  "separate by commas. category-1,category2, etc (no spaces.)"
63
  msgstr ""
64
 
65
+ #: admin/views/help-main.php:113
66
  msgid ""
67
  "Show posts using a specific tag. Like categories, it uses slugs, and can "
68
  "accommodate multiple tags separate by commas. tag-1,tag-2, etc (no "
69
  "spaces.)"
70
  msgstr ""
71
 
72
+ #: admin/views/help-main.php:118
73
  msgid ""
74
+ "Limit posts to those that exist in a taxonomy and have a specific term. "
75
  "Both are required for either one to work"
76
  msgstr ""
77
 
78
+ #: admin/views/help-main.php:123
79
  msgid ""
80
  "In case you want to style your markup, add meta data, etc. Each shortcode "
81
  "can reference a different template. These templates must exist in the "
82
+ "theme directory or in a subfolder named posts-in-page."
83
  msgstr ""
84
 
85
+ #: admin/views/help-main.php:128
86
  msgid "Show sticky posts too (they're ignored by default)"
87
  msgstr ""
88
 
89
+ #: admin/views/help-main.php:133
90
  msgid "use pagination links (off by default)"
91
  msgstr ""
92
 
93
+ #: admin/views/help-main.php:138
94
+ msgid "Change the post navigation labels"
95
  msgstr ""
96
 
97
+ #: admin/views/help-main.php:143
98
+ msgid ""
99
+ "Show posts with the specified status(es); the default is to only show posts "
100
+ "with status 'publish'. To choose more than one status, separate them with "
101
+ "commas. For example: <code>post_status='private,publish'</code>."
102
+ msgstr ""
103
+
104
+ #: admin/views/help-main.php:148
105
+ msgid ""
106
+ "Displays posts after the offset. An offset='3' will show all posts from the "
107
+ "4th one onward."
108
+ msgstr ""
109
+
110
+ #: admin/views/help-main.php:153
111
  msgid ""
112
+ "Shows posts associated (published) on specified date period, today, "
113
  "'today-1' show's posts published yesterday, 'today-2' shows posts published "
114
  "two days ago, etc. Also 'week(-n)' shows posts n weeks ago. Also available "
115
  "'month(-n)' and 'year(-n)'"
116
  msgstr ""
117
 
118
+ #: admin/views/help-main.php:158
119
+ msgid "Shows posts published within a specified absolute date range"
120
  msgstr ""
121
 
122
+ #: admin/views/help-main.php:163
123
+ msgid "Set the link text for read more links shown after an excerpt"
124
+ msgstr ""
125
+
126
+ #: admin/views/help-main.php:168
127
  msgid "Custom message to display if no posts are found"
128
  msgstr ""
129
 
130
+ #: admin/views/help-main.php:172
131
  msgid "Or any combination of the above."
132
  msgstr ""
133
 
134
+ #: admin/views/help-main.php:175
135
  msgid "Embed a PHP function in a theme template file"
136
  msgstr ""
137
 
138
+ #: admin/views/help-main.php:177
139
  msgid ""
140
  "If you'd like to use this plugin to pull posts directly into your theme's "
141
  "template files, you can drop the following WordPress function in your "
143
  "custom shortcode."
144
  msgstr ""
145
 
146
+ #: admin/views/help-main.php:202
147
+ msgid "Help & Contributing"
148
  msgstr ""
149
 
150
+ #: admin/views/help-main.php:231
151
  msgid "Connect with IvyCat!"
152
  msgstr ""
153
 
154
+ #: admin/views/help-main.php:281
155
+ msgid "Spread the word"
156
  msgstr ""
157
 
158
+ #: admin/views/help-main.php:312
159
+ msgid "IvyCat Web Services"
160
  msgstr ""
161
 
162
+ #: includes/class-page-posts.php:34
163
  msgid "Next"
164
  msgstr ""
165
 
166
+ #: includes/class-page-posts.php:35
167
  msgid "Previous"
168
  msgstr ""
169
 
170
+ #: posts_in_page.php:52
171
  msgid " Help"
172
  msgstr ""
173
 
174
+ #: templates/posts_loop_template.php:31
175
  msgid "<span class=\"%1$s\">Posted in</span> %2$s"
176
  msgstr ""
177
 
178
+ #: templates/posts_loop_template.php:39
179
  msgid "<span class=\"%1$s\">Tagged</span> %2$s"
180
  msgstr ""
181
 
182
+ #: templates/posts_loop_template.php:43
183
  msgid "Leave a comment"
184
  msgstr ""
185
 
186
+ #: templates/posts_loop_template.php:43
187
  msgid "1 Comment"
188
  msgstr ""
189
 
190
+ #: templates/posts_loop_template.php:43
191
  msgid "% Comments"
192
  msgstr ""
193
 
194
+ #: templates/posts_loop_template.php:44
195
  msgid "Edit"
196
  msgstr ""
197
 
210
  msgstr ""
211
 
212
  #. Author URI of the plugin/theme
213
+ msgid "https://ivycat.com/wordpress/"
214
  msgstr ""
posts_in_page.php CHANGED
@@ -1,114 +1,120 @@
1
- <?php
2
- /**
3
- * Plugin Name: Posts in Page
4
- * Plugin URI: https://ivycat.com/wordpress/wordpress-plugins/posts-in-page/
5
- * Description: Easily add one or more posts to any page using simple shortcodes. Supports categories, tags, custom post types, custom taxonomies, and more.
6
- * Version: 1.3.1
7
- * Author: IvyCat, Inc.
8
- * Author URI: https://ivycat.com
9
- * License: GNU General Public License v2.0
10
- * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
- * Text Domain: posts-in-page
12
- * Domain Path: /languages
13
- *
14
- * @package Posts_in_Page
15
- * @author Eric Amundson <eric@ivycat.com>
16
- * @copyright Copyright (c) 2017, IvyCat, Inc.
17
- * @license http://www.gnu.org/licenses/gpl-2.0.html
18
- */
19
-
20
- if ( ! function_exists( 'add_action' ) ) {
21
- wp_die( 'You are trying to access this file in a manner not allowed.', 'Direct Access Forbidden', array( 'response' => '403' ) );
22
- }
23
-
24
- if ( ! defined( 'POSTSPAGE_DIR' ) ) {
25
- define( 'POSTSPAGE_DIR', plugin_dir_path( __FILE__ ) );
26
- }
27
-
28
- if ( ! defined( 'POSTPAGE_URL' ) ) {
29
- define( 'POSTPAGE_URL', plugin_dir_url( __FILE__ ) );
30
- }
31
-
32
- require_once 'includes/class-page-posts.php';
33
-
34
- class ICAddPostsToPage {
35
-
36
- public function __construct( ) {
37
- add_shortcode( 'ic_add_posts', array( &$this, 'posts_in_page' ) );
38
- add_shortcode( 'ic_add_post', array( &$this, 'post_in_page' ) );
39
- add_action( 'admin_menu', array( &$this, 'plugin_page_init' ) );
40
- add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( &$this, 'plugin_action_links' ), 10, 4 );
41
- load_plugin_textdomain( 'posts-in-page', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
42
- }
43
-
44
- /**
45
- * Add settings link on plugins page.
46
- */
47
- public function plugin_action_links( $actions, $plugin_file, $plugin_data, $context ) {
48
- if ( is_plugin_active( $plugin_file ) ) {
49
- $actions[] = '<a href="' . admin_url( 'options-general.php?page=posts_in_page' ) . '">' . __( ' Help', 'posts-in-page' ) . '</a>';
50
- }
51
- return apply_filters( 'post_in_page_actions', $actions );
52
- }
53
-
54
- /**
55
- * Main shortcode
56
- *
57
- * @param array $atts An array of shortcode parameters. None required
58
- */
59
- public function posts_in_page( $atts ) {
60
- $posts = new ICPagePosts( $atts );
61
- return $posts->output_posts( );
62
- }
63
-
64
- /**
65
- * Deprecated shortcode (routing to posts in page function now)
66
- *
67
- * @todo Remove this depreciated function.
68
- */
69
- public function post_in_page( $atts ) {
70
- return self::posts_in_page( $atts );
71
- }
72
-
73
- /**
74
- * Init plugin, add menu page, and setup hooks to load assets on the plugin options page
75
- */
76
- public function plugin_page_init() {
77
- if ( ! current_user_can( 'administrator' ) ) {
78
- return;
79
- }
80
-
81
- $hooks = array( );
82
- $hooks[] = add_options_page( __( 'Posts in Page', 'posts-in-page' ), __( 'Posts in Page', 'posts-in-page' ), 'read', 'posts_in_page',
83
- array( $this, 'plugin_page' ) );
84
-
85
- foreach ( $hooks as $hook ) {
86
- add_action( "admin_print_styles-{$hook}", array( $this, 'load_assets' ) );
87
- }
88
- }
89
-
90
- /**
91
- * Enqueue plugin assets (scripts & styles)
92
- */
93
- public function load_assets( ) {
94
- wp_enqueue_style( 'postpagestyle', POSTPAGE_URL . 'admin/assets/css/post-page_styles.css' );
95
- wp_enqueue_script( 'postpagescript', POSTPAGE_URL . 'admin/assets/js/post-page_scripts.js' );
96
- }
97
-
98
- /**
99
- * Plugin Settings page - includes view for the page
100
- */
101
- public function plugin_page( ) {
102
- require_once 'admin/views/help-main.php';
103
- }
104
-
105
- }
106
-
107
- /**
108
- * Instantiate the Plugin - called using the plugins_loaded action hook.
109
- */
110
- function init_ic_posts_in_page( ) {
111
- new ICAddPostsToPage( );
112
- }
113
-
114
- add_action( 'plugins_loaded', 'init_ic_posts_in_page' );
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Posts_in_Page
4
+ * @author Eric Amundson <eric@ivycat.com>
5
+ * @copyright Copyright (c) 2019, IvyCat, Inc.
6
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
7
+ *
8
+ * Plugin Name: Posts in Page
9
+ * Plugin URI: https://ivycat.com/wordpress/wordpress-plugins/posts-in-page/
10
+ * Description: Easily add one or more posts to any page using simple shortcodes. Supports categories, tags, custom post types, custom taxonomies, and more.
11
+ * Version: 1.4.1
12
+ * Author: IvyCat, Inc.
13
+ * Author URI: https://ivycat.com/wordpress/
14
+ * Text Domain: posts-in-page
15
+ * Domain Path: /languages
16
+ * License: GNU General Public License v2.0
17
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.html
18
+ */
19
+
20
+ if ( ! function_exists( 'add_action' ) ) {
21
+ wp_die( 'You are trying to access this file in a manner not allowed.', 'Direct Access Forbidden', array( 'response' => '403' ) );
22
+ }
23
+
24
+ if ( ! defined( 'POSTSPAGE_DIR' ) ) {
25
+ define( 'POSTSPAGE_DIR', plugin_dir_path( __FILE__ ) );
26
+ }
27
+
28
+ if ( ! defined( 'POSTPAGE_URL' ) ) {
29
+ define( 'POSTPAGE_URL', plugin_dir_url( __FILE__ ) );
30
+ }
31
+
32
+ require_once 'includes/class-page-posts.php';
33
+
34
+ class ICAddPostsToPage {
35
+
36
+ public function __construct() {
37
+ add_shortcode( 'ic_add_posts', array( &$this, 'posts_in_page', ) );
38
+ add_shortcode( 'ic_add_post', array( &$this, 'post_in_page', ) );
39
+ add_action( 'admin_menu', array( &$this, 'plugin_page_init', ) );
40
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array(
41
+ &$this,
42
+ 'plugin_action_links',
43
+ ), 10, 4 );
44
+ load_plugin_textdomain( 'posts-in-page', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
45
+ }
46
+
47
+ /**
48
+ * Add settings link on plugins page.
49
+ */
50
+ public function plugin_action_links( $actions, $plugin_file, $plugin_data, $context ) {
51
+ if ( is_plugin_active( $plugin_file ) ) {
52
+ $actions[] = '<a href="' . admin_url( 'options-general.php?page=posts_in_page' ) . '">' . __( ' Help', 'posts-in-page' ) . '</a>';
53
+ }
54
+
55
+ return apply_filters( 'post_in_page_actions', $actions );
56
+ }
57
+
58
+ /**
59
+ * Main shortcode
60
+ * @return array
61
+ *
62
+ * @param array $atts An array of shortcode parameters. None required
63
+ */
64
+ public function posts_in_page( $atts ) {
65
+ $posts = new ICPagePosts( $atts );
66
+
67
+ return $posts->output_posts();
68
+ }
69
+
70
+ /**
71
+ * Deprecated shortcode (routing to posts in page function now)
72
+ *
73
+ * @todo Remove this deprecated function
74
+ */
75
+ public function post_in_page( $atts ) {
76
+ return self::posts_in_page( $atts );
77
+ }
78
+
79
+ /**
80
+ * Init plugin, add menu page, and setup hooks to load assets on the plugin options page
81
+ */
82
+ public function plugin_page_init() {
83
+ if ( ! current_user_can( 'administrator' ) ) {
84
+ return;
85
+ }
86
+
87
+ $hooks = array();
88
+ $hooks[] = add_options_page( __( 'Posts in Page', 'posts-in-page' ), __( 'Posts in Page', 'posts-in-page' ), 'read', 'posts_in_page',
89
+ array( $this, 'plugin_page' ) );
90
+
91
+ foreach ( $hooks as $hook ) {
92
+ add_action( "admin_print_styles-{$hook}", array( $this, 'load_assets' ) );
93
+ }
94
+ }
95
+
96
+ /**
97
+ * Enqueue plugin assets (scripts & styles)
98
+ */
99
+ public function load_assets() {
100
+ wp_enqueue_style( 'postpagestyle', POSTPAGE_URL . 'admin/assets/css/post-page_styles.css' );
101
+ wp_enqueue_script( 'postpagescript', POSTPAGE_URL . 'admin/assets/js/post-page_scripts.js' );
102
+ }
103
+
104
+ /**
105
+ * Plugin Settings page - includes view for the page
106
+ */
107
+ public function plugin_page() {
108
+ require_once 'admin/views/help-main.php';
109
+ }
110
+
111
+ }
112
+
113
+ /**
114
+ * Instantiate the Plugin - called using the plugins_loaded action hook.
115
+ */
116
+ function init_ic_posts_in_page() {
117
+ new ICAddPostsToPage();
118
+ }
119
+
120
+ add_action( 'plugins_loaded', 'init_ic_posts_in_page' );
posts_loop_template.php DELETED
@@ -1,45 +0,0 @@
1
- <?php
2
- /**
3
- * @package Posts_in_Page
4
- * @author Eric Amundson <eric@ivycat.com>
5
- * @copyright Copyright (c) 2017, IvyCat, Inc.
6
- * @license http://www.gnu.org/licenses/gpl-2.0.html
7
- */
8
- ?>
9
-
10
- <!-- NOTE: If you need to make changes to this file, copy it to your current theme's main
11
- directory so your changes won't be overwritten when the plugin is upgraded. -->
12
-
13
- <!-- Post Wrap Start-->
14
- <div class="post hentry ivycat-post">
15
-
16
- <!-- This outputs the post TITLE -->
17
- <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
18
-
19
- <!-- This outputs the post EXCERPT. To display full content including images and html,
20
- replace the_excerpt(); with the_content(); below. -->
21
- <div class="entry-summary">
22
- <?php the_excerpt(); ?>
23
- </div>
24
-
25
- <!-- This outputs the post META information -->
26
- <div class="entry-utility">
27
- <?php if ( count( get_the_category() ) ) : ?>
28
- <span class="cat-links">
29
- <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'posts-in-page' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
30
- </span>
31
- <span class="meta-sep">|</span>
32
- <?php endif; ?>
33
- <?php
34
- $tags_list = get_the_tag_list( '', ', ' );
35
- if ( $tags_list ): ?>
36
- <span class="tag-links">
37
- <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'posts-in-page' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
38
- </span>
39
- <span class="meta-sep">|</span>
40
- <?php endif; ?>
41
- <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'posts-in-page' ), __( '1 Comment', 'posts-in-page' ), __( '% Comments', 'posts-in-page' ) ); ?></span>
42
- <?php edit_post_link( __( 'Edit', 'posts-in-page' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
43
- </div>
44
- </div>
45
- <!-- // Post Wrap End -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Posts in Page ===
2
  Contributors: ivycat, sewmyheadon, anvilzephyr, jasonm4563, pjackson1972
3
  Tags: shortcode, pages, posts, custom post types, taxonomy, terms
4
- Requires at least: 4.0
5
- Tested up to: 4.9
6
- Stable tag: 1.3.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -19,9 +19,7 @@ You can get all of the same functionality provided by this plugin by modifying y
19
 
20
  Plugin is depending upon your theme's styling; version 1.x of this plugin _does not_ contain native styles.
21
 
22
- This is a minimal plugin, function over form. If you would like to extend it, or would like us to extend it in later versions, please post feature suggestions in the plugin's [support forum](https://wordpress.org/support/plugin/posts-in-page) or [contact us](https://ivycat.com/contact/).
23
-
24
- Give us feedback and contribute to this plugin on its [GitHub page](https://github.com/ivycat/Posts-in-Page)
25
 
26
  == Installation ==
27
 
@@ -34,27 +32,36 @@ You can install from within WordPress using the Plugin/Add New feature, or if yo
34
 
35
  ### Shortcode Usage
36
 
37
- To 'pull' posts into a page, you can either:
38
 
39
- 1. place a shortcode in the editor window of the page you're editing, or
 
40
  1. modify a theme template file using the shortcode in a PHP function.
41
 
42
  #### Using Shortcodes in the WordPress editor
43
 
44
- * `[ic_add_posts]` - Add all posts to a page (limit to what number posts in WordPress is set to), essentially adds blog "page" to page.
45
- * `[ic_add_posts ids='1,2,3']` - show one or many posts by specifying the post ID(s) ( specify all post types )
46
- * `[ic_add_posts post_type='post_type']` - show posts from a custom post type by specifying the post type slug ( must give post type if not a standard post ) add multiple post types by separating with commas (ex. `post_type='post_type1,post_type2'`)
47
- * `[ic_add_posts showposts='5']` - limit number of posts (or override default setting)
48
- * `[ic_add_posts orderby='title' order='ASC']` - orderby title - supports all WP orderby variables. Order is optional, WP default is 'DESC'.
49
- * `[ic_add_posts category='category-slug']` - Show posts within a specific category. Uses slugs, can have multiple but separate by commas. category-1,category2, etc (no spaces.)
50
- * `[ic_add_posts exclude_category='category-slug']` - Exclude posts within specific category. Uses slugs, can have multiple slugs separated by commas. category-1,category2, etc (no spaces.)
51
- * `[ic_add_posts tag='tag-slug']` - Show posts using a specific tag. Like categories, it uses slugs, and can accommodate multiple tags separate by commas. tag-1,tag-2, etc (no spaces.)
52
- * `[ic_add_posts tax='taxonomy' term='term']` - limit posts to those that exist in a taxonomy and have a specific term. Both are required for either one to work
53
- * `[ic_add_posts template='template-in-theme-dir.php']` - In case you want to style your markup, add meta data, etc. Each shortcode can reference a different template. These templates must exist in the theme directory.
 
 
54
  * `[ic_add_posts ignore_sticky_posts='no']` - Show sticky posts too (they're ignored by default).
55
- * `[ic_add_posts paginate='yes']` - use pagination links (off by default)
56
- * `[ic_add_posts label_next='Next' label_previous='Previous']` - Customize 'Next' and 'Previous' labels used by pagination
57
  * `[ic_add_posts post_status='private']` - Show posts with the specified status. By default it shows only posts with 'publish' status. To select multiple statuses, separate them with commas like so: `post_status='private,publish'`.
 
 
 
 
 
 
58
 
59
  Or any combination of the above.
60
 
@@ -70,7 +77,7 @@ Let's say you want to pull a specific post called _"What I love about coffee"_,
70
 
71
  ** Example 2 **
72
 
73
- Alright, now lets say that you want to pull in all posts from two categories into your WordPress page. One category is _WordPress Rocks_ and the other is _WordPress Rolls_. Plus, you'd like to display them three per page, rather than the default number of posts. Depending on your category slugs, your shortcode should probably look like this:
74
 
75
  `[ic_add_posts category='wordpress-rocks,wordpress-rolls' showposts='3']`
76
 
@@ -82,7 +89,7 @@ Now, you're ambitious and want to try something complex. Let's say you've got a
82
  * posts that are in the _Testimonial Type_ custom taxonomy using the term _Customer_,
83
  * you want to display six testimonials per page,
84
  * you'd like them displayed in ascending order,
85
- * finally, you've created a custom template to use in presenting these posts and named it `my-posts-in-page-template.php`
86
 
87
  Your shortcode might look like this:
88
 
@@ -94,21 +101,30 @@ If you'd like to use this plugin to pull posts directly into your theme's templa
94
 
95
  `<?php echo do_shortcode("[shortcode]"); ?>`
96
 
 
 
 
 
 
 
 
 
 
 
97
  == Frequently Asked Questions ==
98
 
99
  = What is the point of this plugin? =
100
 
101
  Some of our clients wanted to output some posts in a specific page without fiddling with templates.
102
 
103
- This plugin goes well with our [Simple Page Specific Sidebars](http://wordpress.org/extend/plugins/page-specific-sidebars/) plugin, and gives you more granular control of sidebars on specific categories, post-types, etc.
104
-
105
  = How do I change the output template =
106
 
107
  Simply copy the `posts_loop_template.php` to your theme directory and make changes as necessary.
108
 
109
  You can even rename it - but make sure to indicate that in the shortcode using the `template='template_name.php'`.
110
 
111
- You can even use different templates for each shortcode if you like.
 
112
 
113
  = Does it work with custom post types? =
114
 
@@ -124,13 +140,29 @@ Not likely, but let us know if it does; then we'll *know* we have something spec
124
 
125
  == Screenshots ==
126
 
127
- 1. Embed a shortcode into a page and it will automatically pull in the post(s) you need.
128
  2. Embed shortcodes directly in your template using `do_shortcode`.
129
 
130
  == Changelog ==
131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  = 1.3.1 =
133
- * File header update / spelling fixes in readme.txt
 
 
 
134
 
135
  = 1.3.0 =
136
  * File reorganization / housekeeping
@@ -139,7 +171,7 @@ Not likely, but let us know if it does; then we'll *know* we have something spec
139
  * Added ability to optionally include private posts - Thanks StarsoftAnalysis!
140
 
141
  = 1.2.4 =
142
- * now you can set `more_tag=""` to remove the `[...] &hellip;` that unfortunately shows up as `&hellip`
143
 
144
  = 1.2.3 =
145
  * Added minor doc tweaks.
@@ -158,7 +190,7 @@ Not likely, but let us know if it does; then we'll *know* we have something spec
158
  * Improved and simplified documentation.
159
 
160
  = 1.1.1 =
161
- * Code maintenance, fix for category bug, also added ability for multiple post types per shortcode.
162
 
163
  = 1.1.0 =
164
  * Code maintenance, squash non-critical debug notices.
@@ -187,6 +219,12 @@ Not likely, but let us know if it does; then we'll *know* we have something spec
187
 
188
  == Upgrade Notice ==
189
 
 
 
 
 
 
 
190
  = 1.3.0 =
191
  * Important security and version updates. Please upgrade.
192
 
1
  === Posts in Page ===
2
  Contributors: ivycat, sewmyheadon, anvilzephyr, jasonm4563, pjackson1972
3
  Tags: shortcode, pages, posts, custom post types, taxonomy, terms
4
+ Requires at least: 3.0
5
+ Tested up to: 5.1
6
+ Stable tag: 1.4.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
19
 
20
  Plugin is depending upon your theme's styling; version 1.x of this plugin _does not_ contain native styles.
21
 
22
+ This is a minimal plugin, function over form. Give us feedback, suggestions, bug reports, and any other contributions on the in the plugin's [GitHub repository](https://github.com/ivycat/posts-in-page).
 
 
23
 
24
  == Installation ==
25
 
32
 
33
  ### Shortcode Usage
34
 
35
+ To 'pull' posts into a page, you can:
36
 
37
+ 1. place a shortcode in the editor window of the page you're editing (Classic Editor),
38
+ 1. place a shortcode in a shortcode block on the page you're editing (Gutenberg Editor),
39
  1. modify a theme template file using the shortcode in a PHP function.
40
 
41
  #### Using Shortcodes in the WordPress editor
42
 
43
+ * `[ic_add_posts]` - Add all posts to a page (limit to what number posts in WordPress is set to), essentially adds blog "page" to page.
44
+ * `[ic_add_posts post_type='post_type']` - Show posts from a custom post type by specifying the post type slug (must give post type if not a standard post). Add multiple post types by separating with commas (ex. `post_type='post_type1,post_type2'`).
45
+ * `[ic_add_posts showposts='5']` - Limit number of posts (or override default setting).
46
+ * `[ic_add_posts orderby='title' order='ASC']` - Order the post output using `orderby` - supports all WP [orderby parameters](https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters). Order is optional, default is 'DESC'.
47
+ * `[ic_add_posts ids='1,2,3']` - Show one or many posts by specifying the post ID(s) (specify all post types).
48
+ * `[ic_add_posts exclude_ids='4,5,6']` - Exclude specific post ID(s) from the query.
49
+ * `[ic_add_posts category='category-slug']` - Show posts within a specific category by category slug. Separate multiple categories with commas.
50
+ * `[ic_add_posts cats='2,13']` - Show posts within a specific category by category IDs. Separate multiple categories with commas.
51
+ * `[ic_add_posts exclude_category='category-slug']` - Exclude posts within specific category. Uses slugs, can list multiple category slugs separated by commas.
52
+ * `[ic_add_posts tag='tag-slug']` - Show posts using a specific tag. Like categories, it uses slugs, and can accommodate multiple tags separated by commas.
53
+ * `[ic_add_posts tax='taxonomy' term='term']` - Limit posts to those that exist in a taxonomy and have a specific term. Both are required for either one to work and you must specify custom post_types.
54
+ * `[ic_add_posts post_format='post-format-status']` - Select post formats. Use 'post-format-' followed by the format type (chat, aside, video, etc.). Use comma to separate post formats. To pull all posts with the quotes format, you'd use `[ic_add_posts post_format='post-format-quote']`.
55
  * `[ic_add_posts ignore_sticky_posts='no']` - Show sticky posts too (they're ignored by default).
56
+ * `[ic_add_posts paginate='yes']` - Use pagination links (off by default).
57
+ * `[ic_add_posts label_next='Next' label_previous='Previous']` - Customize 'Next' and 'Previous' labels used by pagination.
58
  * `[ic_add_posts post_status='private']` - Show posts with the specified status. By default it shows only posts with 'publish' status. To select multiple statuses, separate them with commas like so: `post_status='private,publish'`.
59
+ * `[ic_add_posts more_tag='Read more']` - Set the link text for read more links shown after an excerpt.
60
+ * `[ic_add_posts date='today-1']` - Choose the relative date of included posts. Supports formatting like `date='today-1'` (today minus 1 day), `date='week-2'` (today minus 2 weeks), `date='month-1'` (today minus 1 month), `date='year-1'` (today minus 1 year).
61
+ * `[ic_add_posts from_date='15-01-2016' to_date='31-12-2016']` - Shows posts published within a specified absolute date range.
62
+ * `[ic_add_posts offset='3']` - Displays posts after the offset. An `offset='3'` will show all posts from the 4th one back.
63
+ * `[ic_add_posts none_found='No Posts Found']` - Custom message to display when no posts are found.
64
+ * `[ic_add_posts template='template-in-theme-dir.php']` - In case you want to style your markup, add meta data, etc. Each shortcode can reference a different template. These templates must exist in the theme directory or in a sub-directory named _posts-in-page_.
65
 
66
  Or any combination of the above.
67
 
77
 
78
  ** Example 2 **
79
 
80
+ Alright, now let's say that you want to pull in all posts from two categories into your WordPress page. One category is _WordPress Rocks_ and the other is _WordPress Rolls_. Plus, you'd like to display them three per page, rather than the default number of posts. Depending on your category slugs, your shortcode should probably look like this:
81
 
82
  `[ic_add_posts category='wordpress-rocks,wordpress-rolls' showposts='3']`
83
 
89
  * posts that are in the _Testimonial Type_ custom taxonomy using the term _Customer_,
90
  * you want to display six testimonials per page,
91
  * you'd like them displayed in ascending order,
92
+ * finally, you've created a custom template to use in presenting these posts and named it `my-posts-in-page-template.php`.
93
 
94
  Your shortcode might look like this:
95
 
101
 
102
  `<?php echo do_shortcode("[shortcode]"); ?>`
103
 
104
+ ### Developer Hooks
105
+
106
+ There are several hooks you can use to filter the output of your template files:
107
+
108
+ * `posts_in_page_results` - Filter results
109
+ * `posts_in_page_args` - Filter the query arguments
110
+ * `posts_in_page_paginate` - Filter pagination
111
+ * `posts_in_page_pre_loop` - Runs right before the loop (posts_loop_template.php)
112
+ * `posts_in_page_post_loop` - Runs right after the loop
113
+
114
  == Frequently Asked Questions ==
115
 
116
  = What is the point of this plugin? =
117
 
118
  Some of our clients wanted to output some posts in a specific page without fiddling with templates.
119
 
 
 
120
  = How do I change the output template =
121
 
122
  Simply copy the `posts_loop_template.php` to your theme directory and make changes as necessary.
123
 
124
  You can even rename it - but make sure to indicate that in the shortcode using the `template='template_name.php'`.
125
 
126
+ For file housekeeping, you can also create a _posts-in-page_ folder in your theme to store all of your custom templates. It isn't necessary to specify the _posts-in-page_ folder in your shortcode - Posts in Page will find it automatically.
127
+ You can even use multiple templates for use with different shortcodes.
128
 
129
  = Does it work with custom post types? =
130
 
140
 
141
  == Screenshots ==
142
 
143
+ 1. Embed a shortcode into a page, and it will automatically pull in the post(s) you need.
144
  2. Embed shortcodes directly in your template using `do_shortcode`.
145
 
146
  == Changelog ==
147
 
148
+ = 1.4.1 =
149
+ * Fix wp_reset_query bug
150
+ * Patch pagination to make it more reliable across themes.
151
+
152
+ = 1.4.0 =
153
+ * Add templates folder to structure and moved default template there
154
+ * Fix pagination issues #42, 59
155
+ * Fix bug preventing including or excluding multiple post_types or categories
156
+ * Add a few new date-based shortcode arguments including `date=` and `from_date=` and `to_date=`
157
+ * Document post format support, new shortcode arguments
158
+ * Code cleanup
159
+ * Updates to admin page layout and documentation
160
+
161
  = 1.3.1 =
162
+ * File header housekeeping
163
+ * Code cleanup
164
+ * Fix WPML compatibility issue (thanks @azrall)
165
+ * Document new shortcode functions including `exclude_ids`, `more_tag`
166
 
167
  = 1.3.0 =
168
  * File reorganization / housekeeping
171
  * Added ability to optionally include private posts - Thanks StarsoftAnalysis!
172
 
173
  = 1.2.4 =
174
+ * now you can set `more_tag=""` to remove the `[...] &hellip;` that unfortunetly shows up as `&hellip`
175
 
176
  = 1.2.3 =
177
  * Added minor doc tweaks.
190
  * Improved and simplified documentation.
191
 
192
  = 1.1.1 =
193
+ * Code maintenance, fix for category bug, also added the ability for multiple post types per shortcode.
194
 
195
  = 1.1.0 =
196
  * Code maintenance, squash non-critical debug notices.
219
 
220
  == Upgrade Notice ==
221
 
222
+ = 1.4.1 =
223
+ * Critical bug fixes. Please upgrade.
224
+
225
+ = 1.4.0 =
226
+ * Bug fixes, new shortcodes, and code improvements. Please upgrade.
227
+
228
  = 1.3.0 =
229
  * Important security and version updates. Please upgrade.
230
 
templates/posts_loop_template.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Posts_in_Page
4
+ * @author Eric Amundson <eric@ivycat.com>
5
+ * @copyright Copyright (c) 2019, IvyCat, Inc.
6
+ * @link https://ivycat.com
7
+ * @since 1.0.0
8
+ * @license GPL-2.0+
9
+ */
10
+ ?>
11
+
12
+ <!-- NOTE: If you need to make changes to this file, copy it to your current theme's main
13
+ directory so your changes won't be overwritten when the plugin is upgraded. -->
14
+
15
+ <!-- Post Wrap Start-->
16
+ <div class="post hentry ivycat-post">
17
+
18
+ <!-- This outputs the post TITLE -->
19
+ <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
20
+
21
+ <!-- This outputs the post EXCERPT. To display full content including images and html,
22
+ replace the_excerpt(); with the_content(); below. -->
23
+ <div class="entry-summary">
24
+ <?php the_excerpt(); ?>
25
+ </div>
26
+
27
+ <!-- This outputs the post META information -->
28
+ <div class="entry-utility">
29
+ <?php if ( count( get_the_category() ) ) : ?>
30
+ <span class="cat-links">
31
+ <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'posts-in-page' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
32
+ </span>
33
+ <span class="meta-sep">|</span>
34
+ <?php endif; ?>
35
+ <?php
36
+ $tags_list = get_the_tag_list( '', ', ' );
37
+ if ( $tags_list ): ?>
38
+ <span class="tag-links">
39
+ <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'posts-in-page' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
40
+ </span>
41
+ <span class="meta-sep">|</span>
42
+ <?php endif; ?>
43
+ <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'posts-in-page' ), __( '1 Comment', 'posts-in-page' ), __( '% Comments', 'posts-in-page' ) ); ?></span>
44
+ <?php edit_post_link( __( 'Edit', 'posts-in-page' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
45
+ </div>
46
+ </div>
47
+ <!-- // Post Wrap End -->