cityfox
asked 9 years ago

Hi,

I have a template problem at the category page.

My theme Origamiez provides for pages and posts

  • a default template (one sidebar)
  • an additional three cols template (two sidebars)

In ‘Appearance –> Customize’ I activated the additional three cols template (two sidebars) for single post and blog posts.

I’d like to have the same look (two sidebars) for all DWQA pages. It works for the pages "question list" and "submit question" and it also works for a single question. But it doesn’t work for the category page.

How can I enable the template with two sidebars also for the category page?

cityfox

5 Answers
DominicStaff
answered 9 years ago

Hi,
Please send me username & password of your site (via private answer) for further checking.
Regards,

cityfox
answered 9 years ago

Hi Dominic,

unfortunately I cannot give you direct access because I work on an Intranet site that is located on an internal server and I have to respect data safety rules. I can send you screenshots that illustrate the issue. I don’t know how to attach the screenshots here. Can you give me your email address so I can send them directly?

Cheers,

cityfox

Allen
answered 9 years ago

@Merle Theeß: hi,right now dwqa category is gettings the page.php file of your theme to put content by default so it get the page.php style to display. To resolve your problem , you could follow this instruction, this could help you achieve that but just temporary with this settings :
1st , you can open file : origamiez/page.php go to line line 4 ( under "?>" ), and then add this code:

<?php if ( is_main_query() && 'dwqa-question_category' == get_query_var('taxonomy') ) get_sidebar('middle'); ?>

after that , you can open file : origamiez/inc/functions.php
go to line about 1389 and add this code :

if ( 'dwqa-question_category' == get_query_var('taxonomy') ) {
      $classes[] = "page page-template page-template-template-page-three-cols-slm page-template-template-page-three-cols-slm-php logged-in admin-bar list-dwqa-question origamiez-layout-right-sidebar origamiez-layout-single origamiez-layout-static-page without_bg_slides origamiez-boxer origamiez-skin-default origamiez-header-style-left-right customize-support";
     }

Hope this help.

advandate
replied 9 years ago

How can I change the category page to be full width?

nobita
replied 9 years ago

hi, i see your question in http://www.designwall.com/question/full-width/, please follow this link , send us your site , we’ll check it for you. Thanks

cityfox
answered 9 years ago

Hi Allen,

thank you for your help. It’s much appreciated.

Basically it works but there’s one point left: I fill the "middle" Origamiez sidebar (with layout ‘three-cols-slm’ it is on the left) individually with widgets by using the plugin "Dynamic Widgets". On the DWQA category pages all widgets in that sidebar show up – although I set the visibility to "No" for ‘categories archive (questions)’ with the plugin "Dynamic widgets".

Do you have an idea how to solve this? On the other DWQA pages the "Dynamic Widgets" rules work fine.

cityfox

nobita
replied 9 years ago

@Merle : hi, unfortunately, because according to your theme, this page we’re using is not ‘Categories archive’, so it’s kinda not working properly, i think we need to add some custom code to resolve this.Do you wanna try it ?

cityfox
replied 9 years ago

Hi Allen,

yes I wanna try it and would be very thankful if you could send me the code and let me know where it has to be placed.

I will inform the author of the Origamiez theme when we have figured out a solution. He provides great support so chances are good that he will include the solution in next version of his theme.

Merle

nobita
replied 9 years ago

hi mate, well if we use java script, we need to know which widget you want to hide at that category page. You could follow this intruction :
First , you need to send a variable to js file by doing this : open fileinc/functions.php , go to line 1217, add this code :

$widget_hide_action = false;
    if ( 'dwqa-question_category' == get_query_var('taxonomy') ) {
      $widget_hide_action = true;
 }

and below that , change the function wp_localize_script() to :

wp_localize_script(ORIGAMIEZ_PREFIX . 'origamiez-init', 'origamiez_vars', apply_filters('get_origamiez_vars', array(
        'info' => array(
            'home_url' => esc_url(home_url()),
            'template_uri' => get_template_directory_uri(),
            'affix' => '',
        ),
        'config' => array(
            'is_enable_lightbox' => (int) get_theme_mod('is_enable_lightbox', 1),
            'is_enable_convert_flat_menus' => (int) get_theme_mod('is_enable_convert_flat_menus', 1),
            'is_use_gallery_popup' => (int) get_theme_mod('is_use_gallery_popup', 1)
        ),
        'widget_hide_action' => $widget_hide_action,
    )));

after that , you open file : js/Origamiez.init.js
go to the bottom of file and add code like this :

