• Resolved aprettierweb

    (@karlikdesign)


    The Course Catalogue Page and Membership pages are of type “archive” which is giving me some problems. I have workaround for every issue except for the FIRST (I listed the other issues as an fyi…)

    BUG…

    1. When I add these pages to the menu, they aren’t registering as “active” when I am on those pages
    ie: the active classes aren’t being added

    Also, if I have a static page for Home and Blog set, when I am on a Course Catalogue Page or Membership Page, the BLOG menu item is active.

    FYI…

    2. I have a sidebar show up on the Course Catalogue and Membership Page. This is supposed to be full width so it’s obviously not supposed to show up.

    The workaround in my sidebar.php is to check for post_type_archive…
    if ( is_singular( ‘course’ ) || is_singular(‘lesson’) || is_post_type_archive() ) : …

    3. I have meta data that I want to access on the Course Catalogue and Membership pages and being that they are defined as archive pages, it’s difficult to get page data because you can’t get the id from archive pages.

    The workaround is to check for is_archive() and then get the page slug and find the id using get_page_by_path(slug)

Viewing 1 replies (of 1 total)
  • 1. When I add these pages to the menu, they aren’t registering as “active” when I am on those pages
    ie: the active classes aren’t being added

    Also, if I have a static page for Home and Blog set, when I am on a Course Catalogue Page or Membership Page, the BLOG menu item is active.

    I’ll work on getting this resolved: https://github.com/gocodebox/lifterlms/issues/257

    2. I have a sidebar show up on the Course Catalogue and Membership Page. This is supposed to be full width so it’s obviously not supposed to show up.

    The workaround in my sidebar.php is to check for post_type_archive…
    if ( is_singular( ‘course’ ) || is_singular(‘lesson’) || is_post_type_archive() ) : …

    This sounds like it works fine. It sounds like you’re unhappy with your solution but if it works it works, right?

    3. I have meta data that I want to access on the Course Catalogue and Membership pages and being that they are defined as archive pages, it’s difficult to get page data because you can’t get the id from archive pages.

    Try the following:

    
    if ( is_post_type_archive( 'course') ) {
    
    	$page_id = llms_get_page_id( 'courses' );
    	echo get_post_meta( $page_id, 'my_meta_key', true );
    
    } elseif ( is_post_type_archive( 'llms_membership' ) ) {
    
    	$page_id = llms_get_page_id( 'memberships' );
    	echo get_post_meta( $page_id, 'my_meta_key', true );
    
    }
    

    Hope that helps

Viewing 1 replies (of 1 total)
  • The topic ‘Course Catalogue & Membership Pages acting as Archives’ is closed to new replies.