Dazzling child function override

I want to override the function “widget” in the inc/widgets/widget-popular-posts.php because I want the “recent” tab to be the first and active shown instead of the “popular” tab. I copied the original function widget( $args, $instance ) { … } to the file functions.php in the child theme and modified the following lines:

...
 <ul class="nav nav-tabs">
   <li class="active"><a href="#recent"><?php esc_attr_e( 'Recent', 'dazzling' ); ?></a><                   /li>
   <li><a href="#popular-posts"><?php esc_attr_e( 'Popular', 'dazzling' ); ?></a></li>
...

But that doesn’t work. I also tried to duplicate the whole directory structure inc/widgets/widget-popular-posts.php to the child theme and then modified the widget-popular-posts.php file, but that doesn’t work either. However if I modify the original theme it would work.

Any help?

I see that my code snippet was somewhat truncated or probably interpreted. How do I have to submit a code snippet? Anyway, I just inverted the two lines and moved the class “active” to the “recent” tab.

Hi @manderes,

I hope you are well today and thank you for your question.

You can achieve this by using the attached child theme of Dazzling theme that contains custom code in its functions.php file.

I see that my code snippet was somewhat truncated or probably interpreted. How do I have to submit a code snippet?

You have to just select the code snippet and wrap it in the code tags by clicking on the code button as shown in the attached screenshot.

Best Regards,
Movin

Thank you so much, Movin. It works perfectly.

Kind Regards
Michael

You are most welcome here :slight_smile: