/questions/ask Dynamic Widgets Mystery

I realize that /questions/ask is rendered by the file ask-question.php. I have copied this to my theme's folder and customized it just fine.

The problem I have is with the sidebar. I use dynamic widgets to control what shows up in the sidebar. For the other files archive-question.php, single-question.php, etc.. the sidebar display behaves as expected i.e when I tell it to show/hide a widget for the custom post type question it does. However, /question/ask seems immutable to any settings in dynamic widgets - it is showing every widget no matter what I disable. It appears it is in "never never land" as far as dynamic widgets is concerned.

  • Timothy Bowers

    Hey there.

    On line 53 of that code is:

    if ( !isset( $qa_general_settings["full_width"] ) || !$qa_general_settings["full_width"] )
    	get_sidebar( 'question' );
    ?>

    You could replace this should you wish, so that it uses the same sidebar as the rest of your theme. Note though that in doing so would stop the full width option from working from the settings page unless you kept it within the same conditional statement.

    Hope this helps.

    Take care.

  • mbreu996

    Thanks for the quick response.

    I left this out of my original post but I did try removing 'question' from get_sidebar and calling it like this in an effort to retrieve my themes sidebar:
    get_sidebar();

    But this didn't solve my problem.

    Furthermore...
    I am not having any issues with my dynamic sidebar content served by archive-question.php, single-question.php, and all the other "templates" (which use sidebar( 'question')) except ask-question.php.

  • Hakan

    Hi,

    I just came to backup Tim as this is very special case and not directly related to Q&A.

    There is no mystery here :slight_smile: The reason that Dynamic Widgets does not work for that page is simply because Dynamic Widgets does not have a setting for that, in other words Dynamic Widgets does not support this type of pages called with a special query.

    See a list of supported types here:
    http://www.qurl.nl/dynamic-widgets/

    An "ask" page, as well as "unanswered" and "edit" page, is neither single, nor taxonomy (category or tag), nor archive custom post page. So they are not in the list.

    These are special pages whose status can be seen with get_query_var( 'qa_ask' ), get_query_var( 'qa_unanswered' ) and get_query_var( 'qa_edit' ).

    You may request from Dynamic Widgets author to include a selection for such special queries, but for the time being you can add your own logic before get_sidebar or change it as get_sidebar( 'ask-question') and create a special sidebar-ask-question.php file in which you can call the widgets you want to display.

    I hope this helps.

    Cheers,
    Hakan

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.