Based on what you described:
function is_blog()
{
return ( is_home() || is_single() || is_category() || is_archive() );
}
And then just call the is_blog() function whenever needed.
I also found this, which looks like a more specific way to do the same thing https://gist.github.com/1189639
Related Posts:
- Adding a second email address to a completed order in WooCommerce [closed]
- What is the difference between get_page_link and get_permalink functions?
- Possible to search by author name with default WordPress search function?
- Breadcrumbs showing Parent and Child Pages
- Influence of WordPress functions on site speed
- Is it possible to override this function/class in a child theme?
- mysql custom wp query
- TinyMCE custom stylesheets for different post types
- When new user register then add new user role
- Change meta tags programatically
- Display random text from a file with the WP built-in AJAX API
- Remove bulk actions based on user role or capabilities
- Set first oembed in post to a global variable or function
- Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons
- Use a function to update post meta based on other post meta
- How to override filter in child theme?
- Use Exact Image Size using add_image_size
- How can I tell when a user is logged in?
- Enqueue Style in Functions.php
- How allow users to save list of posts?
- Formatting Multiple add_theme_support Arguments
- Unable to get_the_content(); of a post in WordPress via AJAX
- Limit posts only on home page – ideally in functions.php
- Make Categories a Dropdown Menu in Media Library
- Ajax call theme functions from front
- Show excerpt for only first post in query
- How to add css class to image attached in all the posts?
- If is multiple page templates
- Is there a way to add a class to non current menu item?
- What will happen if I delete the functions.php file?
- how to add an image to the footer?
- How to properly add function called by action-hooked function to functions.php?
- Get Current User info using wp_localize_script, in functions.php
- How to add new embed handler not supported by oembed?
- How do I permanently Disable Attachment Post URL
- Need to add class=”lightbox” for every single post image
- Child Theme files – what is needed?
- How do I add Bootstrap and LESS to my migrated WordPress site?
- Stuck on maintenance mode
- Publish/Update post is changing image links from file url to post url
- How to stop twenty fifteen theme from cropping featured images?
- How to display custom option field in woocommerce orders in admin panel?
- Update user meta of author when post content is viewed
- Don’t display html if function returns nothing
- If ACF field is empty show different value [closed]
- Load custom css in functions.php causing library issue
- How i can put $_GET codes in function.php?
- In jquery use php variable to execute an enqueued jquery file
- Is there a way to direct unregistered user to registration page when click a link?
- Auto log in hook is requiring a page refresh
- How to stop media_sideload_image from running when deleting a post?
- I want to display latest post in marquee [closed]
- Add php code to wp_print_scripts?
- How to get an attachment id from a filename
- how to get the post ID from wp_insert_post
- Remove ‘page-numbers’ class from prev and next tags
- How can I set the SRC URL of the custom logo image?
- The Capability to choose post/page template
- How to make custom comment fields required
- How do I register a new settings page? [closed]
- Include Jquery libraries in wordpress theme?
- WooCommerce -> wc_enqueue_js not working [closed]
- Use existing image sizes for WooCommerce
- Add a mature content warning to first-time visitors
- Retrieve First Image Function
- User meta and public function security
- Any adverse effects of adding apply_filters to a function?
- How can I remove page titles without removing the link in the navigation bar in twentyeleven?
- Display ACF category image on archive and single template files
- How to get taxonomy tree ids without running expensive loops
- wordpress built-in Jalali date convertor
- Change WooCommerce Payment Options From Radio Buttons to Dropdown Menu
- WordPress Function Assistance with Loop
- Using get_terms for custom taxonomy in functions.php
- Populate acf-field, depending on block name
- Add Change role button for list of user in an event
- Child theme remove parent filter in functions
- Set URL Parameter Post Layout As Default
- Exclude admins from query get posts
- I am trying to set post terms to a custom taxonomy
- Classic TinyMCE messing up only Contributor’s HTML
- Reference multiple style sheets, clearing styles for permalink page, custom fields for css
- How to add publish/draft button in Admin Post Lists
- Show users last read posts for each user?
- Woocommerce – change order status from on-hold to pending payment
- Disable links to images only if link is an image
- How do I integrate my Child Theme into a Custom Template?
- Sending Messages Back to the Template After Processing?
- Shortcode to eliminate and replace with
- Why are some custom javascript files working but some are not
- WordPress Javascript Widget jQuery Dependency Issue
- Allow tags and attributes in post and pages content
- using enqueue_script in a shortcode isn’t working
- Syntax for a function in order to get post’s title in JSON encoded response [closed]
- Comment Function
- Filter to strip unnecessary attributes
- Will my WordPress site become vulnerable after adding this functions which allows more HTML tags for subscribers?
- get_post_class() not working well
- Different ads on every website on multisite environment
- How to get variable from other function inside class function using add_action for Ajax call