Plugin Directory

Changeset 2471583


Ignore:
Timestamp:
02/09/2021 12:17:05 PM (5 years ago)
Author:
theode
Message:

new version

Location:
tabbed-cats/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tabbed-cats/trunk/readme.txt

    r1302536 r2471583  
    55Requires at least: 3.0
    66Tested up to: 4.5
    7 Stable tag: 0.3
     7Stable tag: trunk
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
  • tabbed-cats/trunk/tab_loop.php

    r1197060 r2471583  
    11<?php
    22
     3/**
     4* Class and Function List:
     5* Function list:
     6* Classes list:
     7*/
    38
    4            
    5             $topcat = $atts['top'];
    6            
    7             $args=array('child_of'=>$topcat);
     9if ( isset ($atts['top']))
     10{
     11    $topcat = ($atts['top'])  ? 0 :  ($atts['top']);
     12}
    813
    9             echo '<div class="tcats">';
     14$args   = [];
     15if (is_int($topcat) && $topcat > 0)
     16{
     17    $args   = array(
     18        'child_of' => $topcat
     19    );
     20}
     21echo '<div id="tcats">';
    1022
    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);
    4124
    4225
    43             // LOOP END
    44             echo '</p></div></div>';
    45             }
     26echo '<ul>';
     27foreach ($categories as $category)
     28{
    4629
    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}
     42echo '</ul>';
     43
     44foreach ($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
     69echo "</div>";
     70echo '<script>jQuery("document").ready(function() {
     71    jQuery( "#tcats" ).tabs();
     72});</script>';
     73
     74?>
  • tabbed-cats/trunk/tabbed-cats.php

    r1197060 r2471583  
    44Plugin URI: http://wordpress.org/plugins/tabbed-cats
    55Description: tabbed cats is plugin to tab categories usage [tabbed_cats top="0"] 
    6 Author: wp-plugin-dev.com
    7 Version: 0.3
    8 Author URI: http://www.wp-plugin-dev.com
     6Author: emojized
     7Version: 0.4
     8Author URI: https://emojized.com
    99
    1010This Plugin is licensed under GPL
     
    2323    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    2424
     25*/
     26
     27/**
     28* Class and Function List:
     29* Function list:
     30* - __construct()
     31* - shortcode()
     32* - styles()
     33* Classes list:
     34* - Tabbed_Cats
     35*/
    2536
    2637
    27 */
     38class Tabbed_Cats
     39{
     40    public function __construct()
     41    {
    2842
    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    }
    3150
    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    {
    4353        ob_start();
    4454        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
    5972}
    60  
     73
    6174$tabbedCats = new Tabbed_Cats;
    6275
    63 
    64 
    6576?>
Note: See TracChangeset for help on using the changeset viewer.