[Resolved] Pages Archive in two columns

Home Forums Support [Resolved] Pages Archive in two columns

Home Forums Support Pages Archive in two columns

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #845110
    Marc

    Hi,

    I use GP for our department in a college. All our courses were created as pages, and I wanted to allow some level of categorization (by semester (session in French), by competency (Axe de formation in French)), so I installed the “Add Category to Pages” plugin in order to achieve this, rather than converting all pages to posts.

    Now, when we click on “Session 1, Session 2, … Session 6”, we get all the courses per semester. Same thing works great with four competencies “Axe de formation « Gestion », Axe de formation « Technologie », etc.)

    However, the archive themselves, or list of pages, displayed when we click one of the links, are displayed in ONE column only, rather than two, as I set in Customizer> Layout> Blog> Archive> 2 columns. I can only guess that this setting works only for posts, not for pages, since pages aren’t supposed to have categories? Is there a bit of code I could insert somewhere, in order to have the above archive lists display in two columns, and also to make the first post (page in this case) featured?

    Thanks in advance.

    #845725
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Give this a shot:

    add_filter( 'generate_blog_columns', function( $columns ) {
        if ( is_archive() && 'page' === get_post_type() ) {
            return true;
        }
    
        return $columns;
    } );

    Let me know 🙂

    #950771
    Harm

    I also have the “Add Category to Pages” plugin. In Customizer I designated columns in Layout>Blog>Archives but the post_types “page” at first did’t show up in columns.

    With Tom’s function it works like a charm, but…

    within the Customizer I always get a blank area. Navigation and headers and such are fine but no content, no columns. On the front-end it all works fine.
    What’s wrong with the Customizer display?

    #950855
    Tom
    Lead Developer
    Lead Developer

    Are there any javascript errors in the Console? You can check by right-clicking the page and choosing “Inspect”.

    Let me know 🙂

    #952462
    Harm

    Hi Tom,
    Thanks for replying.
    GP is great!
    Yes, I do get js-errors in Customizer but not able to pin-point where it comes from.
    Might be not-GP related…

    Uncaught Error: Syntax error, unrecognized expression: >h2 class=”widget-title”<>/h2<
    at Function.ea.error (jquery.js?ver=1.12.4-wp:2)
    at ea.tokenize (jquery.js?ver=1.12.4-wp:2)
    at ea.select (jquery.js?ver=1.12.4-wp:2)
    at Function.ea (jquery.js?ver=1.12.4-wp:2)
    at Function.a.find (jquery-migrate.min.js?ver=1.4.1:2)
    at n.fn.init.find (jquery.js?ver=1.12.4-wp:2)
    at n.fn.init.a.fn.find (jquery-migrate.min.js?ver=1.4.1:2)
    at a.fn.init.n.fn.init (jquery.js?ver=1.12.4-wp:2)
    at new a.fn.init (jquery-migrate.min.js?ver=1.4.1:2)
    at n (jquery.js?ver=1.12.4-wp:2)

    Will investigate further tomorrow evening.

    #952465
    Tom
    Lead Developer
    Lead Developer

    Hmm, strange one. Have you deactivated your other plugins one by one to check if one of them is causing it?

    #1287772
    Marc

    It worked! 🙂

    #1287844
    Tom
    Lead Developer
    Lead Developer

    Awesome 🙂

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