How to display more characters on course description page

Go to: http://pandorafla.com/prep/courses/ to view my course descriptions.

As you can see they extremely limited and I want them to show the entire paragraph description.

Instead of having:
In this class we'll be discussing various...

I want it to show the entire "about the course description":
In this class we’ll be discussing various options for raising animals in your backyard, even for those with very small yards. Some of these may include chickens, rabbits, quail, Muscovy ducks, dwarf goats, tilapia, etc, depending on the classes interests. We’ll discuss the benefits involved and how easy it is for even the novice to become more self-reliant. This is not an in-depth class, but an overview of different options with new ideas.

Any ideas?

  • aristath
    • Recruit

    Hello there @Alexander, I hope you're well today!

    Could you please grant us access to your backend so that we may see exactly what is happening?
    To do so, from your dashboard go to WPMUDEV => Support => Support Access and click on the "Grant access" button.

    Please note that you must have the WPMU DEV Dashboard plugin installed on your site to complete the above process.

    Cheers,
    Ari.

  • Michelle Shull
    • DEV MAN’s Apprentice

    Hey there, Alexander!

    CoursePress uses the excerpt value set by WordPress, unless your theme also has an excerpt length defined. The WordPress default is 55.

    You can change this two ways:

    1. There's a shortcode for the excerpt that will let you manually set the length, you can find it in CoursPress > Settings > Shortcodes. (See screenshot.)

    2. You can change the WP default length by adding the following to your theme's functions.php file, replacing the value '20' with the number of words you want to show:

    'function custom_excerpt_length( $length ) {
    return 20;
    }
    add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );'

    Hope this helps!

  • Michelle Shull
    • DEV MAN’s Apprentice

    Hi, Paul!

    Apologies, there. You'll use the shortcodes to build custom versions of your CoursePress pages. Think of the shortcodes as building blocks. You can match each piece of your current course list page to one of the shortcode elements.

    Here are the steps:
    1. Create a new page, this will be your course overview page.
    2. Using shortcodes, choose which elements you want to show, and any special attributes.

    To mimic the default look, just with a longer summary, you'd use a set of shortcodes like this:

    [course_title course_id="1" link="yes"]
    [course_thumbnail course_id="1"]
    [course_summary course_id="1" length="100"]
    [course_instructors course_id="1" style="list"]
    [course_description course_id="1"]
    [course_start course_id="1"]
    [course_end course_id="1"]

    Here, you'd replace 1 with your course ID number, and 100 with your chosen summary length.

    You can add or subtract shortcodes to customize the page to exactly what you want. The downside: It can be time consuming to do this for each course. The second method is definitely faster, and takes effect everywhere at the same time, but the shortcode method is great for really drilling down into customization for your course pages.

    The bonus: You can use this shortcode combo anywhere on your site, so if you want a course description in a widget, or in a blog post, all you need to do is add the shortcodes you need.

    Thanks for your question, Paul!

  • Paul Day
    • Design Lord, Child of Thor

    I understand generally the steps for the first method, but what page name should I base my new page on and put into my child theme?
    As for the second method, I'm not sure what it is, as you don't explain it as fully as the first method

  • Michelle Shull
    • DEV MAN’s Apprentice

    Hey there, Paul!

    No need to add files to your child theme.

    Go to Pages > Add New Page in your Admin Dashboard to create the new page. You can name it whatever you want, just be sure to replace the link to your default courses page with your new courses page in your menu.

    To implement the second method, do the following:

    1. Log in to your site via FTP.
    2. Go to your site's root folder, where the wp-content, wp-admin, and wp-includes folders are located.
    3. Go to wp-content>your theme> functions.php.
    4. Right click it, and select "view or edit"
    5. That should download a copy of that file and open it in your local text editor.
    6. Add the line from my reply above https://premium.wpmudev.org/forums/topic/how-to-display-more-characters-on-course-description-page#post-795994
    to the bottom of this file, before the closing PHP tag.
    7. Save, and re-upload to the original location.
    8. Be sure to let the file you just edited overwrite the file on your server.
    9. Test.

    Apologies again, I should have been more detailed in my explanations.

  • Michelle Shull
    • DEV MAN’s Apprentice

    Hi again, Paul!

    We can work around this by adding a link to your new course description page to your nav menu, and hiding the default CoursePress menu items, if you decide to go with the shortcode method over the WP excerpt method.

    Whichever one you choose, I'm more than happy to help.

    Thanks, Paul.

  • Paul Day
    • Design Lord, Child of Thor

    I'll try the first option and post an update when I've created the page. I'll need help getting the default CoursePress page disabled. How do I find the course ID. I assume I need to place a button on my new page to link to the actual course.

  • Michelle Shull
    • DEV MAN’s Apprentice

    Hi Paul!

    You can find the course ID by going to your Courses page in your Network admin dashboard. Hover over the course you want to target, and in the bottom left of your browser, you'll see a link. At the end of that link is the course ID number. It will be something like this:

    course_details&course_id=3393

    Hope this helps!

  • Paul Day
    • Design Lord, Child of Thor

    Thanks for the info. I have now created a new page named "Asbestos Awareness" and put it on the menu under a menu item named "Online Courses"
    However, when I click on the course title as a link it takes me to a similar page. When I click on the continue learning button, it takes me back to the Home page. What is going wrong?
    Additionally, as potential student will not know that they can click on the course title, how do I create a button similar to the button on the original course page?
    And how do I remove the coursepress courses item from the menu?

  • Michelle Shull
    • DEV MAN’s Apprentice

    Hey there, Paul!

    Great progress so far. Would you mind copying the shortcodes you used for the course page you created here? I bet we can fix these issues by tweaking those, or adding additional shortcodes from the shortcodes page. (The list I gave you was a start, if you need extra features we'll need to add the shortcodes that call them.)

    We're going to hide the CoursePress default items from your menu once we've got everything set up.

    Just for curiosity's sake, is there a particular reason you picked this option over the other one? If, just in case, it's because you're apprehensive about editing your functions.php file, that's something we can add for you. It's a super quick fix, and I think it might save you a lot of frustration setting everything up with shortcodes.

    If you'd like to use that option, you can use our contact form to send me the login details I'd need:

    https://premium.wpmudev.org/contact/

    Subject: "Attn: Michelle Shull"
    -WordPress admin username
    -WordPress admin password
    -login url
    -FTP credentials (host/username/password)
    -link back to this thread for reference
    -any other relevant urls

    Select "I have a different question" for your topic - this and the subject line ensure that it gets assigned to me. :slight_smile:

    Thanks, Paul!

  • Tyler Postle
    • CGO

    Hey Paul,

    Hope you're doing well today!

    Is the goal here still to increase the characters in your course description?

    You can change that by editing your content-course.php file which is inside:

    wp-content/plugins/coursepress/themes/coursepress/content-course.php

    Around line 50 you will see this this line:

    echo do_shortcode( '[course_summary length="100" class="' . $extended_class . '"]' );

    Change the "50" to whatever you like :slight_smile:

    I tested this on my own installation and it works. If you have any trouble with it just let us know!

    Cheers,
    Tyler

  • Paul Day
    • Design Lord, Child of Thor

    I have commented out the line in course-content.php and put a new line in as follows:

    echo do_shortcode( '[course_summary length="150");

    But it still produces a summary of 30 characters.
    Looking at the page source when I look at the page through a browser I see a class is set around the course description.

    <div class="course-summary course-summary-30 ">
    <p>The is a course for managers to become...</p>
    </div>

    Could this have something to do with the problem?

  • Paul Day
    • Design Lord, Child of Thor

    I have now commented out the whole line with the restriction, and I'd expect not to see the course description on the page, but it still appears. It must be pulled from another area or it is the wrong page that you advised me to modify.

  • Tyler Postle
    • CGO

    Hey Paul,

    Hope you're doing well today!

    it doesn't show up in your recent posts because the original post was posted by someone else :p

    You can find all your recent posts, including threads started by other users that you're posting on here: https://premium.wpmudev.org/forums/profile/paulday1

    That is very odd about the description and doing that exact thing works for me. I tried logging in with the WP credentials you sent to Michelle but wasn't able too, would you mind granting support access so we can sign into your WP backend? :slight_smile:

    You can grant support access via admin dashboard - WPMU DEV > Support > Support Access > Grant Access.

    Post back here when you've done that.

    Look forward to hearing back!

    All the best,
    Tyler

  • Paul Day
    • Design Lord, Child of Thor

    I have now granted support access. I have put all files back to their original state. One additional thing that I have noticed is that when I click on the course detail button on the second of the courses pages, it takes me back to the menu and not the actual course.

    What was the problem with the Login details that I sent to Michelle?

  • Tyler Postle
    • CGO

    Hey Paul,

    Thanks for the quick reply :slight_smile:

    it looks like access still isn't granted? There's no access button on our end.

    Can you double check that?

    What was the problem with the Login details that I sent to Michelle?

    Incorrect username or password. If you like, you can try re-sending that to me :slight_smile:

    Send in:

    Subject: "Attn: Tyler Postle"
    -WordPress admin username
    -WordPress admin password
    -login url
    -FTP credentials (host/username/password)
    -link back to this thread for reference
    -any other relevant urls

    Select "I have a different question" for your topic - this and the subject line ensure that it gets assigned to me :slight_smile:

    https://premium.wpmudev.org/contact/

    Talk to you soon!

    Cheers,
    Tyler

  • Paul Day
    • Design Lord, Child of Thor

    I have been doing my own checking on this topic. I installed a new Wordpress site within a new sub domain. I installed coursepress and your theme. I then made the changes to line 50 in course-content.php. This has solved the problem.
    I think therefore we can close this topic.

  • Tyler Postle
    • CGO

    Hey Paul,

    Apologies for my delay here! Hope you had a great Christmas and/or Holidays.

    I installed coursepress and your theme. I then made the changes to line 50 in course-content.php. This has solved the problem.
    I think therefore we can close this topic.

    Awesome to hear! Glad you got it all sorted Paul :slight_smile:

    I'll go ahead and mark this as resolved. If you would still like me to check out your previous site then just let me know and I'll be more than happy to do so.

    All the best,
    Tyler

  • Tyler Postle
    • CGO

    Hey there Paul,

    You can do that by creating a child theme :slight_smile:

    I've just gone ahead and done that for you, upload the attached zip file via:

    Appearance > Themes > Add New.

    Then activate it.

    Now place the content-course.php file into the CoursePress Child theme folder:

    /wp-content/themes/coursepress-child

    Your file is safe in there.

    Hope this helps Paul :slight_smile:

    Have a great rest of your day!

    All the best,
    Tyler

  • Tyler Postle
    • CGO

    Hey Paul,

    Child themes only require a style.css and through the information in that css it knows to use the parent theme files, which is the main CoursePress theme - you need to have the parent theme installed in order to activate the coursepress-child theme :slight_smile:

    Here is more information on child themes: https://premium.wpmudev.org/blog/how-to-create-wordpress-child-theme/

    That will explain child themes in more detail.

    The main advantage of a child theme is that you can update the parent theme without overwriting any of your child theme files.

    For example, you want to save the edits to your content-course.php file so you place the edited version into your coursepress-child folder. WordPress knows to always use the child theme templates instead of the parent themes - if it exists there.

    Now, when you update the parent coursepress theme it will overwrite all the files in that folder with the new ones, but it won't matter to you because your content-course.php is safe inside the child theme folder :slight_smile:

    Make sense? Hopefully I explained that well enough. If not, then I hope the link above does a better job than me :p lol

    Let me know if you have any further questions Paul!

    All the best,
    Tyler

  • Paul Day
    • Design Lord, Child of Thor

    Thanks for the explanation about child themes, but what I was meaning was, when you activate a theme, let's say Avantage, all the files for that theme reside in the Wordpress THEMES folder. Having changed from the Vantage theme to the CoursePress theme, when I look in the themes folder, no files exist. Why? . Where are they, if I need to examine them to modify code to put into my child theme folder.

  • Tyler Postle
    • CGO

    Hey Paul,

    My apologies! I misunderstood. Yeah it is a little bit different with the CoursePress parent theme because it's inside the CoursePress plugin via:

    /wp-content/plugins/coursepress/themes/coursepress

    So you will want to move the edited files from there over to the child theme in your themes folder :slight_smile:

    The reason we did this is so you don't have to manually update the theme every time CoursePress is updated, it will all happen automatically as it normally would.

    Let me know if you have any further questions!

    All the best,
    Tyler

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.