Plugin Directory

Changeset 1181709


Ignore:
Timestamp:
06/16/2015 08:48:49 AM (11 years ago)
Author:
sachin8600
Message:

Solving category issue

Location:
post-shortcode/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • post-shortcode/trunk/inc/pcs-ajax.php

    r1169087 r1181709  
    22/**
    33* @since 2.0
    4  * Adds ajax function.
    5  */
     4* Adds ajax function.
     5* @version 2.0.1
     6*/
    67add_action( 'wp_ajax_pcs_get_cat', 'pcs_get_cat_callback' );
    78add_action( 'wp_ajax_nopriv_pcs_get_cat', 'pcs_get_cat_callback' );
     
    1213    foreach ($acs as $ckey => $cvalue) {
    1314        foreach ($cvalue as $ck => $cv) {
     15            $cckey = $ckey."$".$cv->slug;
    1416            ?>
    15             <option value="<?php echo $cv->slug; ?>" <?php if(in_array( $cv->slug, $categories )  ) echo "selected"; ?>>
    16             <?php echo $cv->slug; ?>
     17            <option value="<?php echo $cckey; ?>" <?php if(in_array( $cckey, $categories )  ) echo "selected"; ?>>
     18            <?php echo $cv->slug." ( ".$ckey." )"; ?>
    1719            </option>
    1820            <?php
  • post-shortcode/trunk/inc/pcs-shortcode.php

    r1169087 r1181709  
    11<?php
    22/**
    3 * @since 2.0
     3* @since 2.0.0
    44* Add shortcode
    55*/
     
    2626
    2727/**
     28* @version 2.0.1
    2829* get output of post query
    2930*/
    3031function pcs_get_post_output($a){
     32    //global $wpdb;
    3133    extract($a);
    3234    $args['post_type'] = explode(",", $posttype);
     
    3537    $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
    3638    $args['paged'] = $paged;
    37     if(!empty($categories)) $args['category_name'] = $categories;
     39    if(!empty($categories)):
     40    $acat = explode(",", $categories);
     41    foreach ($acat as $catkey => $catvalue) {
     42        $actt = explode("$", $catvalue);
     43        $ctkey = $actt[0];
     44        $ctvalue = $actt[1];
     45        $afctt[$ctkey][] = $ctvalue;
     46    }
     47    foreach ($afctt as $afckey => $afcvalue) {
     48        $tax[] = array(
     49                'taxonomy' => $afckey,
     50                'field'    => 'slug',
     51                'terms'    => $afcvalue,
     52            );
     53    }
     54    $tax_query = array(
     55            'relation' => 'OR',
     56            $tax
     57        );
     58    $args['tax_query'] = $tax_query;
     59    endif;
    3860    $args['orderby'] = $orderby;
    3961    $args['order']   = $order;
    4062    $ashowfield =explode(",", $showfield);
    41     function pcs_excerpt_length( $length ) {
    42     return $expertlength;
    43     }
    44     add_filter( 'excerpt_length', 'pcs_excerpt_length', 999 );
    45     //echo "<pre>"; print_r($args); die;
     63    add_filter( 'excerpt_length', function( $length ) { return $expertlength; }, 999 );
     64    //echo "<pre>"; print_r($args);
    4665    query_posts($args);
     66    //echo $wpdb->last_query;
    4767    // The Loop
    4868    if ( have_posts() ) :
  • post-shortcode/trunk/inc/pcs-widget.php

    r1169087 r1181709  
    33 * @since 2.0
    44 * Adds PCS_Widget widget.
     5 * @version 2.0.1
    56 */
    67class PCS_Widget extends WP_Widget {
     
    175176            foreach ($acs as $ckey => $cvalue) {
    176177                foreach ($cvalue as $ck => $cv) {
     178                    $cckey = $ckey."$".$cv->slug;
    177179                    ?>
    178                     <option value="<?php echo $cv->slug; ?>" <?php if(in_array( $cv->slug, $categories )  ) echo "selected"; ?>>
    179                     <?php echo $cv->slug; ?>
     180                    <option value="<?php echo $cckey; ?>" <?php if(in_array( $cckey, $categories )  ) echo "selected"; ?>>
     181                    <?php echo $cv->slug." ( ".$ckey." )"; ?>
    180182                    </option>
    181183                    <?php
    182184                }
    183                 ?>
    184             <?php } ?>
     185            } ?>
    185186        </select>
    186187        </p>
  • post-shortcode/trunk/inc/tiny-shortcode.php

    r1169087 r1181709  
    5454                    );
    5555
    56                 $aCategory[] =  get_categories( $args );
     56                $aCategory[$tax] =  get_categories( $args );
    5757             }
    5858        }
  • post-shortcode/trunk/post-shortcode.php

    r1169087 r1181709  
    44 * Plugin URI:
    55 * Description: An post display beautifully.
    6  * Version: 2.0.0
     6 * Version: 2.0.1
    77 * Author: Sachin Jadhav
    88 * Author URI: http://sachin8600.wordpress.com/
  • post-shortcode/trunk/readme.txt

    r1169087 r1181709  
    11=== Plugin Name ===
    2 Contributors: (sachin8600)
     2Contributors: sachin8600
    33Donate link:
    4 Tags: post, custom-post, widget, shortcode, category-post
     4Tags: post, custom-post, post-widget, post-shortcode, custom-taxonomy, category
    55Requires at least: 3.4.1
    66Tested up to: 4.2.2
    7 Stable tag: 2.0.0
     7Stable tag: trunk
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    108108
    109109== Upgrade Notice ==
    110 = 1.0.1 =
     110= 2.0.1 =
     111Solving bug about category and excerpt.
     112= 2.0.0 =
    111113This change of whole plugin its like new plugin with same name.
    112 = 1.0 =
    113 Upgrade notices describe the reason a user should upgrade.  No more than 300 characters.
    114 
    115 = 0.5 =
    116 This version fixes a security related bug.  Upgrade immediately.
Note: See TracChangeset for help on using the changeset viewer.