I agreed with @PatJ — you should check if get_queried_object()
returns an object or not.
But you could simplify your code by simply using is_category()
and in_category()
which are conditional tags in WordPress:
if ( is_category( 3 ) || in_category( 'arta' ) ) {
wp_enqueue_style( 'twentytwenty-style-2', get_stylesheet_directory_uri() . '/style-arta.css', array(), $theme_version );
}
Related Posts:
- “wp_enqueue_style();” don’t load new edited style
- Understanding child theme functions.php
- wp_enqueue_style with style.php and WordPress functions
- Is it possible to use the featured image of a page as a css background without inlining?
- Plugin CSS not enqueing
- Parent theme CSS overriding child CSS rules
- Whats the proper way to use a php stylesheet in a wordpress theme? [duplicate]
- responsive.css in the WordPress should be prioritized
- Odd / Even posts add class minus first post
- Parse error: syntax error, unexpected ‘}’ [closed]
- Why would the child theme load in the Customize preview, but not on the site itself?
- Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?
- Site title not showing. Please help me
- Modify arguments for parent theme’s `wp_register_style` via child theme
- wp add inline style in loop
- How to NOT override inline css rules
- Query Concatenation
- WP_Query not returning results
- Styling best practices for single pages/templates
- Query multiple custom post types in single loop
- error_log() output for print_r() appearing on page
- Upgrading PHP version results in “Use of undefined constant WP_CONTENT_DIR” warning?
- Using WP_Query – how to display something IF there are no results
- How to target with css, admin elements according to user role level?
- Delete post revisions on post publish
- Best way of adding CSS which can be manipulated by the user via theme option panels?
- How to sort results from a custom database table
- WordPress Customizer not setting default value upon initial install?
- Fatal error: Call to undefined function wpsc_cart_item_count()
- Why when I instantiate wp_error in a validation method my user registration method stops working?
- Use two WP Query in template
- Does WordPress have a built in reference to the PHP version its running under? [closed]
- Different background-image by category
- Add a Different CSS Class Into The Body Tag of Different WP Pages
- WordPress – query 5 posts with a specific post in top
- Deregistering a script in WordPress seems impossible
- Show post in slider
- How can I hide Home in my menu in a specific page?
- How to get a list of all possible values of a specific user meta key?
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- Accessing the database from a plugin outside of action hooks
- how to remove metadata from the posts of my blog?
- Create WP_Query to search for posts by their categories or their parent/child categories
- get_term_link() returns correct – But illogical error-messages disturb
- I have a problem in the order of enqueues while enqueuing stylesheets and scripts for a specific page in my function.php
- WordPress default Search function inconsistent in WooCommerce Product Titles
- How to add condition in wordpress loop? [closed]
- Error: options page not found
- Need help enqueueing webfonts
- How to create table in wordpress without plugin? [closed]
- How to list commenters and days since last commented
- Can’t update multiple rows with $wpdb query
- get_template_directory adding FTP root folders in urls
- wordpress admin plugin menu custom css
- How to display SQL query that ran in WC_Order_Query?
- After adding my website to a new server, I keep getting a unexpected end of file error, but the file is identitcal to it’s original source
- Custom Post type slider with thumbnail navigation
- Where can I find the inline-css of my theme header?
- Website completely messes up when logging out
- How to make a cookie be on the whole site instead of being on a specific page/
- Limit tags shown in post
- Why my query does not run with prepare
- How to add new CSS file to new PHP file
- List of Events with Multiple Dates: Only NEXT Date
- How to find which .mo file is responsible for displaying a particular localized string?
- Illegal string offset in PHP function in via Theme Customizer
- Add other class content with reference class value
- I am having errors with checkout on wordpress
- Display articles with a different template in the home page | Solved |
- Category Page Displaying all Pages
- How do I integrate vanilla Javascript to a wordpress website?
- Call a single function on two different methods with hooks
- How to display post meta bellow every posts
- Add my footer menu to the header
- Make a full-width wordpress page
- Bring Font Awesome icons inside menu A tags
- Trying to add get_the_title hook to this line
- How to display post_content from database in different on template page?
- Displaying POST content with HTML tags and all
- remove blank space where sidebar was
- How to do a MySql query in WordPress?
- Display specific main Sub Nav on Woocommerce product pages
- Clone the “proceed to cart” button and place it above checkout on the cart page, but only appear display size is 320px
- WordPress 3.0 PHP Error – notice WordPress_product_Type was called incorrectly
- Highlight Single Page Ancestor
- Relative post date in recent posts list
- “Where… like” query not working as expected
- Why isn’t my link attribute getting my css?
- How to save the output of php variables used in inline css code to the main style.css?
- Problems With Query and/or Template Part and/or PHP
- Trying to customize wordpress drop down categories
- How to callback custom field text
- How do I use CSS or PHP to customize WordPress Form Manager Plugin Table?
- Load files content [closed]
- problem with php function error
- Integrating CSS Into a WP Function Call [closed]
- Predefine Magazine Style Layouts
- Getting invalid user ID error when creating a new user with wp_insert_user
- Error when loading Dashboard
- How to create different templates for woocommerce single-product.php?