Archived topic
Pages Archive in two columns
7 replies · Started by Marc on March 20, 2019
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.
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 :)
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?
Are there any javascript errors in the Console? You can check by right-clicking the page and choosing "Inspect".
Let me know :)
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.
Hmm, strange one. Have you deactivated your other plugins one by one to check if one of them is causing it?
It worked! :-)
Awesome :)