New Front EN › Support Forums › Kanso Theme Support › Default to 'full width', instead of 'right sidebar'?
- This topic has 10 replies, 2 voices, and was last updated 10 years, 5 months ago by satori.
-
AuthorPosts
-
June 29, 2014 at 6:26 pm #3625thoughtonParticipant
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 :)
June 30, 2014 at 12:57 pm #3632satoriKeymasterHey 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 StudioJuly 1, 2014 at 11:59 am #3638thoughtonParticipantHi 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
July 1, 2014 at 12:01 pm #3639thoughtonParticipantPS 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 10 years, 5 months ago by thoughton.
July 2, 2014 at 8:10 am #3651satoriKeymasterHey 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 StudioJuly 2, 2014 at 9:15 am #3657thoughtonParticipantHi 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!!
July 2, 2014 at 9:43 am #3664thoughtonParticipantOkay 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!
July 2, 2014 at 9:53 am #3668thoughtonParticipantSorry 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
July 3, 2014 at 7:46 am #3675satoriKeymasterHey 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 StudioJuly 3, 2014 at 12:58 pm #3677thoughtonParticipantFantasitc! 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!
-
AuthorPosts
- You must be logged in to reply to this topic.