Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • yes the archive for change is: class-pwb-filter-by-brand.php

    classes/widgets/class-pwb-filter-by-brand.php

    here my modified file:

    https://drive.google.com/file/d/1TBQKGkHtW0wxkvfSnm2jG3vwaE08Cy20/view?usp=sharing

    here my website working, with all brand:

    https://www.newmaster.com.ar/categoria-producto/perifericos/pad/

    • This reply was modified 6 years, 3 months ago by estudiosmedia.

    Hi, I have a solution for you.

    Comment the lines 116 y 126 :
    if( $limit > 0 ) $result_brands = array_slice( $result_brands, 0, $limit )

    and writed under the linea 139:

    $result_brands = array_unique($result_brands);

    this:
    if( $limit > 0 ) $result_brands = array_slice( $result_brands, 0, $limit )

    Thread Starter estudiosmedia

    (@estudiosmedia)

    HERE THE CODE :

    Replace in waving-porfolio.php thes functions:

    function waving_func( $atts ) {
        extract( shortcode_atts( array(
                'effect' => 12,
                'width' => 0,
                'height' => 250,
                'theme'=> 'dark',
                'all' => 'true',
                'clicking' => 'true',
                'showcat' => 'true',
                'tag' => '',
                'limit'=>-1),
                $atts ) );
    
        return $this->Building_Portfolio_List($width, $height, $effect,$theme,$tag, $showcat, $all, $clicking,$limit);
      }
    
    ----------------------------------------------------------------
    
    function Building_Portfolio_List($width, $height, $fx, $theme, $tag, $showCategory,$all, $click,$limit)
      {
          if($click == "true") $disableClicking2 = 'class="md-trigger"';
          else $disableClicking2 = '';
    
          $disableClicking = "";
    
          $waving_meta = array();
          $lists = array();
          $modals = array();
          $paramCustom = array();
          $categoryMenu = array();
          // Filtered category list
          $cat_lists = array();
    
          // Get portfolio posts
          $type = 'itech_portfolio';
    
          // Check whether tag is empty or not
          $tagCondition = ($tag=='')?null:$tag;
    
          $listHeader = '<section id="portfolio" style="text-align:center"><ul id="da-thumbs" class="da-thumbs-'.$tagCondition.'">';
          $listFooter = '</section>';
    
          $i = 1;
    
          $args=array(
            'post_type' => $type,
            'post_status' => 'publish',
            'posts_per_page' => $limit,
            'waving_portfolio_tag' => $tagCondition,
            'cache_results' => false);
    
          if($theme == 'light')
          {
              wp_enqueue_style( 'waving-portfolio-modal-light-theme',
                      plugins_url( 'assets/css/light.css' , __FILE__ ));
          }
    
          // print out categories
          $taxonomy = 'waving_portfolio_category';
          $image_code = '';
    
          $my_query = null;
          $my_query = new WP_Query($args);
          if( $my_query->have_posts() ) {
              while ($my_query->have_posts()) : $my_query->the_post(); 
    
                  $i = rand(); 
    
                  // Initialize categories to be used for categories menu rendering
                $temp_cat_cmp_array[] = get_the_terms( get_the_ID(),$taxonomy);
    
                // ========= Start: Ensure that cat_list variable is unique ============
    
                if(count($temp_cat_cmp_array) != 0 && $temp_cat_cmp_array[0] != null){
                  foreach($temp_cat_cmp_array[0] as $cat_cmp)
                  {
                    $cmp_result = false;
                    if(count($cat_lists) != 0){
                      foreach($cat_lists as $cat_val)
                      {
                        if($cat_val == $cat_cmp)
                        {
                          $cmp_result = true;
                        }
                      }
                    }
                    if(!$cmp_result)
                    {
                      array_push($cat_lists, $cat_cmp);
                    }
                  }
                }
    
    			// Sort categories that will be printed out as buttons
                usort($cat_lists, array($this,'sortByOrder'));
    
                unset($temp_cat_cmp_array);
                $temp_cat_cmp_array = array();
    
                  // ========= End: Ensure that cat_list variable is unique ============
                  //Extract meta information
                  $waving_meta = get_post_meta( get_the_ID() );
    
                  // Title and description for sliding panel
                  $description = false;
                  // Hyperlink or image on click event over panel
                  $hyperlinkSelection = false;
                  $hyperlink = "";
                  $panel = "";
                  $fontsize = "15";
                  $excerptLength = "20";
                  $imageList = array();
    
                  if(isset($waving_meta[$this->meta_prefix.'hori']))
                  {
                    $hyperlinkSelection = ($waving_meta[$this->meta_prefix.'hori'][0]=='on')?true:false;
                  }
    
                  if(isset($waving_meta[$this->meta_prefix.'fontsize']))
                  {
                    $fontsize = ($waving_meta[$this->meta_prefix.'fontsize'][0]);
                  }
    
                  if(isset($waving_meta[$this->meta_prefix.'excerpt']))
                  {
                    $description = ($waving_meta[$this->meta_prefix.'excerpt'][0]=='on')?true:false;
                  }
    
                  if(isset($waving_meta[$this->meta_prefix.'excerpt_length']))
                  {
                    $excerptLength = ($waving_meta[$this->meta_prefix.'excerpt_length'][0]);
                  }
    
                  if(isset($waving_meta[$this->meta_prefix.'hyperlink']))
                  {
                    $hyperlink = $waving_meta[$this->meta_prefix.'hyperlink'][0];
                  }
    
                  if(isset($waving_meta[$this->meta_prefix.'file_list']))
                  {
                    $imageList = unserialize($waving_meta[$this->meta_prefix.'file_list'][0]);
                  }
    
                  $image = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID() ), 'single-post-thumbnail' );
                  // IF there is no image don't render a list
                  if($image!=""){
                      $gImages = $imageList;
                      $gallary = "";
    
                      // Building the gallary
                      if(!empty($gImages) ){
                          $j=1;
                          foreach($gImages as $img){
                              $gallary = $gallary.'<a href="'.$img.'" rel="portfolios'.$i.'"><img class="multiple-borders" src="'.$img.'" width="100" /></a>';
                          }
                      }
    
                      if($hyperlinkSelection)
                      {
                        $disableClicking = "href='".$hyperlink."'";
                      }else{
                        $disableClicking = $disableClicking2;
                      }
    
                      $modal = '<div class="md-modal md-effect-12" id="modal-'.$i.'">
                        <div id="md-close" class="waving-close"></div>
                        <div class="md-content waving-content">
                          <h3>'.  get_the_title().'</h3>
                          <div class="modal-waving-content">
                          <div class="modal-gallary">
                              '.$gallary.'
    
                            </div>'.
                              apply_filters('the_content', get_the_content()).'</div>
                        </div>
                        </div>';
    
                      $categories = get_the_terms( get_the_ID(),$taxonomy);
                      $cat_class = "";
                      if( $categories ){
                        foreach($categories as $cat)
                        {
                          $cat_class = $cat_class. " waving-" . $cat->slug;
                        }
                      }
    
                      if($width != 0){
                        $image_code = '<img src="'.$image[0].'" style="width:'.$width.'px" />';
                      }else
                      {
                        $image_code = '<img src="'.$image[0].'" style="height:'.$height.'px" >';
                      }
    
                      if($description)
                      {
                        $content = get_the_excerpt();
                        $content = substr($content, 0, $excerptLength);
    
                        $list = '<li class="waving-item '.$cat_class.'">
                          <a>
                            '.$image_code.'
                            <div style="display: block; left: 100%; top: 0px; overflow: hidden; -webkit-transition: all 300ms ease; transition: all 300ms ease;">
                              <span style="margin: 20px 15px 0px !important;padding:3px 0 !important;font-size:'.$fontsize.'px !important">'.get_the_title().'</span>
                              <p style="font-size:'.$fontsize.'px !important;color: white !important;width: 80% !important;margin: 5px 13px 0px !important;">
                                '.$content.'...
                              </p>
                            </div>
                          </a>
                        ';
                      }else{
                        $list = '<li class="waving-item '.$cat_class.'">
                          <a>
                            '.$image_code.'
                            <div style="display: block; left: 100%; top: 0px; overflow: hidden; -webkit-transition: all 300ms ease; transition: all 300ms ease;">
                              <span style="font-size:'.$fontsize.'px">'.get_the_title().'</span>
                            </div>
                          </a>
                        ';
                      }
    
                      array_push($modals, $modal);
                      array_push($lists, $list);
                      $i++;
                  }
              endwhile;
          }
          wp_reset_query();
    
          // ========= Start: Print out categories ============
          if(count($cat_lists)!=0){
            $paramCustom = array("all" => $all,
              "initialClass"=>$cat_lists[0]->slug);
          }else{
            $paramCustom = array("all" => "1",
              "initialClass"=>"0");
          }
    
          if($all == "true" && count($cat_lists)!=0)
          {
            $categoryMenu[] = '<button class="waving-button action-button shadow animate blue" onClick="ShowLists(\'all\',\''.$tagCondition.'\')">All</button>';
          }
    
          if(count($cat_lists)!=0){
            foreach($cat_lists as $term_cat)
            {
              $categoryMenu[] = '<button class="waving-button action-button shadow animate blue" onClick="ShowLists(\''.$term_cat->slug.'\',\''.$tagCondition.'\')">'.ucfirst($term_cat->name).'</button>';
            }
          }
    
          // ========= End: Print out categories ============
    
          $static = '<div class="md-overlay"></div><div id="waving-dim"></div>';
    
          wp_localize_script( 'waving-portfolio-custom-script', 'pluginSetting', $paramCustom );
    
          $catMenu = ($showCategory=="true")?implode("",$categoryMenu):'';
    
          return $catMenu.''.implode("",$modals).''.$listHeader.''.implode("",$lists).''.$listFooter.''.$static;
      }

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been damaged by the forum’s parser.]

Viewing 3 replies - 1 through 3 (of 3 total)