Let current user know pending posts counts using wp_query

As others have already noted in the comments, using “posts_per_page” => 5, is better option than “posts_per_page” => -1, for your query as it will give you the information you need for your conditional check. Limiting what is queried is also something to consider – as honk31 mentioned. Along ‘fields’ => ‘ids’ you can also … Read more

Show Featured Image Dimensions and size frontend with shortcode

Yes, that is possible. Building upon the answer Nicolai Grossherr gave to Get the size (size in Kb or MB) of an featured image? you could do something like this, // e.g. in functions.php add_shortcode( ‘my_image_metadata’, ‘my_image_metadata_callback’ ); function my_image_metadata_callback($atts) { $img_meta = wp_get_attachment_metadata( get_post_thumbnail_id() ); if ( ! $img_meta ) { return; } $upload_dir … Read more

Contact Form 7 WordPress, checking a few fields, if empty then invalid

I solved my problem add_filter(‘wpcf7_validate_text’, ‘or_input_validation_filter’, 20, 2); function or_input_validation_filter($result, $tag) { if (‘your-link’ == $tag->name) { $your_link = isset($_POST[‘your-link’]) ? trim($_POST[‘your-link’]) : ”; $your_file = (!empty($_FILES[“file-image”][“name”])) ? trim($_FILES[‘file-image’][‘name’]) : ”; if($your_link == ” && $your_file == ”) { $result->invalidate($tag, “One of the fields has not been completed?”); } } return $result; }