• Hi Christoph,

    Thanks for the connect plugin, it seems to solve the integration problem mostly. I use the Studiopress Essence Pro Genesis child theme and have set genesis to show full-width by default.

    The problem is that when you added logic to force the content-sidebar layout to some Sensei pages, you left out the same for sensei’s messages archive and the quiz pages, so those pages still force the sidebar below the content.

    I changed the code in site-layout.php to do the same for those pages and it seems to correct the problem. Perhaps it can be in the next update too?

    function gcfws_force_content_sidebar_layout_on_cpt_posts() {
    
    	if ( ! is_singular( array( 'course', 'lesson', 'question', 'quiz' ) ) 
    	&&   ! is_post_type_archive('sensei_message') ) {
    		return;
    	}
    	add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
    }

    After this, my next challenge will be to change sensei’s css to use more of the theme’s styling, like button and list styles.

    Thanks,
    Hans

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Christoph Herr

    (@christophherr)

    Hi Hans,

    Thank you for using the plugin and letting me know about this.

    Yes, quiz should be in that array.

    Would it make sense if I added post_type_support for genesis layouts and genesis archive settings to the sensei_message CPT instead?
    That should give more flexibility about the layout.

    Christoph

    • This reply was modified 5 years, 9 months ago by Christoph Herr. Reason: formatting
    Thread Starter Hans Schuijff

    (@hanswitteprins)

    Hi Christoph,

    Thanks for your swift reply and looking into you question I found that my answer still wasn’t complete enough. It fixes the messages archive, but not the pages of each individual message.

    Adding layout to the archive doesn’t seem to work, since it isn’t offered as a page that I can edit using the wp-editor, but it can be added to each individual message. However it is something like a comment and normal comentors will probabky not be able or might wanto change the layout on a message by message basis, so in the end I wouldn’t offer that functionality.

    The complete list of post_types that are registered by Sensei contains:

    • course
    • lesson
    • quiz
    • question
    • multiple_question
    • sensei_message
    • certificate

    I wasn’t able to fiqure out what the multiple_question CPT contains or what it’s used for, and certificates are only presented as a template in the editor and as a generated pdf with the date of the students in it. So for certificate doing something doesn’t seem to change anything either way, but I probably would add all cpt’s to the list to be sure. Adding layout_support doesn’t seem to hurt in any case (at least when i tried, nothing seem to break), so adding it to all also secures that it isn’t omitted anywhere, but for certificate and sensei_message it seems to make the least sense.

    The taxonomy added by sensei contains:

    • module
    • course-category
    • quiz-type
    • question-type
    • question-category
    • lesson-tag

    I don’t know what needs to change for them, but at least the course-category archive also pushes the sidebar below the content, so probably the taxonomy pages should also be forced to display content-sidebar (although module, quiz-type, question-type and guestion-category are probably not presented as a user-accessable archive on the frontend, making course-category and lesson-tag probably the only relevant ones.

    So in the end, I just changed the previous function to:

    function gcfws_force_content_sidebar_layout_on_cpt_posts() {
    
    	if ( ! is_singular( array( 'course', 'lesson', 'question', 'quiz', 'sensei_message', 'certificate', 'multiple_question' ) ) 
    	&&   ! is_post_type_archive('sensei_message') ) {
    		return;
    	}
    	add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
    }

    and it wouldn’t hurt to expand the next function too:

    function gcfws_add_genesis_layout_to_sensei_cpts() {
    	add_post_type_support( 'course', array( 'genesis-layouts', 'genesis-cpt-archives-settings' ) );
    	add_post_type_support( 'lesson', array( 'genesis-layouts', 'genesis-cpt-archives-settings' ) );
    	add_post_type_support( 'question', array( 'genesis-layouts', 'genesis-cpt-archives-settings' ) );
    	add_post_type_support( 'quiz', array( 'genesis-layouts', 'genesis-cpt-archives-settings' ) );
    	// probably never used
    	add_post_type_support( 'sensei_message', array( 'genesis-layouts', 'genesis-cpt-archives-settings' ) );
    	// probably not needed:
    	add_post_type_support( 'certificate', array( 'genesis-layouts', 'genesis-cpt-archives-settings' ) );
    	add_post_type_support( 'multiple_question', array( 'genesis-layouts', 'genesis-cpt-archives-settings' ) );
    }

    and after that I hope you know how to set the display for the taxonomy pages.

    Hope this helps…

    Thanks,
    Hans

    Thread Starter Hans Schuijff

    (@hanswitteprins)

    I looked some further…

    This seems to work, including the mentioned taxonomies:

    function gcfws_force_content_sidebar_layout_on_cpt_posts() {
    
    	if ( ! is_singular( array( 'course', 'lesson', 'question', 'quiz', 'certificate', 'multiple_question', 'sensei_message' ) ) 
    	&&   ! is_post_type_archive('sensei_message') 
    	&&   ! is_tax('course-category')
    	&&   ! is_tax('lesson-tag') )
    	{
    		return;
    	}
    	add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
    }

    Easier than I thought. 🙂

    Thanks, Hans

    Thread Starter Hans Schuijff

    (@hanswitteprins)

    Still found an (course) archive page that wasn’t showing right, so I have put all post_types in the archive-test to be sure they all show the same. Hope this is the last update for this subject. 🙂

    function gcfws_force_content_sidebar_layout_on_cpt_posts() {
    
    	if ( ! is_singular( array( 'course', 'lesson', 'question', 'quiz', 'certificate', 'multiple_question', 'sensei_message' ) ) 
    	&&   ! is_post_type_archive( array( 'course', 'lesson', 'question', 'quiz', 'certificate', 'multiple_question', 'sensei_message' ) ) 
    	&&   ! is_tax( array( 'course-category', 'lesson-tag') ) )
    	{
    		return;
    	}
    	add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
    }

    Cheers,

    Hans

    Thread Starter Hans Schuijff

    (@hanswitteprins)

    The only page I found and wasn’t able to correct is the learner-profile page. I don’t know how to make a condition to check when I’m on that page. Perhaps you can do it?

    Thanks,

    Hans

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Sidebar below content on quiz pages and messages archives’ is closed to new replies.