Changeset 2007718
- Timestamp:
- 01/07/2019 12:30:53 PM (7 years ago)
- Location:
- albnet-shortcodes/trunk
- Files:
-
- 4 edited
-
README.txt (modified) (1 diff)
-
albnet-shortcodes.php (modified) (13 diffs)
-
shortcode-horizontal.php (modified) (2 diffs)
-
style.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
albnet-shortcodes/trunk/README.txt
r2007581 r2007718 147 147 148 148 1.1.5 Add fields 'order' and 'orderby' to set posts ordering 149 150 1.2.5 Changed default 'show_date' and 'show_author' config. Add query optimization args. Bugs fixes. -
albnet-shortcodes/trunk/albnet-shortcodes.php
r2007581 r2007718 12 12 * Plugin URI: https://shortcodes.albreis.com.br 13 13 * Description: A lot of shortcodes to show posts 14 * Version: 1. 1.514 * Version: 1.2.5 15 15 * Author: Albreis Network <[email protected]> 16 16 * Author URI: https://albreis.com.br … … 21 21 */ 22 22 23 defined('IS_MOBILE') or define('IS_MOBILE', wp_is_mobile()); 24 23 25 /** 24 26 * Load settings page … … 81 83 82 84 // Section title 83 'title' => ' Vídeos',85 'title' => '', 84 86 85 87 // Post type … … 93 95 94 96 // Posts ordering 95 'order' => ' ASC',97 'order' => 'DESC', 96 98 97 99 // Field to ordering … … 114 116 115 117 //Show only posts with featured images? 116 'only_with_thumb' => false,118 'only_with_thumb' => true, 117 119 118 120 // Show post thumbnail? … … 135 137 136 138 // Show post times ago? 137 'show_times_ago' => false,139 'show_times_ago' => true, 138 140 139 141 // Show post category? … … 142 144 // Show post comments? 143 145 'show_comments' => false, 146 147 // Show views? 148 'show_views' => true, 144 149 145 150 // Icon to show before title … … 152 157 'item_class' => '' 153 158 ], $atts ); 159 154 160 155 161 include 'shortcode-' . $a['layout'] . '.php'; … … 157 163 } 158 164 159 function albnet_get_args($a) { 165 function albnet_get_args($conf) { 166 160 167 161 168 /** 162 169 * Post type 163 170 */ 164 $a rgs['post_type'] = $a['post_type'];171 $albnet_args['post_type'] = $conf['post_type']; 165 172 166 173 /** 167 174 * Posts per page 168 175 */ 169 $a rgs['posts_per_page'] = $a['posts_per_page'];176 $albnet_args['posts_per_page'] = $conf['posts_per_page']; 170 177 171 178 /** 172 179 * Current page 173 180 */ 174 $a rgs['paged'] = $a['paged'];181 $albnet_args['paged'] = $conf['paged']; 175 182 176 183 /** 177 184 * Check if has paged 178 185 */ 179 if(!$a rgs['paged']) {186 if(!$albnet_args['paged']) { 180 187 /** 181 188 * If paged remove offset setting 182 189 */ 183 $a rgs['offset'] = $a['offset'];190 $albnet_args['offset'] = $conf['offset']; 184 191 } 185 192 … … 187 194 * Show only posts with featured images 188 195 */ 189 if($ a['only_with_thumb']) {190 $a rgs['meta_query'] = [196 if($conf['only_with_thumb']) { 197 $albnet_args['meta_query'] = [ 191 198 [ 192 199 'key' => '_thumbnail_id', … … 199 206 * Remove offset setting if is paginated 200 207 */ 201 if($ a['paged']) {202 unset($a rgs['offset']);208 if($conf['paged']) { 209 unset($albnet_args['offset']); 203 210 } 204 211 … … 206 213 * Check if has fields to filter by taxonomy 207 214 */ 208 if($ a['taxonomy'] && $a['field'] && $a['terms']) {209 $a rgs['tax_query'] = [215 if($conf['taxonomy'] && $conf['field'] && $conf['terms']) { 216 $albnet_args['tax_query'] = [ 210 217 [ 211 'taxonomy' => $ a['taxonomy'],212 'field' => $ a['field'],213 'terms' => $ a['terms']218 'taxonomy' => $conf['taxonomy'], 219 'field' => $conf['field'], 220 'terms' => $conf['terms'] 214 221 ] 215 222 ]; … … 219 226 * Set posts ordering 220 227 */ 221 $args['order'] = $a['order']; 222 $args['orderby'] = $a['orderby']; 223 224 return $args; 228 $albnet_args['order'] = $conf['order']; 229 $albnet_args['orderby'] = $conf['orderby']; 230 231 /** 232 * Query optmizations 233 */ 234 $albnet_args['no_found_rows'] = true; 235 $albnet_args['update_post_meta_cache'] = false; 236 $albnet_args['update_post_term_cache'] = false; 237 //$albnet_args['fields'] = 'ids'; 238 239 240 return array_filter($albnet_args); 225 241 } -
albnet-shortcodes/trunk/shortcode-horizontal.php
r2007350 r2007718 1 1 <?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); ?> 2 2 <div class="albnet-horizontal albnet-<?php echo $a['terms']; ?>"> 3 3 4 <?php 4 5 5 6 $args = albnet_get_args($a); 6 7 7 8 $the_query = new WP_Query($args); 8 9 … … 16 17 <?php $index = 1; while ( $the_query->have_posts() ) { $the_query->the_post(); ?> 17 18 <?php 18 $tipo_video = get_field('tipo_do_video'); 19 $id_video = get_field('id_video'); 20 $video_ao_vivo = get_field('ao_vivo'); 21 $descricao_do_video = get_field('descricao_do_video'); 19 if($a['post_type'] == 'videos'){ 20 $tipo_video = get_field('tipo_do_video'); 21 $id_video = get_field('id_video'); 22 $video_ao_vivo = get_field('ao_vivo'); 23 $descricao_do_video = get_field('descricao_do_video'); 24 } 22 25 ?> 23 26 <div class="uk-card uk-card-small"> -
albnet-shortcodes/trunk/style.css
r2007320 r2007718 161 161 margin: 0 162 162 } 163 .uk-card-title { 164 font-size: 1rem; 165 position: relative; 166 top: -2px; 167 } 168 .albnet-horizontal .uk-card-title { 169 position: relative; 170 top: -2px; 171 } 172 .albnet-horizontal.albnet-amazonas .uk-card-title { 173 font-size: 1.7rem 174 } 163 175 @media all and (max-width: 980px) { 164 .box-bordered {165 border: none;166 padding: 0;167 }176 .box-bordered { 177 border: none; 178 padding: 0; 179 } 168 180 header { 169 181 padding-right: 10px;
Note: See TracChangeset
for help on using the changeset viewer.