Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #852777

    rekluse
    Participant

    Hello,

    I am rocking the Ethos theme, and trying to create a custom post template page for wp courseware units so I can associate a particular sidebar with the course contents. Basically I am just duplicating the wp-single.php and modifying the code for the sidebar.

    I’ve been able to call the sidebar, but strangely it is coming through broken and completely unthemed (see screenshots — I would provide a link, but the nature of this content type requires you to be registered to even look at the page. If it’s helpful I can create a dummy login so you can take a look.) This happens regardless of the sidebar ID I designate — even sidebars that work 100% on other pages are coming through unthemed.

    Here are two variations of the code I am trying to use. Can you let me know what I might be getting wrong?

    <?php
    /**
     * Unit Template Name: Course unit
     *
     * Be sure to use the "Unit Template Name:" in the header.
     * To display the course unit content, be sure to inclue the loop.
     */
    
    $fullwidth = get_post_meta( get_the_ID(), '_x_post_layout', true );
    
    ?>
    
    <?php get_header(); ?>
      
      <div class="x-container max width main">
        <div class="offset cf">
          <div class="<?php x_main_content_class(); ?>" role="main">
    
            <?php while ( have_posts() ) : the_post(); ?>
              <?php x_get_view( 'ethos', 'content', get_post_format() ); ?>
              <?php x_get_view( 'global', '_comments-template' ); ?>
            <?php endwhile; ?>
    
          </div>
          
         <?php dynamic_sidebar ('ups-sidebar-course'); ?>
          
        </div>
      </div>
    
    <?php get_footer(); ?>

    I’ve also tried:

    <?php
    /**
     * Unit Template Name: Course unit
     *
     * Be sure to use the "Unit Template Name:" in the header.
     * To display the course unit content, be sure to inclue the loop.
     */
    
    $fullwidth = get_post_meta( get_the_ID(), '_x_post_layout', true );
    
    ?>
    
    <?php get_header(); ?>
      
      <div class="x-container max width main">
        <div class="offset cf">
          <div class="<?php x_main_content_class(); ?>" role="main">
    
            <?php while ( have_posts() ) : the_post(); ?>
              <?php x_get_view( 'ethos', 'content', get_post_format() ); ?>
              <?php x_get_view( 'global', '_comments-template' ); ?>
            <?php endwhile; ?>
    
          </div>
          <?php if ( $fullwidth != 'on' ) : ?>
            <?php dynamic_sidebar ('ups-sidebar-course'); ?>
          <?php endif; ?>
    
          
        </div>
      </div>
    
    <?php get_footer(); ?>

    Any help would be greatly appreciated!

    #852853

    rekluse
    Participant

    Oh, in case it helps, I have to place this template file in either the x-child folder, or in x-child/framework. (WP Courseware can only “see” the template if it is in one of the first two levels of the theme directory.)

    Could this placement in the file hierarchy have something to do with the missing style in my sidebar?

    #853018

    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in! What is the filename of these files? It should be placed in the child theme folder wp-content/themes/x-child and the filename should be single-course-unit.php. Would you mind providing us the url of your site with login credentials so we can take a closer look and fix the issue? This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

    To do this, you can make a post with the following info:
    – Link to your site

    – WordPress Admin username / password
    – FTP Hostname
    – FTP Username
    – FTP Password

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thank you.

    #853087

    rekluse
    Participant
    This reply has been marked as private.
    #853207

    Rue Nel
    Moderator

    Hello There,

    Thanks for providing the very detailed information. I would recommend that you update the code in your custom template. Please use this instead:

    <?php
    /**
     * Unit Template Name: Course unit
    */
    
    $fullwidth = get_post_meta( get_the_ID(), '_x_post_layout', true );
    
    ?>
    
    <?php get_header(); ?>
      
      <div class="x-container max width main">
        <div class="offset cf">
          <div class="<?php x_main_content_class(); ?>" role="main">
    
            <?php while ( have_posts() ) : the_post(); ?>
              <?php x_get_view( 'ethos', 'content', get_post_format() ); ?>
              <?php x_get_view( 'global', '_comments-template' ); ?>
            <?php endwhile; ?>
    
          </div>
    
          <?php if ( x_get_content_layout() != 'full-width' ) : ?>
    
            <aside class="<?php x_sidebar_class(); ?>" role="complementary">
              <?php dynamic_sidebar ('ups-sidebar-course'); ?>
            </aside>
    
          <?php endif; ?>
    
        </div>
      </div>
    
    <?php get_footer(); ?>

    Please let us know if this works out for you.

    #853213

    rekluse
    Participant

    This totally worked! Thank you so much, you are awesome.

    #853253

    Darshana
    Moderator

    Glad we were able to help 🙂