How can I create a shortcode to show the number of posts of actual day?

I tried some codes, and I think finally works after several tries: function ts_day_f() { $posts= get_posts(array( ‘numberposts’ => -1, ‘post_status’ => ‘publish’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘date_query’ => array( ‘column’ => ‘post_date’, ‘after’ => ‘today’, ‘before’ => ‘tomorrow – 1 second’, ) )); if ( is_user_logged_in()) { //return count($posts); $c = count($posts); … Read more

restrain filter on get_the_excerpt to queried item in stead of current post

Looking at the documentation for the get_the_excerpt filter, we can see that it receives the WP_Post object representing either the current post or the post which was passed in to the get_the_excerpt() function call. Thus, function q_excerpt_custom( $excerpt, $post ) { if ( get_post_type( $post ) == ‘post’ ) : $excerpt_custom = ‘<a class=”card-permalink” href=”‘ … Read more

remove edit link only for published post and pending post

Try this, where I changed the function to accept the second parameter which is the current post in the list table: add_filter( ‘post_row_actions’, ‘remove_row_actions’, 10, 2 ); function remove_row_actions( $actions, $post ) { if ( $post && ‘post’ === $post->post_type && in_array( $post->post_status, array( ‘publish’, ‘pending’ ) ) ) { unset( $actions[‘edit’] ); } return … Read more

Reorder a page of posts of a certain taxonomy/value by a custom field

Well, I did it like this. Maybe it will help someone. add_filter( ‘pre_get_posts’, function () { global $wp_query; // article type – change posts per page. If webinars then change order to webinar_date if ( isset( $wp_query->query[‘article_type’] ) ) { set_query_var( ‘posts_per_page’, 12 ); if ( $wp_query->is_tax(‘article_type’, ‘webinar’) ) { $wp_query->set( ‘meta_key’, ‘webinar_date’ ); $wp_query->set( … Read more

Woocommerce template file outputting tags

Cart page is loaded via customizable WordPress Page. Edit your page and check if the “HTML” editor tab content contains any “code” HTML tag. If you cannot find this tag, you will need to check all actions executed with “woocommerce_before_cart” and “woocommerce_after_cart”.

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