Course EXCERPT
-
Can you point me to how to increase the length of the excerpt for the course?
Thanks
The page I need help with: [log in to see the link]
-
Hi pwizard,
Thank you for reaching out to us!
You can easily adjust the maximum length of the course excerpt by adding a small PHP snippet to the functions.php file of your child theme, or via a code snippets plugin such as Code Snippets.
Here is the code you can use:
add_filter(
'get_the_excerpt',
function ( $excerpt, $post = null ) {
$course_post_type = defined( 'LP_COURSE_CPT' ) ? LP_COURSE_CPT : 'lp_course';
if ( ! $post instanceof WP_Post || $course_post_type !== $post->post_type ) {
return $excerpt;
}
$max_chars = 5;
if ( mb_strlen( $excerpt ) <= $max_chars ) {
return $excerpt;
}
return mb_substr( $excerpt, 0, $max_chars ) . '...';
},
20,
2
);You can modify the value of $max_chars in the code above to match the exact character limit you want for your course excerpts.
Please give this a try and let us know if you need any further assistance!
Best regards,
Brianvu-tpThanks. Which number?
“That text is 137 characters, including spaces and punctuation.”
I want to up it to 160. I tried each number there but reduced rather than increased.Hi pwizard,
Thanks for the update!
We think the text is still being cut off because LearnPress has a default CSS rule that limits the display of the course description to just two lines (using the line-clamp property).
Please follow these steps to resolve the issue:
Remove the PHP code snippet that we provided in our previous reply from your functions.php file (or the Code Snippets plugin).
Go to your WordPress dashboard, navigate to Appearance -> Customize -> Additional CSS (or the custom CSS section of your current theme).
Paste the following CSS code:
.learn-press-courses .course-content .course-short-description {
-webkit-line-clamp: unset;
}Save the changes and reload your course page. We have tested this, though we cannot rule out the possibility that the currently used theme is overriding this functionality.
This CSS code will remove the line limit.
Please let us know the result!
Best regards,
Brianvu-tpNo, that didn’t work at all.
I should be able to overwrite because I have had good success doing just that. But this didn’t change anythingVin
Hi Vin,
Thank you for updating us!
As this issue requires an in-depth technical investigation of your site, we need to handle it via our official support desk, where our team can properly inspect and resolve the problem.
Could you please create a support ticket on our official forum?
Please visit our official helpdesk and click on the “Support” and follow the instructions in this video to create your ticket.
Enter the title ‘pwizard – Course EXCERPT‘ to help our team fast-track your request.
Once created, our support team will closely examine your setup and provide an exact solution for your site.
Thank you so much for your patience and cooperation!
Best regards,
Brianvu-tpOK, thanks
You must be logged in to reply to this topic.