-
Author
-
September 2, 2015 at 07:00 #75787JonathanParticipant
Hi there,
I have a custom post type that is basically a database of scientific articles. There are currently over 250 articles in the database and these are added by users. Rather than go through every single one of them and select the 3-column layout (which is not the site default), and a custom sidebar to display on the left, I’d like to just code this into the custom template file with php.
I will also use the code on the archive and search archive pages, so it would be very help to have a good idea how to do this. Can someone help me out?
September 2, 2015 at 23:10 #75910sharmstrModeratorYou can call the kleo_switch_layout(‘3lr’) function in your template, or you can copy the kleo_switch_layout function (found in kleo/functions.php to your child theme and do a if get_post_type() == ‘yourcpt’ check to load it.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
September 18, 2015 at 00:04 #78261JonathanParticipantThat is great! What if I wanted to use a custom sidebar for all of those pages too? I know how to do that for an individual post but I have over 250 entries in a custom post type and I want to use it for all of them (as well as future additions). I also want to use the same custom column on category pages and in a few other places. Is there easy code for this as well?
September 18, 2015 at 00:35 #78266JonathanParticipantI tried adding this straight into a template file but there was no change on the front end.
COPY CODE<?php kleo_switch_layout(‘3lr’); ?>
Am I missing something?
September 22, 2015 at 17:15 #78910sharmstrModeratorquestion 1 – For a 3 column layout, kleo calls the kleo_extra_sidebar function. Copy it from kleo/functions.php to your child theme and as suggested in my first answer, do a get_post_type check to load the correct sidebar for your cpt.
question 2 – hard to answer since i have no idea how you’ve coded your template. I will say you have fancy quotes in your code that shouldnt be there.
COPY CODE<?php kleo_switch_layout('3lr'); ?>
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
-
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.