Sort custom-posts in archive.php via meta-key?

Just use the appropriate conditionals: function change_order_for_events( $query ) { //only show future events and events in the last 24hours $yesterday = current_time(‘timestamp’) – 24*60*60; if ( $query->is_main_query() && (is_tax(‘event_type’) || is_post_type_archive(‘wr_event’)) ) { $query->set( ‘meta_key’, ‘_wr_event_date’ ); $query->set( ‘orderby’, ‘meta_value_num’ ); $query->set( ‘order’, ‘ASC’ ); //Get events after 24 hours ago $query->set( ‘meta_value’, $yesterday … Read more

Category specific months list in sidebar.php

you can use getarchives_where filter to get archives by category add_filter( ‘getarchives_where’, ‘my_archives_filter_function’, 10, 2 ); // your filter function replace YOUR CATEGORY ID with category term id e.g(3) function my_archives_filter_function($where) { global $wpdb; $where .” AND $wpdb->posts.ID IN (SELECT $wpdb->posts.ID FROM $wpdb->posts INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id … Read more

widget should display post archive by year and on click also by month

I did this for a client and it looked like this: The PHP code: <dl class=”tree-accordion”> <?php $currentyear = date(“Y”); $years = range($currentyear, 1950); foreach($years as $year) { ?> <dt><a href=””><i class=”fa fa-fw fa-plus-square-o” aria-hidden=”true”></i> <?php echo $year; ?></a></dt> <?php $archi = wp_get_archives(‘echo=0&show_post_count=1&type=monthly&year=” . $year); $archi = explode(“</li>’, $archi); $links = array(); foreach($archi as $link) … Read more

Pagination on archive.php page

I think your issue is that wp_pagenavi() is doing pagination based off of the global $wp_query instance instead instance you created. You should either switch to using query_posts() to replace the global query instead, or use WordPress’ built in paginate_links to output the paging.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)