Forum Replies Created

Viewing 10 replies - 46 through 55 (of 55 total)
  • Thread Starter tahoom

    (@tahoom)

    Thanks so much
    now it’s working great

    Thread Starter tahoom

    (@tahoom)

    thanks @andrew
    The theme has a slider for posts of the blog, the only place I can find the codes for this slider is in style.css and all of the codes for this slider is:

    &.mpc-vc-blog-posts-slider {
    			.mpcth-slide-wrap {
    				float: left; // non-RTL
    			}
    			.mpcth-slide {
    				position: relative;
    				display: block;
    				overflow: hidden;
    				padding-right: 20px;
    				padding-left: 20px;
    				height: 152px;
    				float: none;
    				max-width: none;
    
    				&.mpcth-slide-row-gap {
    					margin-bottom: 1.5em;
    				}
    
    				img {
    					position: relative;
    					z-index: 2;
    					display: block;
    					width: 200px;
    					height: auto;
    					@include float(left); // float: left;
    					@include margin-right(20px); // margin-right: 20px;
    					@include margin-left(-20px); // margin-left: -20px;
    				}
    
    				.mpcth-slide-title {
    					text-transform: uppercase;
    					margin: 1em 0 .25em;
    				}
    				.mpcth-slide-time {
    					text-transform: uppercase;
    					color: #666666;
    					font-size: .923em;
    				}
    				.mpcth-slide-text {
    					color: #666666;
    					text-align: justify;
    					line-height: 1.5em;
    				}
    				.mpcth-slide-trim {
    					position: absolute;
    					bottom: 0;
    					left: 0; // non-RTL
    					background: linear-gradient(to bottom, rgba(255,255,255, 0) 0%, rgba(255,255,255, 1) 90%);
    					background-image: -webkit-gradient(linear, 0% 0%, 0% 90%, from(rgba(255,255,255, 0)), to(rgba(255,255,255, 1)));
    					background-image: -moz-linear-gradient(rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 90%);
    					filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00ffffff, endColorstr=#ffffffff);
    					-ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00ffffff, endColorstr=#ffffffff);
    					width: 100%;
    					height: 2em;
    					z-index: 1;
    				}
    
    				@media #{$screen-large} {
    					.mpcth-responsive & {
    						height: 173px;
    
    						img {
    							width: 260px;
    						}
    					}
    				}
    				@media only screen and (max-width: 640px) {
    					.mpcth-responsive & {
    						height: auto;
    						padding-left: 0;
    						padding-right: 0;
    
    						img {
    							float: none;
    							width: 100%;
    							margin: 0 0 1em 0;
    						}
    
    						.mpcth-slide-wrapper {
    							padding-left: 20px;
    							padding-right: 20px;
    						}
    					}
    				}
    			}
    		}

    and the codes for the image I think is the codes in my previous post. This code calls a image with 200px width auto height but actually it loads a 600×450 image wich defined in functions.php as “horizontal-2” and in GTMETRIX my website has a “Serve scaled images” problem wich loads more than 150KB for this difference in image loading. Can I call the predefined “hoizontal-4” image in functions.php instead of the image style.css calls as 200px width?
    a code like:
    <?php the_post_thumbnail( $size, $attr ); ?>
    in php files.

    Thread Starter tahoom

    (@tahoom)

    maybe my code in here would help to solve the problem

    <?php
    $output = $title = $type = $count = $interval = $slides_content = $link = '';
    $custom_links = $thumb_size = $posttypes = $posts_in = $categories = '';
    $orderby = $order = $el_class = $link_image_start = '';
    extract(shortcode_atts(array(
        'title' => '',
        'type' => 'flexslider_fade',
        'count' => 3,
        'interval' => 3,
        'slides_content' => '',
        'slides_title' => '',
        'link' => 'link_post',
        'custom_links' => site_url().'/',
        'thumb_size' => 'medium',
        'posttypes' => '',
        'posts_in' => '',
        'categories' => '',
        'orderby' => NULL,
        'order' => 'DESC',
        'el_class' => ''
    ), $atts));
    
    $gal_images = '';
    $link_start = '';
    $link_end = '';
    $el_start = '';
    $el_end = '';
    $slides_wrap_start = '';
    $slides_wrap_end = '';
    
    $el_class = $this->getExtraClass($el_class);
    
    if ( $type == 'nivo' ) {
        $type = ' wpb_slider_nivo theme-default';
        wp_enqueue_script( 'nivo-slider' );
        wp_enqueue_style( 'nivo-slider-css' );
        wp_enqueue_style( 'nivo-slider-theme' );
    
        $slides_wrap_start = '<div class="nivoSlider">';
        $slides_wrap_end = '</div>';
    } else if ( $type == 'flexslider' || $type == 'flexslider_fade' || $type == 'flexslider_slide' || $type == 'fading' ) {
        $el_start = '<li>';
        $el_end = '</li>';
        $slides_wrap_start = '<ul class="slides">';
        $slides_wrap_end = '</ul>';
        wp_enqueue_style('flexslider');
        wp_enqueue_script('flexslider');
    }
    $flex_fx = '';
    if ( $type == 'flexslider' || $type == 'flexslider_fade' || $type == 'fading' ) {
        $type = ' wpb_flexslider flexslider_fade flexslider';
        $flex_fx = ' data-flex_fx="fade"';
    } else if ( $type == 'flexslider_slide' ) {
        $type = ' wpb_flexslider flexslider_slide flexslider';
        $flex_fx = ' data-flex_fx="slide"';
    }
    
    if ( $link == 'link_image' ) {
        wp_enqueue_script( 'prettyphoto' );
        wp_enqueue_style( 'prettyphoto' );
    }
    
    $query_args = array();
    
    //exclude current post/page from query
    if ( $posts_in == '' ) {
        global $post;
        $query_args['post__not_in'] = array($post->ID);
    }
    else if ( $posts_in != '' ) {
        $query_args['post__in'] = explode(",", $posts_in);
    }
    
    // Post teasers count
    if ( $count != '' && !is_numeric($count) ) $count = -1;
    if ( $count != '' && is_numeric($count) ) $query_args['posts_per_page'] = $count;
    
    // Post types
    $pt = array();
    if ( $posttypes != '' ) {
        $posttypes = explode(",", $posttypes);
        foreach ( $posttypes as $post_type ) {
            array_push($pt, $post_type);
        }
        $query_args['post_type'] = $pt;
    }
    
    // Narrow by categories
    if ( $categories != '' ) {
        $categories = explode(",", $categories);
        $gc = array();
        foreach ( $categories as $grid_cat ) {
            array_push($gc, $grid_cat);
        }
        $gc = implode(",", $gc);
        $query_args['category_name'] = $gc;
    
        $taxonomies = get_taxonomies('', 'object');
        $query_args['tax_query'] = array('relation' => 'OR');
        foreach ( $taxonomies as $t ) {
            if ( in_array($t->object_type[0], $pt) ) {
                $query_args['tax_query'][] = array(
                    'taxonomy' => $t->name,//$t->name,//'portfolio_category',
                    'terms' => $categories,
                    'field' => 'slug',
                );
            }
        }
    }
    
    // Order posts
    if ( $orderby != NULL ) {
        $query_args['orderby'] = $orderby;
    }
    $query_args['order'] = $order;
    
    // Run query
    $my_query = new WP_Query($query_args);
    
    $pretty_rel_random = 'rel-'.rand();
    if ( $link == 'custom_link' ) { $custom_links = explode( ',', $custom_links); }
    $teasers = '';
    $i = -1;
    
    while ( $my_query->have_posts() ) {
        $i++;
        $my_query->the_post();
        $post_title = the_title("", "", false);
        $post_id = $my_query->post->ID;
        if ( $slides_content == 'teaser' ) {
            $content = do_shortcode(apply_filters('the_excerpt', get_the_excerpt()));//get_the_excerpt();
        } else {
            $content = '';
        }
        $thumbnail = '';
    
        // Thumbnail logic
        $post_thumbnail = $p_img_large = '';
    
        $post_thumbnail = wpb_getImageBySize(array( 'post_id' => $post_id, 'thumb_size' => $thumb_size ));
        $thumbnail = $post_thumbnail['thumbnail'];
        $p_img_large = $post_thumbnail['p_img_large'];
    
        // Link logic
        if ( $link != 'link_no' ) {
            if ( $link == 'link_post' ) {
                $link_image_start = '<a class="link_image" href="'.get_permalink($post_id).'" title="'.sprintf( esc_attr__( 'Permalink to %s', 'js_composer' ), the_title_attribute( 'echo=0' ) ).'">';
            }
            else if ( $link == 'link_image' ) {
                $p_video = get_post_meta($post_id, "_p_video", true);
                //
                if ( $p_video != "" ) {
                    $p_link = $p_video;
                } else {
                    $p_link = $p_img_large[0]; // TODO!!!
                }
                $link_image_start = '<a class="link_image prettyphoto" href="'.$p_link.'" title="'.the_title_attribute('echo=0').'" >';
            }
            else if ( $link == 'custom_link' ) {
                if (isset($custom_links[$i])) {
                    $slide_custom_link = $custom_links[$i];
                } else {
                    $slide_custom_link = $custom_links[0];
                }
                $link_image_start = '<a class="link_image" href="'.$slide_custom_link.'">';
            }
    
            $link_image_end = '</a>';
        } else {
            $link_image_start = '';
            $link_image_end = '';
        }
    
        $description = '';
        if ( $slides_content != '' && $content != '' && ( $type == ' wpb_flexslider flexslider_fade flexslider' || $type == ' wpb_flexslider flexslider_slide flexslider' ) ) {
            $description = '<div class="flex-caption">';
            if ($slides_title==true) $description .= '<h5 class="post-title">' . $link_image_start . $post_title . $link_image_end .'</h5>';
            $description .= $content;
            $description .= '</div>';
        }
    
        $teasers .= $el_start . $link_image_start . $thumbnail . $link_image_end . $description . $el_end;
    } // endwhile loop
    wp_reset_query();
    
    if ( $teasers ) { $teasers = $slides_wrap_start. $teasers . $slides_wrap_end; }
    else { $teasers = __("Nothing found." , "js_composer"); }
    
    $css_class =  apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'wpb_gallery wpb_posts_slider wpb_content_element'.$el_class, $this->settings['base']);
    
    $output .= "\n\t".'<div class="'.$css_class.'">';
    $output .= "\n\t\t".'<div class="wpb_wrapper">';
    $output .= wpb_widget_title(array('title' => $title, 'extraclass' => 'wpb_posts_slider_heading'));
    $output .= '<div class="wpb_gallery_slides'.$type.'" data-interval="'.$interval.'"'.$flex_fx.'>'.$teasers.'</div>';
    $output .= "\n\t\t".'</div> '.$this->endBlockComment('.wpb_wrapper');
    $output .= "\n\t".'</div> '.$this->endBlockComment('.wpb_gallery');
    
    echo $output;
    Thread Starter tahoom

    (@tahoom)

    here is the ticket:
    https://wordpress.org/support/topic/bad-response-from-smushit-7?replies=1#post-6690902

    I do that just because of you David and your nice response.

    Thread Starter tahoom

    (@tahoom)

    someone help please

    Thread Starter tahoom

    (@tahoom)

    any body can help me?

    Hi again Frank
    why is my AO cache get bigger and bigger until I click on “save and empty cache” button in AO settings!?(the biggest quantity I saw was 650-700 MB)

    Thank you so much.
    I would try that.

    Thanks for fast response, I’m newbie to wordpress and don’t know any coding. Sorry to ask, for jquery, fonts googlepapis and jckqv_styles I think you say AO won’t do anything, am I understand right?

    and for the the 2 autoptimize CSS-files do you mean to enabling defer CSS loading? because I did that and have problems in my homepage loading.

    Hi Frank
    I installed Autoptimize for few days specially because of “defer parsing of javascript” that GTMetrix says. your plugin really worked for that. I have W3 total cache too and as you suggested I disables Minify setting in it and use your plugin’s HTML, Javascript and CSS optimization. and here are the changes before Autoptimze and after that:
    Recommendation before after
    Defer parsing of JavaScript 55 100
    Inline small CSS 78 84
    Inline small JavaScript 92 100
    Optimize the order of styles and scripts 100 85
    Avoid CSS @import 100 85
    and some other minor differents. Page speed score didn’d change and steel is 79% (I have always bad points on my images).
    My Total number of requests came down from 87 to 49 and that’s huge, thanks.YSlow Grade growth from 81 to 88%.
    I didn’t run PageSpeed Insights before the plugin but now I checked that and you can see the results for my website: http://www.tamtaragh.com
    63/100!! and my site is really slow!!
    again bad points on images, and these too:

    Remove render-blocking JavaScript:
    http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js

    Optimize CSS Delivery of the following:
    http://www.tamtaragh.com/…ize_41fafcebfef68032cc953e8259943472.css
    http://fonts.googleapis.com/css?family=Open+Sans:400,800,300,700
    http://fonts.googleapis.com/css?family=Dancing+Script
    http://www.tamtaragh.com/…ize_92e08cbd425c405250f074ea9b611259.css
    http://www.tamtaragh.com/…admin/admin-ajax.php?action=jckqv_styles
    http://fonts.googleapis.com/css?family=Lato%3A700

    I didn’t enable Force Javascript in head and looks for scripts in head becaause it cause “DEFER PARSING OF JAVASCRIPT” in gtmetrix! and didn’t enable look for styles in head,deffer CSS loading and inline all CSS.
    where is the problem?

Viewing 10 replies - 46 through 55 (of 55 total)