Tagged: category, combo widget, remove
-
AuthorPosts
-
November 5, 2015 at 6:09 pm #531048
I’m interested in removing a single category (Education – ID=4) from the Enfold Combo Widget – specifically the “Popular” section.
Can someone provide me with the code to make this happen?
Thanks so much!
November 6, 2015 at 6:33 pm #531619Any assistance on this?
Thanks in advance!
November 9, 2015 at 1:56 pm #532562Hey!
where can we find the element in question on your website? don’t know where to look at. Can you highlight using screenshots please? you can use imgur.com or dropbox.
Cheers!
AndyNovember 9, 2015 at 6:24 pm #532811Sure thing. Attached as private content.
Thanks Andy!
November 10, 2015 at 6:31 am #533063Hi!
You will have to modify the core files for that. Please edit framework > php > class-framework-widgets.php then look for the “avia_combo_widget” class. Go to line 941, look for this code:
avia_get_post_list('cat=&orderby=comment_count&posts_per_page='.$posts);
.. replace it with:
avia_get_post_list('cat=-4&orderby=comment_count&posts_per_page='.$posts);
The above modification works for the combo widget. If you want to modify the latest news widget query, look for the “avia_newsbox” class.
Regards,
IsmaelNovember 11, 2015 at 3:11 am #533821Ismael,
The changes for the combo widget worked perfectly. Thank you!I, however, could not figure out how to make the same changes to avia_newsbox — I didn’t locate a string similar to the one provided for avia_combo_widget. Can you provide me a little more guidance?
Thanks so much,
BrandonNovember 11, 2015 at 4:38 pm #534184Hi!
If you are using the latest version of the theme, please check around 919th line – http://i.imgur.com/BX3URcj.png
Cheers!
YigitNovember 12, 2015 at 8:25 pm #535067Thanks Yigit.
I WAS able to find and make the changes to the avia_combo_widget thanks to Ismael’s original post. I, however, haven’t had any luck with making the same changes to avia_newsbox.
Can you help me with this?
Thanks!
November 15, 2015 at 5:05 am #536014Hey!
If the latest news widget is in use, there’s an option to select the categories so you don’t need to modify the query. If you’re still interested with the query, you can find it around line 477:
$new_query = array( "posts_per_page"=>$count, 'tax_query' => array( array( 'taxonomy' => $this->avia_term, 'field' => 'id', 'terms' => explode(',', $cat), 'operator' => 'IN') ) );
Look for the category__not_in parameter for more info: https://codex.wordpress.org/Class_Reference/WP_Query
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.