Modify your wpb_total_posts
function like bellow:
function wpb_total_posts() {
$total = wp_count_posts()->publish;
if($total == 1){
echo 'We found', "<strong>" . $total . "</strong>", 'job';
}elseif($total > 1){
echo 'We found', "<strong>" . $total . "</strong>", 'jobs';
}else{
echo 'No posts found ';
}
}
Here I’m first checking if total amount of post is 1 or more and handling singular/plural accordingly. Lastly if there is no post then rendering “No post found”
Related Posts:
- What is the “with_front” rewrite key?
- Filter the query ONLY for the search results page
- How to add attributes to a shortcode
- Delete expired posts after a number of days after they expired
- How to use get_template_directory_uri() to load an image that is in a sub-folder of my theme?
- Customize WordPress Media Manager – Media Window
- Add attribute to link tag that’s generated through wp_register_style?
- How to override functions.php in child theme?
- Is it possible to maintain image aspect ratio when scaling images?
- Remove Page Title from Static Frontpage
- Default or Preset Content for Custom Post Types
- Problem using is_single() to enqueue script from functions.php
- If function exists, and array is met, echo function?
- Breadcrumb how i can display page title with parent > child title with permalink ? any Idea
- change a post status when users update posts?
- How often is functions.php loaded?
- Display height and width properties with the_post_thumbnail() or related function
- Cleaner way to access custom fields in code?
- Add a new subscriber role using a function
- change default option in wp_dropdown_categories
- Display a text message if the shortcode is found?
- How to store / access files in child theme folder
- How to set the jpg image compression for specific thumbnail sizes?
- Function to auto-set a featured image that is already in use
- Delete pages and Create default pages for all new network sites
- How to use IF Statement in WordPress?
- Woocommerce Storefront WordPress Ignore Media Gallery Images and use External 3rd Party Host
- Post thumbnail relative link and HTML modify
- Change the slug of a particular page every x hours
- Use of undefined constant bloginfo
- How would go about if I just want a temporary function?
- How do I edit wp_head and/or functions.php to remove rss-feed which isnt used and dont validate?
- Generating rel=prev and rel=next only on wordpress categories
- Change size and crop medium_large images
- Ninja form Redirect depending on text field content [closed]
- Display Password Protected external RSS in wordpress template
- Custom HTML in specific category single page and its descendant categories
- Modify a function without editing template
- How to hide unused profile fields?
- Problem only while using require_once() within functions.php
- Override widget in function WordPress
- WooCommerce – Want to show multiple currency for a single product [closed]
- How to change or add user role after getting post request data about pay? [closed]
- How to force field validation first, then its values saved durning edit profile?
- Filter out other users comments. Visualize only own comments and editor role users’ comments
- How to properly remove style for non logged in and front page only
- Add to cart php not working [closed]
- WordPress converts media extention URL automatically to video player
- Automatically include all php files in a child theme directory
- How do you Permanently Delete Sidebars
- Add a unique class to HTML tag/element
- Removing specific menu items?
- Allow Contributor to edit their own posts after Adm aproval
- help I changed one currency in woocommerce and everything is ruined [closed]
- How to run a function in every page, every device
- Which function required?
- How to ignore posts in pre_get_posts?
- How to retrieve the values of a sub-field in the first and last row of an (ACF) repeater inside function?
- AJAX error handling for submit function in functions file
- Do I need to use wp_reset_postdata for my function?
- New functions in separate directory — better, portable way
- get_pages() Returns Only One Item
- WordPress Migration error phpupdate_option is not a function
- Custom Query Not Paginating
- Use a shortcode to display custom meta box contents
- how to make has_block() see inside blocks too
- Solved: redirect to another page using functions.php
- Getting the teaser text without overriding global variables
- add_theme_support( ‘title_tag’ ) is not showing title on index.php
- Solution dealing with Child Theme / Parent theme functions
- Ajax resetting my global variable
- Problem enqueuing scripts on not single posts
- Function to pull data from user meta not working
- referencing the current user in a page i created in wordpress
- is_main_query() always returning false
- How to show ACF value under post/page title in wp-admin
- Undefined variable issue for wp_get_attachment_image_url
- Show ‘Add to Cart’ on Out of Stock products
- wp_get_current_user return ID = 0 when used outside of wordpress, such as webhook / fulfillment dialogflow
- Delete oldest wordpress post (SQL query)
- I can’t in any way include css in my theme using functions.php
- Pass post ID from archive template to functions file
- Competing Login Redirects – Need to be Combined?
- Warning and fatal error
- How to add styles in existing function?
- admin-ajax.php 403 forbidden only when calling from external file
- Featured image on archive page based on post type
- Problem with add_rewrite_tag
- getExcerpt: Make ellipsis appear only if character limit is reached
- jQuery HoverIntent is not a function
- Dynamic Title for custom post types
- How do I change the URL returned by next_posts_link()?
- WordPress SEO By Yoast Plugin is interfering with a custom function code – how to troubleshoot and fix it?
- shortcode inside post called by ID does not render as expected
- get_footer can’t find any variables set in functions.php
- Woocommerce – Checkout error message
- Adding and updating repeating custom field meta data
- How to hook wp_mail to add a custom email as BCC for each sent email?
- How to get postId from the argument $block when register_block_type()?
- WordPress is adding pagination for all pages not only for blog page, How to remove pagination for all pages except blog/posts page?