最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to fix a specific page (author archive) loading speed?

programmeradmin2浏览0评论

For some reason, author pages on my blog are loading extremely slow, even for authors that have very few posts, as you can see [here][1]. I am not a developer, but I can understand the code a little bit. Please assist, thank you.

        <?php 
        // Register Calendar widget scripts
       function snaplap_widget_calendar_scripts_and_styles(){
        wp_register_style( 'LatoWidget', get_stylesheet_directory_uri() . '/js_calendar/css/Lato_300_400_700.css');
        wp_enqueue_style( 'Lato' );
        wp_register_style( 'FontAwasomeCalendarWidget', get_stylesheet_directory_uri() . '/js_calendar/css/fontawesome.css');
        wp_enqueue_style( 'FontAwasomeCalendarWidget' );
        wp_register_style( 'stylePersonalCalendarWidget', get_stylesheet_directory_uri() . '/js_calendar/css/style-personal.css');
        wp_enqueue_style( 'stylePersonalCalendarWidget' );

        // Register and Enqueue a Script
        // get_stylesheet_directory_uri will look up child theme location
        wp_register_script( 'jQueryLatestCalendarWidget', get_stylesheet_directory_uri() . '/js_calendar/js/jquery-latest.min.js');
        wp_enqueue_script( 'jQueryLatestCalendarWidget' );
        wp_register_script( 'simpleCalendarWidget', get_stylesheet_directory_uri() . '/js_calendar/js/simplecalendar.js');
        wp_enqueue_script( 'simpleCalendarWidget' );
    }

    add_action('wp_enqueue_scripts', 'snaplap_widget_calendar_scripts_and_styles'); 

 get_header(); ?>

    <div id="core" class="snap-left-working-area search-result">

        <div id="content">

                    <?php
                    $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));

                    $wp_query->query_vars['page'] > 1 ? $current = $wp_query->query_vars['page'] : $current = 1;
                    query_posts( array(
                        'post_type' => array('post','magazines'),
                        'author' => $author,                    
                        'posts_per_page' => 5,
                        'paged' => $current ) 
                    );

                    if (have_posts()) : ?>

                    <h1><?php _e('Author : ','vergo'); echo $curauth->display_name; ?></h1>

                <div style="clear: both;"></div>

                <div class="postauthor">

                    <?php echo get_avatar($curauth->user_email, 90 ); ?>

                    <p class="authordesc">
                        <?php _e('Website','vergo');?>: <a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a><br/>
                        <?php echo $curauth->user_description; ?>
                    </p>

                </div>

                <div style="clear: both;"></div>

                <ul class="archivepost">

                    <?php while (have_posts()) : the_post();
 get_template_part('/includes/post-types/archivepost'); 
 endwhile; ?>   <!-- end post -->

                </ul><!-- end latest posts section-->

                <div style="clear: both;"></div>

                        <div class="pagination"><?php pagination('&laquo;', '&raquo;'); ?></div>

                        <?php else : ?>         

                            <h3>This author has not created any posts.</h3>

                            <?php get_search_form(); ?><br/>
                        <?php endif; ?>

        </div><!-- end #core .eightcol-->

        <!-- #sidebar -->          

        <!--<div id="core_bg"></div>-->

    </div><!-- #core -->

    <div id="rightsidebar" class="body2 snap-right-part-new">
        <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Right Sidebar") ) : 
endif; ?>
    </div>

    <?php get_footer(); ?>

  [1]: /
发布评论

评论列表(0)

  1. 暂无评论