Add the following lines to your WordPress .htaccess
<IfModule mod_headers.c>
<FilesMatch ".(js|css|xml|gz|html)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
Add the following lines to your WordPress .htaccess
<IfModule mod_headers.c>
<FilesMatch ".(js|css|xml|gz|html)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
How to speedup your slow WordPress website?
function thumbpost_list_shortcode($atts){
extract( shortcode_atts( array(
'count' => 3,
), $atts) );
$q = new WP_Query(
array('posts_per_page' => $count, 'post_type' => 'post')
);
$list = '<ul>';
while($q->have_posts()) : $q->the_post();
$idd = get_the_ID();
$list .= '
<li>
<img src="<?php echo get_template_directory_uri(); ?>/assets/img/latest-post/1.png" alt="" />
'.get_the_post_thumbnail($idd,'thumbnail').'
<p><a href="'.get_permalink().'">'.get_the_title().'</a></p>
<span>'.get_the_date('d F Y', $idd ).'</span>
</li>
';
endwhile;
$list.= '</ul>';
wp_reset_query();
return $list;
}
add_shortcode('latest_post', 'thumbpost_list_shortcode');
function neuron_widget_init() {
// Footer One
register_sidebar(array(
'name' => 'Footer One',
'id' => 'footer-1',
'description' => esc_html__('Add Widget here','neuron-ccdn'),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>'
));
// Footer Two
register_sidebar(array(
'name' => 'Footer Two',
'id' => 'footer-2',
'description' => esc_html__('Add Widget here','neuron-ccdn'),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>'
));
// Footer Three
register_sidebar(array(
'name' => 'Footer Three',
'id' => 'footer-3',
'description' => esc_html__('Add Widget here','neuron-ccdn'),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>'
));
// Footer Four
register_sidebar(array(
'name' => 'Footer Four',
'id' => 'footer-4',
'description' => esc_html__('Add Widget here','neuron-ccdn'),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>'
));
}
add_action('init','neuron_widget_init');
<?php
global $post;
$args = array( 'posts_per_page' => 6, 'post_type'=> 'service', 'orderby' => 'menu_order', 'order' => 'ASC' );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<?php
$service_link= get_post_meta($post->ID, 'service_link', true);
?>
<div class="col-sm-6 col-md-4">
<div class="services-tiem">
<?php the_post_thumbnail('thumbnail', array( 'class' => 'hvr-buzz-out' )); ?>
<h3><a href="<?php echo $service_link; ?>"><?php the_title(); ?></a></h3>
<p><?php the_content(); ?></p>
</div>
</div>
<?php endforeach; wp_reset_query(); ?>