Changeset 2471583
- Timestamp:
- 02/09/2021 12:17:05 PM (5 years ago)
- Location:
- tabbed-cats/trunk
- Files:
-
- 3 edited
-
readme.txt (modified) (1 diff)
-
tab_loop.php (modified) (1 diff)
-
tabbed-cats.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tabbed-cats/trunk/readme.txt
r1302536 r2471583 5 5 Requires at least: 3.0 6 6 Tested up to: 4.5 7 Stable tag: 0.37 Stable tag: trunk 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html -
tabbed-cats/trunk/tab_loop.php
r1197060 r2471583 1 1 <?php 2 2 3 /** 4 * Class and Function List: 5 * Function list: 6 * Classes list: 7 */ 3 8 4 5 $topcat = $atts['top']; 6 7 $args=array('child_of'=>$topcat); 9 if ( isset ($atts['top'])) 10 { 11 $topcat = ($atts['top']) ? 0 : ($atts['top']); 12 } 8 13 9 echo '<div class="tcats">'; 14 $args = []; 15 if (is_int($topcat) && $topcat > 0) 16 { 17 $args = array( 18 'child_of' => $topcat 19 ); 20 } 21 echo '<div id="tcats">'; 10 22 11 $categories = get_categories( $args); 12 foreach($categories as $category){ 13 14 15 echo '<div class="tcat"> 16 <input type="radio" id="tcat-'.$category->slug.'" name="tcat-group-1"> 17 <label for="tcat-'.$category->slug.'">'.$category->name.'</label><div class="tcat_content"><p>'; 18 19 20 //echo '<section id="tcat-'.$category->slug.'"><h2 id="#tcatb"><a href="#tcat-'.$category->slug.'">'.$category->name.'</a></h2><p>'; 21 22 // LOOP with category number 23 24 $cat_num = get_category_by_slug( $category->slug ); 25 26 $cat_id=$cat_num->term_id; 27 28 29 30 31 32 // THE LOOP HERE 33 34 35 36 $args2 = array('posts_per_page' => -1, 'category' => $cat_id, 'orderby' => 'title', 'order'=>'ASC'); // exclude category 9 37 $custom_posts = get_posts($args2); 38 foreach($custom_posts as $post) : setup_postdata($post); 39 echo '<a href="'.$post->guid.'">'.$post->post_title.'</a><BR>'; 40 endforeach; 23 $categories = get_categories($args); 41 24 42 25 43 // LOOP END 44 echo '</p></div></div>'; 45 } 26 echo '<ul>'; 27 foreach ($categories as $category) 28 { 46 29 47 echo "</div>"; 48 49 ?> 30 //echo '<section id="tcat-'.$category->slug.'"><h2 id="#tcatb"><a href="#tcat-'.$category->slug.'">'.$category->name.'</a></h2><p>'; 31 // LOOP with category number 32 $cat_num = get_category_by_slug($category->slug); 33 34 $cat_id = $cat_num->term_id; 35 36 37 echo'<li id="tcat-' . $category->slug . '"><a href="#cattab-'.$cat_id. '">' . $category->name . '</a></li>'; 38 39 40 // THE LOOP HERE 41 } 42 echo '</ul>'; 43 44 foreach ($categories as $category) 45 { 46 $cat_num = get_category_by_slug($category->slug); 47 48 $cat_id = $cat_num->term_id; 49 50 echo '<div id="cattab-'.$cat_id.'">'; 51 $args2 = array( 52 53 'category' => $cat_id, 54 'orderby' => 'title', 55 'order' => 'ASC', 56 'posts_per_page' => -1 57 ); // exclude category 9 58 $custom_posts = get_posts($args2); 59 foreach ($custom_posts as $post): 60 setup_postdata($post); 61 echo '<a href="' . $post->guid . '">' . $post->post_title . '</a><BR>'; 62 endforeach; 63 64 // LOOP END 65 echo '</div>'; 66 } 67 68 69 echo "</div>"; 70 echo '<script>jQuery("document").ready(function() { 71 jQuery( "#tcats" ).tabs(); 72 });</script>'; 73 74 ?> -
tabbed-cats/trunk/tabbed-cats.php
r1197060 r2471583 4 4 Plugin URI: http://wordpress.org/plugins/tabbed-cats 5 5 Description: tabbed cats is plugin to tab categories usage [tabbed_cats top="0"] 6 Author: wp-plugin-dev.com7 Version: 0. 38 Author URI: http ://www.wp-plugin-dev.com6 Author: emojized 7 Version: 0.4 8 Author URI: https://emojized.com 9 9 10 10 This Plugin is licensed under GPL … … 23 23 along with this program. If not, see <http://www.gnu.org/licenses/>. 24 24 25 */ 26 27 /** 28 * Class and Function List: 29 * Function list: 30 * - __construct() 31 * - shortcode() 32 * - styles() 33 * Classes list: 34 * - Tabbed_Cats 35 */ 25 36 26 37 27 */ 38 class Tabbed_Cats 39 { 40 public function __construct() 41 { 28 42 29 // tabbed cats is 30 // http://jsfiddle.net/jacobdubail/bKaxg/ 43 add_shortcode('tabbed_cats', array(&$this, 44 'shortcode' 45 )); 46 add_action('wp_enqueue_scripts', array(&$this, 47 'styles' 48 )); 49 } 31 50 32 33 class Tabbed_Cats { 34 public function __construct() 35 { 36 37 add_shortcode('tabbed_cats', array(&$this, 'shortcode')); 38 add_action('wp_enqueue_scripts', array(&$this, 'styles')); 39 } 40 41 public function shortcode($atts) 42 { 51 public function shortcode($atts) 52 { 43 53 ob_start(); 44 54 include "tab_loop.php"; 45 46 $output_string=ob_get_contents();; 47 ob_end_clean(); 48 return $output_string; 49 } 50 51 public function styles() 52 { 53 54 wp_register_style( 'tabbed_cats-styles', plugin_dir_url( __FILE__ ) . 'tabbed_cats.css' ); 55 wp_enqueue_style( 'tabbed_cats-styles' ); 56 57 } 58 55 56 $output_string = ob_get_contents();; 57 ob_end_clean(); 58 return $output_string; 59 } 60 61 public function styles() 62 { 63 64 wp_enqueue_script('jquery'); 65 // remove this, if you have your own tab styles 66 wp_enqueue_style('tabbed_cats-styles', plugin_dir_url(__FILE__) . 'tabs.css'); 67 68 wp_enqueue_script("jquery-ui-tabs"); 69 70 } 71 59 72 } 60 73 61 74 $tabbedCats = new Tabbed_Cats; 62 75 63 64 65 76 ?>
Note: See TracChangeset
for help on using the changeset viewer.