Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
579 views
in Themes by
hi every one

i want to add title to all widgets in snow theme

for example :

Custom HTML in sidebar box on every page:

this widget has no title

can any body help me for a code in qa-theme.php to add widget title ?
Q2A version: 1.7

2 Answers

+3 votes
by

Well, the sidebar isn't a widget by definition, but you can add a title to it anyway. You can do that in a few ways but I thing the most clean way, considering you're using Q2A 1.7, is to process it in the initialize() function this way:

public function initialize() {
    $this->content['sidebar'] = isset($this->content['sidebar']) ? $this->content['sidebar'] : '';
    $this->content['sidebar'] = '<h1>Title!</h1>' . $this->content['sidebar'];
    parent::initialize();
}

+1 vote
by

I recommend you will customize widgets() function in theme.php. Point is to use "class name" of each widget. However, some widgets (sidebar box, categories) do not have class name. They would require special processing in sidebar() and nav() in theme.php. To do so, you must have deep knowledge of PHP and data structure of Q2A.

Example of FlexArmor. In these themes, user (include admin) can change widget title in free.

...