Changeset 2793299
- Timestamp:
- 10/03/2022 08:22:33 AM (4 years ago)
- Location:
- posts-by-shortcode
- Files:
-
- 26 added
- 4 edited
-
assets/screenshot-8.png (modified) (previous)
-
tags/1.2 (added)
-
tags/1.2/assets (added)
-
tags/1.2/assets/banner-772x250-rtl.png (added)
-
tags/1.2/assets/banner-772x250.png (added)
-
tags/1.2/assets/icon-128x128.png (added)
-
tags/1.2/assets/screenshot-1.png (added)
-
tags/1.2/assets/screenshot-2.png (added)
-
tags/1.2/assets/screenshot-3.png (added)
-
tags/1.2/assets/screenshot-4.png (added)
-
tags/1.2/assets/screenshot-5.png (added)
-
tags/1.2/assets/screenshot-6.png (added)
-
tags/1.2/assets/screenshot-7.png (added)
-
tags/1.2/assets/screenshot-8.png (added)
-
tags/1.2/css (added)
-
tags/1.2/css/style.css (added)
-
tags/1.2/posts-by-shortcode-rk.php (added)
-
tags/1.2/readme.txt (added)
-
tags/1.2/templates (added)
-
tags/1.2/templates/images (added)
-
tags/1.2/templates/images/blog-default.jpg (added)
-
tags/1.2/templates/pbs_rk_layout_1.php (added)
-
tags/1.2/templates/pbs_rk_layout_2.php (added)
-
tags/1.2/templates/pbs_rk_layout_3.php (added)
-
tags/1.2/templates/pbs_rk_layout_4.php (added)
-
tags/1.2/templates/pbs_rk_layout_5.php (added)
-
tags/1.2/templates/pbs_rk_layout_6.php (added)
-
trunk/assets/screenshot-8.png (modified) (previous)
-
trunk/posts-by-shortcode-rk.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
posts-by-shortcode/trunk/posts-by-shortcode-rk.php
r2754553 r2793299 65 65 <p><code>[show_posts_pbs_rk layout="1" hide_category="yes"]</code> <br><i style="background: #f4f4d4;">Hide category label from posts.</i></p> 66 66 <p><code>[show_posts_pbs_rk layout="1" desc_length="200"]</code> <br><i style="background: #f4f4d4;">Set number of characters to show in post description.</i></p> 67 <p><code>[show_posts_pbs_rk layout="1" category_id="1"]</code> <br><i style="background: #f4f4d4;">Show posts by category id(Use single id with single shortcode).</i></p> 68 <p><code>[show_posts_pbs_rk layout="1" pagination="yes"]</code> <br><i style="background: #f4f4d4;">Show posts pagination(Pagination will not work if shortcode has category_id attribute).</i></p> 67 <p><code>[show_posts_pbs_rk layout="1" category_id="1"]</code> or multiple category ids <code>[show_posts_pbs_rk layout="1" category_id="1,2,3"]</code><br><i style="background: #f4f4d4;">Show posts by category id.</i></p> 68 <p><code>[show_posts_pbs_rk layout="1" exclude_cat="1"]</code> or multiple category ids <code>[show_posts_pbs_rk layout="1" exclude_cat="1,2,3"]</code><br><i style="background: #f4f4d4;">Show All posts excluded by category id.</i></p> 69 <p><code>[show_posts_pbs_rk layout="1" pagination="yes"]</code> <br><i style="background: #f4f4d4;">Show posts pagination.</i></p> 69 70 <p><code>[show_posts_pbs_rk layout="1" read_more_lebel="Continue Reading >"]</code> <br><i style="background: #f4f4d4;">Set Custom Label for Read More Button.</i></p> 70 71 <p><code>[show_posts_pbs_rk layout="1" show_author="yes"]</code> <br><i style="background: #f4f4d4;">Show author name in posts.</i></p> … … 107 108 /* Show Single Post by ID */ 108 109 if($atts['post_id']){$show_post_by_id = $atts['post_id'];}else{$show_post_by_id = '0';} 110 111 /* Exclude category IDs from posts */ 112 if($atts['exclude_cat']){$exclude_cat = $atts['exclude_cat'];}else{$exclude_cat = '0';} 109 113 110 114 /* Get Posts Arguments */ … … 122 126 'post_status' => 'publish', 123 127 'order' => 'DESC', 128 'category__not_in' => array($exclude_cat), 124 129 'posts_per_page' => $post_per_page, 125 130 'offset' => $offset … … 130 135 $result = new WP_Query( $args ); 131 136 132 /* Calculate Pagination */133 if($pagination_attr == 'yes'){134 $total_posts = wp_count_posts()->publish;135 $total_page = ceil($total_posts/$post_per_page);136 }137 138 137 $content = ''; 139 138 … … 161 160 /* Show Pagination */ 162 161 if($pagination_attr == 'yes'){ 163 if($total_posts > $post_per_page && $category_id == 0){ 162 163 /* Calculate Pagination */ 164 if($category_id != 0 || $exclude_cat != 0){ 165 $args = array( 166 'cat' => $category_id, 167 'post_type' => 'post', 168 'category__not_in' => array($exclude_cat), 169 'post_status' => 'publish' 170 ); 171 172 $the_query = new WP_Query( $args ); 173 $total_posts = $the_query->found_posts; 174 }else{ 175 $total_posts = wp_count_posts()->publish; 176 } 177 178 $total_page = ceil($total_posts/$post_per_page); 179 180 if($total_posts > $post_per_page){ 164 181 $content .= '<div class="pbs_rk_pagination">'; 165 182 $content .= '<ul>'; -
posts-by-shortcode/trunk/readme.txt
r2754559 r2793299 3 3 Tags: Posts, Posts Shortcode, Show Posts, Show posts by shortcode, posts by shortcode 4 4 Donate link: https://learn-wordpress-by-rk.blogspot.com/2022/04/donate-me.html 5 Requires at least: 3.05 Requires at least: 5.0 6 6 Tested up to: 6.0 7 7 Requires PHP: 7.0 8 Stable tag: 1. 18 Stable tag: 1.2 9 9 License: GPL2 or Later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 45 45 `[show_posts_pbs_rk layout="1" category_id="1"]` 46 46 47 Show Posts by Multiple Category 48 49 `[show_posts_pbs_rk layout="1" category_id="1,2,3"]` 50 51 Show all posts excluded by category 52 53 `[show_posts_pbs_rk layout="1" exclude_cat="1"]` 54 55 Show all posts excluded by multiple category 56 57 `[show_posts_pbs_rk layout="1" exclude_cat="1,2,3"]` 58 47 59 Show pagination 48 60 … … 68 80 69 81 `[show_posts_pbs_rk layout="1" post_id="52"]` 82 83 [youtube https://www.youtube.com/watch?v=l4kg9BCq4PQ&t=369s] 70 84 71 85 … … 114 128 == Changelog == 115 129 116 1. 0117 Initial version 130 1.2 131 New version added 118 132 119 133 == Upgrade Notice ==
Note: See TracChangeset
for help on using the changeset viewer.