Hello,
I'm developing my new corporate website with Wordpress. I bought a Truethemes theme called Karma which is fine.
However, as I have lots of widgets I want to display permanently (news feed, twitter feed, links, newsletter subcription), I need a template that has sidebars on both the left and right sides, with content in the middle.
Karma doesn't have this, and I was told by the Truethemese support base to get in touch with a developer here.
Can anyone help me. Have a look at linguaid.net/wordpress for more (very much in development).
Many thanks
Joss Frimond
Gabriel Reguly answers:
Hi Joss,
This will give you 2 sidebars:
---Edit--- First version was incorrect. This one is correct ---/edit---
--- 2nd Edit, --- Added a missing <?php ---/edit---
<?php
/*
Template Name: Left & Right Nav
*/
?>
<?php get_header(); ?>
</div>
<!-- header-area -->
</div>
<!-- end rays -->
</div>
<!-- end header-holder -->
</div>
<!-- end header -->
<?php truethemes_before_main_hook();// action hook, see truethemes_framework/global/hooks.php ?>
<div id="main">
<?php get_template_part('theme-template-part-tools','childtheme'); ?>
<div class="main-holder">
<?php
//retrieve value for sub-nav checkbox
global $post;
$post_id = $post->ID;
$meta_value = get_post_meta($post_id,'truethemes_page_checkbox',true);
if(empty($meta_value)){
get_template_part('theme-template-part-subnav-left','childtheme');
}else{
?>
<div id="sub_nav">
<?php generated_dynamic_sidebar(); ?>
</div>
<!-- end sub_nav -->
<?php } ?>
<div id="content">
<?php if(have_posts()) : while(have_posts()) : the_post(); the_content(); truethemes_link_pages(); endwhile; endif; ?>
</div>
<!-- end content -->
<?php
if(empty($meta_value)){
get_template_part('theme-template-part-subnav-right','childtheme');
}else{
?>
<div id="sub_nav" class="nav_right_sub_nav">
<?php generated_dynamic_sidebar(); ?>
</div>
<!-- end sub_nav -->
<?php } ?>
</div>
<!-- end main-holder -->
</div>
<!-- main-area -->
<?php get_footer(); ?>
Save it as template_left_right_nav.php and you will see the new template.
Regards,
Gabriel
Gabriel Reguly comments:
Hi Joss,
Sorry, I misunderstood the solution I was proposing.
Now I got a better one, the only caveat is that the sidebar names are fixed and you must create them in order to work.
The sidebar names are left and right.
<?php
/*
Template Name: Left & Right Sidebars
*/
?>
<?php get_header(); ?>
</div>
<!-- header-area -->
</div>
<!-- end rays -->
</div>
<!-- end header-holder -->
</div>
<!-- end header -->
<?php truethemes_before_main_hook();// action hook, see truethemes_framework/global/hooks.php ?>
<div id="main">
<?php get_template_part('theme-template-part-tools','childtheme'); ?>
<div class="main-holder">
<div id="sidebar" class="left_sidebar">
<?php generated_dynamic_sidebar('left'); ?>
</div>
<!-- end sidebar -->
<div id="content" class="content_sidebar content_right_sidebar">
<?php if(have_posts()) : while(have_posts()) : the_post(); the_content(); truethemes_link_pages(); endwhile; endif; ?>
</div>
<!-- end content -->
<div id="sidebar">
<?php generated_dynamic_sidebar('right'); ?>
</div>
<!-- end sidebar -->
</div>
<!-- end main-holder -->
</div>
<!-- main-area -->
<?php get_footer(); ?>
Regards,
Gabriel