Display posts from today and future in Elementor ‘posts widget’

Here is the working solution: add_action( ‘elementor/query/my-custom-query’, function( $query ) { $meta_query = $query->get( ‘meta_query’ ); $query->set( ‘date_query’, array( array( ‘after’ => date(‘l, F jS, Y’, strtotime(‘+0 day’)), ) ) ); } ); You can change the strtotime (+1 day….+n day ….-n day) to fetch the event’s date you’re looking for. The date format here … Read more

Modify Contextual Help

If you want to remove some or all (default) help tabs, then you could do something like this inside your function. $current_screen = get_current_screen(); $white_list = array( ‘overview-link’, // If you want to keep default some tab title and content ); if ( $current_tabs = $current_screen->get_help_tabs() ) { foreach ($current_tabs as $tab_key => $tab_config) { … Read more

Distinguish between page and post in function

By using post id you can get post type of current post/page. try below code. i have tested and it is working fine for me. add_filter( ‘admin_post_thumbnail_html’, ‘foo’,10,3 ); function foo( $content, $post_id, $thumbnail_id ) { if ( get_post_type( $post_id ) == ‘page’ ) { $content=”<p>foobar</p>” . $content; } else{ $content=”<p>barfoo</p>” . $content; } return … Read more

WordPress add_filter to post_date

You need to add an additional filter on the frontend. Very basically it would look like this: Frontend (eg. single.php): echo apply_filters( ‘my_custom_persian_filter’, $post_date ); Backend (eg. functions.php) function persian_date_function( $date ) { $date = $converted_to_persian; // there you convert date to persian return $date; } add_filter( ‘my_custom_persian_filter’, ‘persian_date_function’ );