Customizing the output of the archive and category widget without altering the original behavior of the widget

The current unmodified output looks like this →

<div id=”archives-4″ class=”widget widget_archive”>
<h2 class=”h2b”>Archives</h2>
<ul>
<li><a href=”http://………/2017/11/”>November 2017</a>&nbsp;(3)</li>
<li><a href=”http://………/2017/10/”>October 2017</a>&nbsp;(9)</li>
<li><a href=”http://………/2017/09/”>September 2017</a>&nbsp;(6)</li>
<li><a href=”http://………/2017/05/”>May 2017</a>&nbsp;(7)</li>
<li><a href=”http://………/2017/04/”>April 2017</a>&nbsp;(1)</li>
<li><a href=”http://………/2017/03/”>March 2017</a>&nbsp;(5)</li>
<li><a href=”http://………/2017/02/”>February 2017</a>&nbsp;(8)</li>
<li><a href=”http://………/2017/01/”>January 2017</a>&nbsp;(1)</li>
</ul>
</div>

But I want that finally, it should look like this →

<div id=”archives-4″ class=”widget widget_archive newinjected_class1″>
<h2 class=”h2b”>Archives</h2>
<ul class=”newinjected_class2″>
<li><a href=”http://………/2017/11/”>November 2017</a>&nbsp;(3)</li>
<li><a href=”http://………/2017/10/”>October 2017</a>&nbsp;(9)</li>
<li><a href=”http://………/2017/09/”>September 2017</a>&nbsp;(6)</li>
<li><a href=”http://………/2017/05/”>May 2017</a>&nbsp;(7)</li>
<li><a href=”http://………/2017/04/”>April 2017</a>&nbsp;(1)</li>
<li><a href=”http://………/2017/03/”>March 2017</a>&nbsp;(5)</li>
<li><a href=”http://………/2017/02/”>February 2017</a>&nbsp;(8)</li>
<li><a href=”http://………/2017/01/”>January 2017</a>&nbsp;(1)</li>
</ul>
</div>

Did you realize the new two classes:

newinjected_class1
newinjected_class2

Is this possible we can achieve this through some filter so that only output is modified without altering the normal behavior of the widget?

Read more here:: Customizing the output of the archive and category widget without altering the original behavior of the widget

Leave a Reply

Your email address will not be published. Required fields are marked *