Get .subsubsub count of post per status queried using pre_get_posts

Ah! jQuery to the rescue! function custom_admin_js() { global $get_all_statuses; ?> <script type=”text/javascript”> jQuery(document).ready(function($) { //Bring my $get_all_statuses array and encode it for jquery var myObjects = <?php echo json_encode($get_all_statuses);?>; //Run a each loop : jquery equivalent to php’s foreach $.each(myObjects, function (index, value) { //console.log(index); //Status Label //console.log(index); //Status-name //count the WP list rows … Read more

How to remove the Unattached filter on Media Library List?

As it turns out, with the introduction of the WP_List_Table class, view filter are now hookable and specifically you can filter out that detached link like so.. add_filter( ‘views_upload’, ‘upload_views_filterable’ ); function upload_views_filterable( $views ) { unset( $views[‘detached’]); return $views; } Bye bye detached link!… 🙂

WooCommerce Grid / List view

Undo any changes you’ve have made to the file, then add this at the top: if ( jQuery.cookie( “gridcookie” ) != “grid” ) { jQuery.cookie( “gridcookie”, “list”, { path: “https://wordpress.stackexchange.com/” } ); } Update: Sounds like a FOUC. Let’s take a different approach – remove the code you added above & try adding the following … Read more

WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term

You can try: $the_query = new WP_Query( array( ‘posts_per_page’ => ‘5’, ‘v_sortby’ => ‘views’, ‘post_type’ => array( ‘post’, ‘music’, ‘videos’, ‘albums’ ), ‘tax_query’ => array( array( ‘taxonomy’ => ‘content’, ‘field’ => ‘slug’, ‘terms’ => array( ‘indy’ ), ‘operator’ => ‘NOT IN’ ) ) )); to exclude the indy term in the content taxonomy.

Show number of views in the last 48 hours

There’s no way to identify when each of the page view’s recorded happened. It’s only logging the page view, not when it happened. To work around this you could keep a post_meta entry for each view, but this could create a lot of entries on popular sites. Alternatively you could keep daily counts & delete … Read more

Custom view counts not updating correctly

The issue was that the $query->set in the filter function was updating the main query used to count the number of posts. Likely due to the order in which they were called. I tried to flush and run a new wp_query but what ultimately worked best was the function below that uses a custom query. … Read more

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