[Support request] Sidebar for Custom Post Archive

Home Forums Support [Support request] Sidebar for Custom Post Archive

Home Forums Support Sidebar for Custom Post Archive

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1179309
    siang

    Hi,
    I am using Layout Element to try to set the custom post page (CPTUI) to use “left sidebar”.

    I am able to change
    1) the layout for page stated in “Your Website URL” below.
    2) And the job detail page (eg: Corporate Sales Manager, BUT i don’t wish to change layout for this page, i want to keep it using right bar)

    But if you clicked on the sidebar categories, F&B, Human Resource, Medical

    They will go to a page showing right sidebar. I want this page to be affected by the Layout Element, but its not working.

    This is a screenshot of my settings.
    https://www.dropbox.com/s/xpyjfbap2xxhds2/gp_archives.jpg?dl=0

    I am thinking, maybe the F&B and other pages are archives, so I tried to use snippet

    add_filter( 'generate_sidebar_layout', function( $layout ) {
        // If we are viewing search results, set the sidebar
        if ( is_tax('industry') ) {
            return 'left-sidebar';
        }
    
        // Or else, set the regular layout
        return $layout;
     } );

    I tried changing my
    is_tax(‘industry’) to is_tax()

    but it don’t affect the taxonmy page,
    it only affects the tax single page like corporate sales manager.

    Please let me know if I have done anything wrong here.

    I will like to have this page
    industry/fb/
    industry/medical/

    to have the left side bar, similar to this
    job-search/

    while keeping these detail pages using the right bar (no change)
    job/corporate-sales-manager/

    Thanks

    #1179316
    siang

    My bad, solved it using code snippet

    add_filter( 'generate_sidebar_layout', function( $layout ) {
        
        if ( is_archive('job')  ) {
            return 'left-sidebar';
        }
    
        // Or else, set the regular layout
        return $layout;
     } );

    But this will change all my archive to use left bar.
    Is there a better way to change my CPT “job” archive layout only?

    #1179764
    David
    Staff
    Customer Support

    Hi there,

    that code should work fine – it will only apply to Archives that display a CPT with the slug of job

    If your CPT is named job then you should see it listed in the Layout Element > Display Rules

    e.g

    Jobs, Job Archive, Job Category archives.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.