Drop down list code for sidebar

Well, in a “layman’s” terms, you need to add your preferred filter (specific category id and order) to the $args array, like so: $args = array( ‘numberposts’ => ‘5’, ‘post_status’ => ‘publish’, ‘cat’ => 5, ‘order’ => ‘ASC’, ‘orderby’ => ‘title’ ); The ‘cat’ should be the id of the “specific” category you want to … Read more

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

No, there are no filters for doing this. You would need to create your own version of the widgets in order to achieve this. You can find the default WordPress widgets in the following folder: /wp-includes/widgets in your WordPress installation. Simply copy the code from within the respective widget .php files in to your theme … Read more

wordpress all post filter by year

<select name=”archive-dropdown” onchange=”document.location.href=this.options[this.selectedIndex].value;”> <option value=””><?php echo esc_attr( __( ‘Select Year’ ) ); ?></option> <?php wp_get_archives( array( ‘type’ => ‘yearly’, ‘format’ => ‘option’, ‘show_post_count’ => 1 ) ); ?> </select> This code may help you.

Remove all video attachment, both files and post/postmeta from database?

You call wp_delete_attachment passing $attachmentid which is undefined, so it can’t work… Also the $force_delete variable isn’t defined anywhere in your code. Also there is no point in using normal loop in here – you don’t use template tags in this action, so calling the_post is just a waste of resources… add_action( ‘set_user_role’, function( $user_id, … Read more