Theme implementation: How to modify the shortcode content

Dear support,

I have been looking through the forum without luck. I am implementing the plugin pages into the theme (Industron) and wish to modify both the course list page and the single course page.

I am aware that there are a range of shortcode attributes, but I need to change the overall design of these pages, so adding attributes is not enough.

How do I archieve this? My best idea is to create page templates and add the modified coursepress php there, but I am open to other suggestions.

Best, Steffen

  • Ivan Shulev
    • The Bug Hunter

    Hey Brand Rocket ,

    I hope you are having a nice day so far!

    When I was creating custom pages with CoursePress I used the following shortcodes for the single course page (I created a single-course.php page) and believe they offer enough flexibility:

    [course_join_button]

    [course_media]

    [course_time_estimation]

    [course_cost]

    [course_title]

    [course_structure]

    For the listing of the courses, I was using the [course_list] shortcode (in a courses archive page), but depending on what you want to achieve, custom code might be needed.

    Please specify what exactly you would like to accomplish (simple sketches would suffice) and we will be happy to cook up a solution for you!

    I hope this helps and I wish you an awesome day ahead!

    Ivan

  • Brand Rocket
    • Design Lord, Child of Thor

    Hi Ivan,

    Thanks, the hint on using different shortcodes for the single course page is very helpful. I was trying to press everything into one shortcode with a lot of attributes – so I think I have that part covered.

    About the course list page you describe that custom code might be needed. This was my idea as well, so my question is:

    Where do I find the original course list code?

    Best, Steffen

  • Brand Rocket
    • Design Lord, Child of Thor

    Hi again Ivan or Luís,

    Things are going great with the theme implementation and the course list and single course is now properly setup thanks to your help.

    My next challenge is getting the single-unit page implemented properly.

    I have created the single-unit.php in the child theme but the unit page doesn’t show the theme menu, only the unit content. It might be a conflict since the header already contains a $wp_query but I’m not sure. I’ve tried various ways of merging the theme page.php file and the single-unit.php from the coursepress theme without luck.

    How do you suggest to proceed?

    Best, Steffen

  • Luís Lopes
    • QA

    Hi Brand Rocket ,

    Hope you’re doing well today!

    Firstly, sorry for my late reply and all the problems it may have caused.

    As you are using a premium theme and in order to help you better, can you send it to us, so we can test it and help you to achieve your goal?

    Please send it privately through our contact form:

    https://wpmudev.com/contact/

    Select “I have a different question” for your topic – this and the subject line ensure that it gets assigned to me.

    Send in:

    Subject: “Attn: Luis Lopes”

    – theme .zip file;

    – Link back to this thread for reference;

    Cheers, Luís

  • Brand Rocket
    • Design Lord, Child of Thor

    Hi steffen,

    Hope you’re doing well today!

    Firstly, sorry for my late reply and all the problems it may have caused. We are having lots of topics in this days and we need to reply in a chronological order, to everyone gets a reply asap.

    Which file was used to the base of single-unit.php? Page.php or single.php?

    Can you send me the file where you worked (single-unit.php), maybe is better to check the code and try find the issue.

    _______________________________________________________

    Hi Luis,

    I actually based it on page.php so maybe that could be the answer. View the file here (and attached):

    https://www.dropbox.com/s/h17ls20aefoilag/single-course.txt?dl=0

    Best,

    Steffen

  • Jude
    • DEV MAN

    Hi there steffen

    Id advise you adapt code from the single-unit.php file for this. You’d want to focus on this bit

    <div id="primary" class="content-area">
    <main id="main" class="site-main" role="main">
    <?php while ( have_posts() ) : the_post(); ?>
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <header class="entry-header">
    <h3 class="entry-title course-title"><?php echo do_shortcode('[course_title course_id="' . $course_id . '"]'); ?></h3>
    <?php
    //echo do_shortcode('[course_unit_details unit_id="' . get_the_ID() . '" field="parent_course"]');
    ?>
    </header><!-- .entry-header -->
    <div class="instructors-content"></div>
    <?php
    echo do_shortcode('[course_unit_archive_submenu course_id="' . $course_id . '"]');
    ?>

    <div class="clearfix"></div>

    <?php echo do_shortcode( '[course_unit_page_title unit_id="' . $unit->details->ID . '" title_tag="h3" show_unit_title="yes"]' ); ?>

    <?php
    Unit_Module::get_modules_front($unit->details->ID);
    ?>
    </article>
    <?php endwhile; // end of the loop. ?>
    </main><!-- #main -->
    </div><!-- #primary -->

    Cheers

    Jude

  • Brand Rocket
    • Design Lord, Child of Thor

    Hi Jude,

    I already did that:

    I’ve tried various ways of merging the theme page.php file and the single-unit.php from the coursepress theme without luck.

    You can view an example of the unit page here:

    http://skrivklart.dk/wordpress/onlinekurser/aenean-auctor-nec-magna-sed-mattis/modul/modul-1/

    The code:

    <?php
    /*
    Custom single course layout (from fullwidth layout)
    */
    ?>

    <?php
    global $coursepress, $wp, $wp_query;

    $course_id = do_shortcode('[get_parent_course_id]');

    add_thickbox();

    $paged = ! empty( $wp->query_vars['paged'] ) ? absint($wp->query_vars['paged']) : 1;
    //redirect to the parent course page if not enrolled or not preview unit/page
    while ( have_posts() ) : the_post();
    $coursepress->check_access($course_id, get_the_ID());
    endwhile;

    get_header();

    $post = $unit->details;
    ?>

    <?php flow_elated_get_title(); ?>
    <?php get_template_part('slider'); ?>

    <div class="eltd-container">
    <div class="eltd-container-inner">
    <div class="eltd-two-columns-75-25 eltd-sidebar clearfix">
    <!-- column1 -->
    <div class="eltd-column1 eltd-content-left-from-sidebar">
    <div class="eltd-column-inner">

    <?php while ( have_posts() ) : the_post(); ?>
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <header class="entry-header">
    <h3 class="entry-title course-title"><?php echo do_shortcode('[course_title course_id="' . $course_id . '"]'); ?></h3>
    <?php
    //echo do_shortcode('[course_unit_details unit_id="' . get_the_ID() . '" field="parent_course"]');
    ?>
    </header><!-- .entry-header -->
    <div class="instructors-content"></div>
    <?php
    echo do_shortcode('[course_unit_archive_submenu course_id="' . $course_id . '"]');
    ?>

    <div class="clearfix"></div>

    <?php echo do_shortcode( '[course_unit_page_title unit_id="' . $unit->details->ID . '" title_tag="h3" show_unit_title="yes"]' ); ?>

    <?php
    Unit_Module::get_modules_front($unit->details->ID);
    ?>
    </article>

    </div>
    </div>

    <!-- column2 -->
    <div class="eltd-column2">
    <div class="eltd-column-inner">
    <aside class="eltd-sidebar">
    <div class="widget widget_text">
    <h6 class="eltd-widget-title">Some title</h6>
    <!-- content here -->

    <?php endwhile; // end of the loop. ?>

    </div>
    </aside>
    </div>
    </div>
    </div>
    </div>
    <?php do_action('flow_elated_before_container_close'); ?>
    </div>
    <?php get_footer(); ?>

  • Ivan Shulev
    • The Bug Hunter

    Hey Brand Rocket ,

    I hope you are having a nice day so far and I am sorry for the delay here!

    I tried creating a single units page using your code and code from single.php from the parent theme, but I was unable to display the header section. It appears there is something specific for the parent theme that I am missing.

    As the theme is premium, I assume there is support for it. Please contact them and ask how to create a custom post type single page.

    You are more than welcome to paste their answer here as we are eager to assist your further.

    I hope this helps and I wish you an awesome day ahead!

    Ivan