Please contact us at support@actionagainststalking.org with the reference to this job position and your CV attached.
function check_category_post_count($atts) {
$atts = shortcode_atts(array(
'category' => 'jobs', // Default category slug
), $atts);
// Get the category slug from the shortcode attribute
$category = $atts['category'];
// Set up the query to check if there are any posts in the "Jobs" category
$args = array(
'category_name' => $category, // Use category slug (not name)
'posts_per_page' => 1, // We only need to check if at least 1 post exists
);
$query = new WP_Query($args);
// Return a class depending on whether posts exist or not
if ($query->have_posts()) {
return 'posts_found'; // Class to indicate posts exist
} else {
return 'no_posts'; // Class to indicate no posts found
}
}
add_shortcode('category_post_check', 'check_category_post_count');