CoursePress: unit_page_title_tag_class parameter not setting class properly in course_unit_details

In the course_unit_details shortcode, when I pass unit_page_title_tag_class, the HTML doesn't output class=. Instead, when it is rendered, it just displays the class name that I've entered.

For example, here is what I have in the shortcode:

do_shortcode('[course_unit_details unit_id="' . get_the_ID() . '" field="unit_page_title" unit_page_title_tag="h1" unit_page_title_tag_class="page-title" unit_title="'.get_the_title().'"]');

I was expecting to see this in the output:

<h1 class="page-title">Sed egestas erat nec purus: Page 2</h1>

But instead I get:

<h1 page-title="">Sed egestas erat nec purus: Page 2</h1>

I was able to fix this by editing line 3229 in coursepress > includes > classes > class.shortcodes.php but can this be edited in the plugin?

Thanks,

Ryan

  • Vinod Dalvi

    Hi Ryan,

    I hope you are well today and thanks for posting on the forum.

    I could confirm the issue on my test site therefore i have notified the plugin developer to fid it.

    The issue will be fixed ASAP.

    Yes in the meanwhile you can fix it by editing the following CoursePress plugin file on line number 3229 as displayed below.

    CoursePress plugin file:
    wp-content/plugins/coursepress/includes/classes/class.shortcodes.php

    Before Editing:

    $unit->details->$field = '<' . $unit_page_title_tag . '' . ($unit_page_title_tag_class !== '' ? ' ' . $unit_page_title_tag_class : '') . '>' . $page_title_prepend . $unit->get_unit_page_name( $paged ) . '</' . $unit_page_title_tag . '>';

    After Editing:

    $unit->details->$field = '<' . $unit_page_title_tag . '' . ($unit_page_title_tag_class !== '' ? ' class="' . $unit_page_title_tag_class.'"' : '') . '>' . $page_title_prepend . $unit->get_unit_page_name( $paged ) . '</' . $unit_page_title_tag . '>';

    Thanks,
    Vinod Dalvi

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.