Deprecated: Function get_currentuserinfo is deprecated since version 4.5.0! Use wp_get_current_user() instead. in /var/www/html/wp-includes/functions.php on line 5383

Default to 'full width', instead of 'right sidebar'?

New Front EN Support Forums Kanso Theme Support Default to 'full width', instead of 'right sidebar'?

Viewing 10 posts - 1 through 10 (of 11 total)
  • Author
    Posts
  • #3625
    thoughton
    Participant

    Hi again :)

    Is there a way to make the ‘Add New’ portfolio page to default to ‘full width’, instead of ‘right sidebar’? My users seem to be incapable of remembering to set that option :)

    #3632
    mmsatori
    Keymaster

    Hey Timothy,

    this hasn’t been envisaged initially, yet is possible via certain theme customizations; since they’re not that large-scale, I’ve prepared the files for you: please download this archive, unzip it, and upload the resulting files into the main theme folder (/wp-content/themes/Kanso/), rewriting the existing files. This should make the “full-width” layout the default one, i.e. if no layout is chosen, the project will have full-width layout; please note that this will affect all existing projects as well! Let me know if it works – otherwise we’ll need to look at other files.

    Sincerely,
    Andrii / Satori Studio

    #3638
    thoughton
    Participant

    Hi Andrii,

    I’ve uploaded the 2 new files (header and single-project) but unfortunately they don’t seem to do anything. When I add a new project the Post Layout drop down still defaults to ‘Right Sidebar’, and if I go ahead and publish there is a sidebar on the right.

    Tim

    #3639
    thoughton
    Participant

    PS If it makes it any simpler I don’t need right or left sidebars at all on my projects page, it will be full-width all the time. If it’s easier completely removing the ‘Post Layout’ box would be fine with me.

    I do use right-sidebar on my news pages though.

    Thanks!

    • This reply was modified 9 years, 9 months ago by thoughton.
    #3651
    mmsatori
    Keymaster

    Hey Timothy,

    this archive should do the trick then; please unzip it and upload the contained files into the theme folder again, replacing the existing ones.

    Sincerely,
    Andrii / Satori Studio

    #3657
    thoughton
    Participant

    Hi Andrii,

    Thanks again for being so helpful!!!

    I tried out the new files, but I noticed it removes the ‘page layout’ box entirely. This also affects the ‘new post’ and ‘new pages’ pages, not only the ‘new project’.

    In the end I think I’ve managed to do what I want anyway. I just re-ordered the options on line 510 of functions.php. From this:

    'options' => array('Right Sidebar','Full Width','Left Sidebar')
    to this

    'options' => array('Full Width','Right Sidebar','Left Sidebar')

    This (so far!! haha) seems to work. I’m now looking into making it conditional so this only happens on the projects pages.

    Thanks again!!

    • This reply was modified 9 years, 9 months ago by thoughton.
    • This reply was modified 9 years, 9 months ago by thoughton.
    #3664
    thoughton
    Participant

    Okay I’ve fiddled around and got nowhere fast :)

    I’m trying something like this:

    if( get_post_type($post->ID) == 'project' ) {
    $kanso_sd_meta_box = array(
    'id' => 'post-layout-choice',
    'title' => 'Post Layout',
    'page' => 'post',
    'context' => 'side',
    'priority' => 'core',
    'fields' => array(
    array(
    'name' => 'Pick one:',
    'id' => $kanso_sd_prefix . 'post-layout',
    'type' => 'select',
    'options' => array('Full Width','Right Sidebar','Left Sidebar')
    )
    )
    );
    } else {
    $kanso_sd_meta_box = array(
    'id' => 'post-layout-choice',
    'title' => 'Post Layout',
    'page' => 'post',
    'context' => 'side',
    'priority' => 'core',
    'fields' => array(
    array(
    'name' => 'Pick one:',
    'id' => $kanso_sd_prefix . 'post-layout',
    'type' => 'select',
    'options' => array('Right Sidebar','Full Width','Left Sidebar')
    )
    )
    );
    }

    Obviously I’m doing something wrong :) Is there an if I can use to make the ‘options’ conditional? Thanks!

    • This reply was modified 9 years, 9 months ago by thoughton.
    • This reply was modified 9 years, 9 months ago by thoughton.
    #3668
    thoughton
    Participant

    Sorry the above post is so long. Basically what I want to do is:

    if page is ‘add new project’ then
    ‘options’ => array(‘Full Width’,’Right Sidebar’,’Left Sidebar’
    else
    ‘options’ => array(‘Right Sidebar’,’Full Width’,’Left Sidebar’

    What if/else can I use to do that?

    Thanks

    #3675
    mmsatori
    Keymaster

    Hey Timothy,

    in one of the previous posts, you’ve mentioned removing the layout choice box completely for projects, which is what I aimed at doing :) if you want to keep the box but make the full-width layout default only for projects, you will need to create two separate add_meta_box() calls. I’ve made an example for you here (changed lines 496-609).

    Sincerely,
    Andrii / Satori Studio

    #3677
    thoughton
    Participant

    Fantasitc! I copied lines 496-609 into my functions.php and everything works! New posts default to right sidebar, and new projects default to full width.

    (At first I used all 3 of your files, but that resulted in posts having the sidebar below the comments form.)

    All perfect now, cheers!

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