jQuery(document).ready(function($) {
    if ( true == origamiez_vars.widget_hide_action ) {
        $('#<sidebar id> .<widget class>').addClass('hide');
    }
});

It’s mean at that page , the widget in a specific sidebar will be hidden.
like this : if you want to hide the widget calendar from middle sidebar this : $('#sidebar-middle .widget_calendar').addClass('hide'); . If you dont know which sidebar and widget class you want to hide , you can provide me information about it , i’ll help you find the id and class. Glad

cityfox
answered 9 years ago

Hi Allen,

thank you so much for your help.

I successfully hided all unwanted widgets except for one that comes from the plugin "BWL Knowledge Manager". In the plugin files I found a php file named ‘bkb-category-widget.php’ with following code:
class BKB_categories_widget extends WP_Widget { public function __construct() { parent::__construct( 'bkb_categories_widget', 'BKBM Categories Widget', array('description' => __('Display Knowledge Base Categories.' , 'bwl-kb')) ); }

So I added the following line in ‘js/Origamiez.init.js’ (like for the other widgets):
$('#sidebar-middle .BKB_categories_widget').addClass('hide');

But the widget is still visible.

Overall I think that this solution may be too complicated. I assumed that I can add code that makes the "Dynamic Widget" rules work for the DWQA category pages and that this code could be included in the next update of the Origamiez theme so it works for everyone. Manually adding code each time the theme is updated is not the best way, especially if there are several site admins.

I think about another solution:
The DWQ plugin has a drop-down menu for the categories. So it’s not really neccessary to let the users go to a DWQA category page. So my idea is to hide/disable all links to DWQA category pages (on questions page and single question page). For the single question page I found the css class ‘dwqa-category-name’. But on the questions page I cannot find a css selector for the category name (link) that is displayed after the date. Could you add a css class to it?

Moreover, I have a suggestion for improving the navigation:
On a ‘single question page’ and on the ‘submit question page’ there is no direct way back to the questions page (overview of all questions). Could you extend the breadcrumb with a slug for the questions page?

Like that:
Home > [Questions] > [Single Question Name]
Home > [Questions] > [Submit Question Form]

Let me know what you think.

Cheers,

Merle

nobita
replied 9 years ago

@merle : hi , thank you for your reply. At this time , we are updating DWQA to a new version , about your issue , maybe it could be wrong class, you could detect it by using "inspect element" or you can send me your site.
Well , DWQA next version gonna be released soon. Stay tune with us then , glad.

cityfox
answered 9 years ago

Hi Allen,

thank you for your quick reply. I’m looking forward to the update.

For my issues:
1) Inspect element shows that the category name on the questions page is a span element without class.

2) Site layout: As mentioned above my goal is to have the same look for all DWQA pages. The single questions are displayed in my theme’s ‘three-cols-slm’ template. So I thought it would be good to let all DWQA pages use the three cols template. This led to problems with the DWQA category page (as discussed above). So now I think about using the standard template (two cols) for all DWQA pages. This works for all pages except the ‘single question page’ which automatically uses the ‘three-cols-slm’ template that I use for the blog posts. Is it possible to let the ‘single question page’ use the standard template (two cols) but keeping the ‘three-cols-slm’ template for the blog posts?

Thanks again for your help and good work.

Merle

nobita
replied 9 years ago

well , it would better if you send me the link to you site, i’ll check the 1st issue :D, about 2nd issue , i think it might be tricky but it could be. First, you need to change in file : inc/functions.php and then , go to line 1379, change the code there to :

if (is_single() && 'dwqa-question' != get_query_var('post_type') ) {
        $single_post_layout = get_theme_mod('single-post-layout', 'two-cols');
        $classes[] = "origamiez-single-post-{$single_post_layout}";
    }

and then go to line 1394, below there you add code like these :

 if ( is_single() && 'dwqa-question' == get_query_var('post_type') ) {
      $classes[] = "single logged-in admin-bar origamiez-layout-right-sidebar origamiez-layout-single origamiez-show-border-for-images without_bg_slides origamiez-boxer origamiez-skin-default origamiez-header-style-left-right origamiez-single-post-two-cols customize-support";
     }

After that , you need to open file : part/single/layouts/three-cols.php: change the code at line 80 to :

<?php  if ( is_single() && 'dwqa-question' != get_query_var('post_type') ) { 
        get_sidebar('middle'); 
        }
 ?>

and in file : part/single/layouts/three-cols-slm.php, line 81:

<?php  if ( is_single() && 'dwqa-question' != get_query_var('post_type') ) { 
        get_sidebar('middle-clone'); 
        }
 ?>

hope this help

Powered by DW Question & Answer Pro