I use shortcode for member enrolled lectures. but very very

I use shortcode for member enrolled lectures.
but very very slow.
below mycode
-------
<?php
$student = new Student( get_current_user_id() );
$student_courses = $student->get_enrolled_courses_ids();
?>

<?php echo do_shortcode( '[course_list student="' . $student->ID . '" course_status="incomplete" title_link="yes" show="instructors" show_media="yes"]' ); ?>
-----------
help!

My English is very poor. sorry ^^;

  • Vinod Dalvi

    Hi JinTae,

    Welcome to the WPMU Dev community and thank you for your question.

    I use shortcode for member enrolled lectures.
    but very very slow.

    Do you mean your site loads slow when you use that code?

    If yes then could you please share your site URL so that i can test it?

    You can find out using the following tools what is causing your site speed performance.

    http://tools.pingdom.com/fpt/
    https://wordpress.org/plugins/p3-profiler/
    http://gtmetrix.com/

    You can improve Page Load Speed of your site by using the following various solutions.

    https://premium.wpmudev.org/blog/best-wordpress-caching-plugins/
    https://codex.wordpress.org/WordPress_Optimization/WordPress_Performance
    https://codex.wordpress.org/WordPress_Optimization#How_Do_You_Improve_Performance_in_WordPress
    http://www.wpbeginner.com/wp-tutorials/18-useful-tricks-to-speed-up-wordpress-boost-performance/
    https://premium.wpmudev.org/project/wp-smush-pro/
    https://wordpress.org/plugins/wp-optimize/
    https://wordpress.org/plugins/bwp-minify/

    Regards,
    Vinod Dalvi

  • JinTae

    Thank you.

    I have 2 ID.
    I changed mysql, apache setting, yesterday
    diosam Account made before yesterday.
    testid01 Account made today.

    testid01 is no problem. but diosam still have problem.
    you can test with my account.

    // edited due to security reasons

    <?php echo do_shortcode( '[course_list student="' . $student->ID . '" course_status="incomplete" title_link="yes" show="instructors" show_media="yes"]' ); ?>

    this code have problem. If I delete above code, no problem.

    this is my main page full code.

    --------
    <?php
    /*
    Template Name: Main Page
    */
    get_header(); ?>
    <?php
    global $coursepress;
    $course = new Course( get_the_ID() );
    $course_category_id = $course->details->course_category;
    $course_category = get_term_by( 'ID', $course_category_id, 'course_category' );
    ?>

    <?php if ( is_user_logged_in() ) { ?>
    <div id="current-my-lecture">
    <div class="inner">
    <?php $current_user = wp_get_current_user(); ?>

    <img src="<?php echo esc_url( get_template_directory_uri() ); ?>/images/close.png" alt="Close" class="close-icon" />
    <h2 id="my-lecture-title"><?php echo $current_user->display_name; ?>?? ?? ?? ?? ??</h2>

    <?php
    $student = new Student( get_current_user_id() );
    $student_courses = $student->get_enrolled_courses_ids();
    ?>

    <?php echo do_shortcode( '[course_list student="' . $student->ID . '" course_status="incomplete" title_link="yes" show="instructors" show_media="yes"]' ); ?>
    <!-- <img src="<?php echo esc_url( get_template_directory_uri() ); ?>/images/close.png" alt="Close" class="close-icon" />
    <h2 id="my-lecture-title">???</h2>
    <p class="login-slogan">Junior SW? ?? ??? ???? ???? ??? ???? ????. ????">?? ????</p>
    <?php $args = array(
    'echo' => true,
    'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
    'form_id' => 'loginform',
    'label_username' => '???',
    'label_password' => __( 'Password' ),
    'label_remember' => __( 'Remember Me' ),
    'label_log_in' => __( 'Log In' ),
    'id_username' => 'user_login',
    'id_password' => 'user_pass',
    'id_remember' => 'rememberme',
    'id_submit' => 'wp-submit',
    'remember' => false,
    'value_username' => '',
    'value_remember' => false
    ); ?>
    <?php wp_login_form( $args ); ?>
    <p class="found-passwd">">???? ??</p> -->
    </div>
    </div> <!-- current my lecture end -->
    <?php } else { ?>
    <?php } ?>

    <div id="content">

    <div class="inner">
    <div id="primary" class="fullwidth">
    <div class="course-section programing">
    <h1 class="section-title">?????<span class="more">/course_category/programing/">+</span></h1>
    <span class="section-description">???? ????? ??? ??? ???? ???? ????? ??? ??? ??? ????? ?? ????? ??? ?? ?????.</span>
    <div class="owl-demo line_01">
    <?php global $query_string; // required
    $posts = query_posts($query_string.'&post_type=course&course_category=programing'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="course-box">
    <div class="course-thumbnail">
    <?php
    $course_media = do_shortcode( '[course_media]' );
    if ( $course_media !== '' ) {
    // Show course media
    echo $course_media;
    } ?>
    </div>
    ">
    <div class="thumbnail-filter">
    <p class="course-start button">?? ????</p>
    <div class="instructor">
    <?php echo do_shortcode( '[course_instructors style="list-flat" avatar_size="30"]' ) ?>
    </div>
    </div> <!-- thumbnail filter end -->

    <h2 class="course-title">"><?php the_title(); ?></h2>
    <?php echo do_shortcode( '[course_summary length="150"]' ); ?>
    <div class="course-meta">
    <span class="course-category"><?php the_terms( $course_category_id, 'course_category', '', ' / ' ); ?></span>
    <span class="unit-number"><?php echo $course->get_units( $post->ID, 'any', true ); ?>?</span>
    </div>
    </div> <!-- Course Box End -->
    <?php endwhile; else : ?>
    <p>??? ??? ????.</p>
    <?php endif; ?>
    <?php wp_reset_query(); // reset the query ?>
    </div> <!-- Owl demo line 01 end -->
    </div> <!-- course section end -->
    <div class="course-section computer-science">
    <h1 class="section-title">??? ??<span class="more">/course_category/computer-science/">+</span></h1>
    <span class="section-description">??? ??? ????? ???? ??? ??? ??? ??? ?? ? ?? ?????.</span>
    <div class="owl-demo line_02">
    <?php global $query_string; // required
    $posts = query_posts($query_string.'&post_type=course&course_category=computer-science'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="course-box">
    <div class="course-thumbnail">
    <?php
    $course_media = do_shortcode( '[course_media]' );
    if ( $course_media !== '' ) {
    // Show course media
    echo $course_media;
    } ?>
    </div>
    ">
    <div class="thumbnail-filter">
    <p class="course-start button">?? ????</p>
    <div class="instructor">
    <?php echo do_shortcode( '[course_instructors style="list-flat" avatar_size="30"]' ) ?>
    </div>
    </div> <!-- thumbnail filter end -->

    <h2 class="course-title">"><?php the_title(); ?></h2>
    <?php echo do_shortcode( '[course_summary length="150"]' ); ?>
    <div class="course-meta">
    <span class="course-category"><?php the_terms( $course_category_id, 'course_category', '', ' / ' ); ?></span>
    <span class="unit-number"><?php echo $course->get_units( $post->ID, 'any', true ); ?>?</span>
    </div>
    </div> <!-- Course Box End -->
    <?php endwhile; else : ?>
    <p>??? ??? ????.</p>
    <?php endif; ?>
    <?php wp_reset_query(); // reset the query ?>
    </div> <!-- Owl demo line 01 end -->
    </div>
    <div class="course-section physical-computing">
    <h1 class="section-title">??? ???<span class="more">/course_category/physical-computing/">+</span></h1>
    <span class="section-description">??? ??? ????? ???? ??? ??? ??? ??? ?? ? ?? ?????.</span>
    <div class="owl-demo line_03">
    <?php global $query_string; // required
    $posts = query_posts($query_string.'&post_type=course&course_category=physical-computing'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="course-box">
    <div class="course-thumbnail">
    <?php
    $course_media = do_shortcode( '[course_media]' );
    if ( $course_media !== '' ) {
    // Show course media
    echo $course_media;
    } ?>
    </div>
    ">
    <div class="thumbnail-filter">
    <p class="course-start button">?? ????</p>
    <div class="instructor">
    <?php echo do_shortcode( '[course_instructors style="list-flat" avatar_size="30"]' ) ?>
    </div>
    </div> <!-- thumbnail filter end -->

    <h2 class="course-title">"><?php the_title(); ?></h2>
    <?php echo do_shortcode( '[course_summary length="150"]' ); ?>
    <div class="course-meta">
    <span class="course-category"><?php the_terms( $course_category_id, 'course_category', '', ' / ' ); ?></span>
    <span class="unit-number"><?php echo $course->get_units( $post->ID, 'any', true ); ?>?</span>
    </div>
    </div> <!-- Course Box End -->
    <?php endwhile; else : ?>
    <p>??? ??? ????.</p>
    <?php endif; ?>
    <?php wp_reset_query(); // reset the query ?>
    </div> <!-- Owl demo line 01 end -->
    </div>
    </div> <!-- primary end -->
    </div> <!-- content inner end -->
    </div> <!-- content end -->

    <?php get_footer(); ?>

  • Kasia Swiderska

    Hello JinTae,

    Please don't post any credentials in your threads - this is public forum and anyone can see them.

    Could you use pastebin.com to show us your code? You didn't use code tags in your post, and some parts of the code were cut off and I can't test it.

    Can you enable debug mode in your WordPress so we could see if there are no errors? To enable it, open your wp-config.php file and look for define(‘WP_DEBUG’, false);. Change it to:

    define('WP_DEBUG', true);

    In order to enable the error logging to a file on the server you need to add yet one more similar line:

    define( 'WP_DEBUG_LOG', true );

    In this case the errors will be saved to a debug.log log file inside the /wp-content/directory.

    Depending on whether you want your errors to be only logged or also displayed on the screen you should also have this line there, immediately after the line mentioned above:

    define( 'WP_DEBUG_DISPLAY', false );

    The wp-config.php is located in your WordPress root directory. It’s the same file where the database configuration settings are. You will have to access it by FTP or SFTP in order to edit it.

    Kind regards,
    Kasia

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.