This topic has 4 replies, 2 voices, and was last updated 9 years by sharmstr.

  • Author
  • #75787
     Jonathan
    Participant

    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?

    #75910
     sharmstr
    Moderator

    You 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 solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #78261
     Jonathan
    Participant

    That 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?

    #78266
     Jonathan
    Participant

    I 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?

    #78910
     sharmstr
    Moderator

    question 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 solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?