You can perform simple check to make sure, the post type is post; before executing actual code.
For example:
add_action('wp_head', 'load_custom_style_for_posts');
function load_custom_style_for_posts(){
global $post_type;
if( 'post' == $post_type ){
echo "<style>blahblah</style>";
}
};
Place this code inside functions.php
Hope it helps! 🙂
Related Posts:
- How to remove duplicate sub-menu name for top level menu items in a plugin?
- Plugin update error message
- How to build an API as a plugin
- category_name not working (not showing up in sql query debug)
- How can I make my custom shortcode work in a Custom HTML Widget?
- Update Multiple Post Meta for the Same Post In One call?
- WordPress Hook that will run when media file deleted
- Set a User as Author of all ‘New Posts’ posted
- How do I configure WordPress to talk to a Microsoft SQL Server database?
- Post source link plugin – small modification
- Which hook callback has priority if both plugin and theme use the same hook?
- How can I make the “Preview Post” button save and preview in the same window?
- Cannot run the code after I activate the plugin
- Displaying admin notice dynamically
- Calling a plugin in theme development
- Unable to activate wordpress importer after installing it
- Get total number of comment of the posts written by an author
- How to get post URL in the_content filter?
- WordPress Ajax Callback
- printf – problem to understand code
- Why isn’t admin_notices displaying my text? [Simple Plugin, Beginner]
- add_query_arg not working
- Theme my Login plugin, how to update fields
- How would I go about creating a user ranked post popularity page?
- WordPress: PHP code rendering in the wrong place
- New to wordpress, Question about editing PHP
- How to edit content before post update
- Customize permalink wordpress category id
- Take input from form and pass it to function using a wp-plugin
- Self-serve ad system like Reddit’s for WordPress? [closed]
- Class variables not correct on page
- Load Javascript from Plugin in One Page Only?
- Why is one phpunit test throwing an error on one class when all other classes are similar without error?
- WordPress call_user_func_array() expects parameter 1 to be a valid callback, class
- Call plugin with php function
- Why is my custom post type not being activated on plug-in activation?
- Setting Up PHP Workflow in WordPress
- How can I exclude a dynamic URL to show a popup created using ‘WordPress Popup’ plugin
- iframe not showing in post (with “allow php in posts” plugin activated)
- how can I do something on new user registration?
- Any idea how to get something like this to work? [closed]
- wp_dequeue_script for a Plugin
- output html on post or page from custom plugin [closed]
- Built a second plugin but it overwrote the first one
- WordPress: Add custom add_filter for custom functions
- Api external with wordpress
- How to delete all categories programatically?
- How to use custom Javascript code inside a plugin?
- Using meta_query in a WP_Query not working for numbers properly
- File Uploader – Upload without adding to Media Library
- Building a plugin into a theme
- 2 wordpress site same database
- Trying to include files in plugin isn’t working
- Code for unique user visit count on every page WordPress
- Searching a tab/space delimited text file based upon form criteria and returning a ‘record’ into a word press results page
- implement custom roles in custom plugin
- How to get current cart values using WC_Shortcodes?
- How to authorize viewing and clicking a function only logged users?
- WordPress is redirecting me to homepage
- How can we get this dynamically as this folder may not be by the same name always → wp-admin
- Cant create table on plugin activation
- How to arrange custom posts in the backend/admin by custom taxonomy
- Redirect to a page while maintaining search query parameters without causing an infinite loop
- How to ignore fields if empty?
- Why is my shortcode not working?
- Moving a few select DB tables to a new WP instance
- implement checkbox or toggle switch in plugin code
- How to get the total count of Favorite/Favorited authors
- Admin login substantially slower on production server
- redirect to a custom page
- GET web api method from a WordPress PHP script
- How to change text in a page by utilizing a custom user id?
- Adding link on title its in description but not in title see screenshots attached
- How can I insert a record into a custom table from my custom form in my custom admin page?
- How to save information related to post in database?
- Save selectlist value (taxonomy) in wp:wp_set_object_terms
- Page doesn’t load
- Metabox Data not saving
- conditional tags for the output of a plugin
- Xml output not places where i want
- Can’t insert files in other inputs
- Including a PHP file via a function that is part of a plugin?
- How do I output user_registered time in my correct timezone?
- How to fix ‘Call to undefined function do_settings()’ error?
- Creating a press page for our project
- how to search through plugin in wordpress cimy-user-extra-fields?
- Integrate Razorpay quick payments plugin with contact form7 plugin
- wordpress illegal string offset ‘parameter’ error
- Translate text for empty product
- Passing an input variable through a switch statement
- How to add custom html to the Media > Attachment Details modal?
- Refresh server side rendered block in Gutenberg without changing attributes or its content
- Option value not getting updated until page refresh in WordPress
- Fatal error: Uncaught Error: Call to a member function fetch_array() on bool
- I want create woocommerec match products columns
- WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
- How to override plugin function in code snippets WordPress
- How to create a “Most Popular” & “Latest” TAB in WordPress
- Use inline callable for hooks and filters
- Error in using ‘admin_enqueue_scripts’ action through a class