Strange code when viewing instructor info in CoursePress

Hi - I'm using CoursePress and it's pretty much been functioning ok - but I've noticed some strange code in the section that displays where the Author description should be.

This page is an example : http://coachtrishacourses.coachsites.me/courses/attain-vitality-coach-module-1-so-you-want-to-be-a-coach-july-2015/

The screenshot shows the code I'm referencing.

  • Michael Bissett
    • Recruit

    Hey @Kat, hope you're doing well today! :slight_smile:

    Digging into this a bit here, it looks like the WP Tab Widget plugin's the culprit here, given the code seen here:

    https://github.com/search?q=wpt_view_count&type=Code&utf8=%E2%9C%93

    CoursePress wouldn't be the first plugin affected by it like this, but there is a way we can remedy this behavior. :slight_smile:

    You can try inserting this into your site as a mu-plugin (must use plugin):

    add_filter('the_content', 'mts_view_count_js');
    
    function mts_view_count_js() {
    
    	if (is_single() && !function_exists('wpt_view_count_js')) {
    	add_action ('wp_footer', 'my_wp_tab_ajax_script');
    	}
    }
    
    function my_wp_tab_ajax_script() {
    
    wp_enqueue_script( 'jquery' );
    
    	$url = admin_url( 'admin-ajax.php' );
    	$script_to_run = "
    <script type=\"text/javascript\">
    jQuery(document).ready(function($) {
    	$.post('{$url}', {action: 'wpt_view_count', id: '{$id}'});
    });
    </script>";
    
    	return $script_to_run;
    }

    To do this, go to your /wp-content/ folder via FTP, and find the folder called "mu-plugins". If there is no folder with that name, then you'll want to create one. Then, create a file inside that folder, and give the file any name you like and paste the code in there.

    You don't need to activate that plugin, as it will be always be automatically activated. Please be sure to add a PHP start tag at the beginning of the code if you insert this code as a mu-plugin, like this:

    <?php

    Let me know if this helps please! :slight_smile:

    Kind Regards,
    Michael

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.