Is it possible to create a new set of dummy sidebar widgets for POST pages only? Looking at the sidebar.php file, I see where they call those out. I'd like to have a dummy sidebar widget, like dummy_widget(4), the news widget for certain categories that appears on all POST pages. I know I can create custom widgets by category, but since I am using this as a CMS, I already have quite a few on the PAGES. Adding them for each category would add an enormous amount of clutter to my backend.
New 'Dummy' Sidebar Widgets10 posts from 2 voices
This ones seems to be scaring folks off :)
I had another thought but couldn't find any reference on how to execute it. Maybe I can get some help on that.
The idea is to add another option to the admin area in the sidebar_footer.php file. Adding a new array for "Extra Widget Areas for specific Tag." Why a tag? Isn't displayed anywhere on my site, so it would only serve to add the custom widget to ALL post with the tag (insert tag here). I can manage this much.
Now to edit the sidebar.php with the new "unique Tag sidebar." The thought below, not sure if this is right:
//unique Tag sidebars:
if (function_exists('dynamic_sidebar') && dynamic_sidebar('Tag: '.$custom_widget_area) ) : $default_sidebar = false; endif;
Now for what I ASSUME is the last file to edit, "widget.php." It stands to reason that I need to create another "$dynamic_widgets" box. I'm just not sure how to call out the tags like you can with the categories.
Now this could all be totally wrong, but if not...any ideas.
you can add a dummy widget to posts by replacing following code in sidebar.php:
dummy_widget(1); dummy_widget(2); dummy_widget(3);
dummy_widget(1); dummy_widget(2); dummy_widget(3); dummy_widget(6);
Afterwards replace following code in widgets.php:
case 5: echo "<h3 class='widgettitle'>Latest News</h3>"; $sbNews = new Kriesi_sidebar_news_Widget(); $sbNews->widget(array(),''); break;
case 5: echo "<h3 class='widgettitle'>Latest News</h3>"; $sbNews = new Kriesi_sidebar_news_Widget(); $sbNews->widget(array(),''); break; case 6: echo "<h3 class='widgettitle'>Custom Dummy Code</h3>"; echo "My widget code"; break;
and adjust the "case 6" widget code.
Worked like a charm, but I have a follow-up if I could continue to pester you. I've plugged in the news_ widget and would like to know how to adjust the widget for a certain category and number of post. Thanks for all your help.
you can select the categories in the widget option fields. Go to Appearance > Widgets and open up the widget settings for the news widget. In the option field with the caption "Enter the ids of the categories you want to display, separate them by comma" enter the category ids of your choice.
But since this is one of the dummy widgets and it hasn't had a box registered to it in the appearance/widget area, how can I enter that into the News Widget. Other than the standard boxes that come with the theme and those generated by the sidebar/footer menu with pages and categories, I don't know where I could define the parameters in the dummy widgets.
Anyone have a chance to take a look at this one?
the only chance I see is to adjust the default settings in framework\theme_widgets\sidebar_news.php
Seemed to be too many variables to make it work with the widget. Coded what I needed into the widget file with some conditionals in the sidebar file. Works like a charm. Thanks, as always for your help.
Glad that you found a solution :)
You must log in to post.