get_template_directory_uri()
just returns the directory of the current theme, not the link to the actual stylesheet.
In functions.php
try:
function register_directories_style() {
wp_register_style('style', get_template_directory_uri().'/style.css', [], 1);
wp_enqueue_style('style');
}
add_action( 'wp_enqueue_scripts', 'register_directories_style');
if you wanted to select a different stylesheet, you just updated the $src arguement. e.g.
function register_directories_style() {
wp_register_style('directory_style', get_template_directory_uri().'/css/directories.css', [], 1);
wp_enqueue_style('directory_style');
}
add_action( 'wp_enqueue_scripts', 'register_directories_style');
Related Posts:
- Why I can’t add a CSS style in this WordPress theme?
- What can I hook into after_setup_theme?
- Advantages of using instead of wp_enqueue_style()?
- How to add dynamic inline style?
- Dequeue a style file which is making website load slow!
- How can I let templates choose which stylesheets are enqueued?
- Theme Loading Into Dashboard
- Font Awesome 5 Free – far working but fas is not? [closed]
- Having issue with WordPress wp_enqueue_style
- theme style is applied on the dhasboard rather than the website
- How to add CSS class to custom logo?
- theme path in javascript file
- The proper way to include/require PHP files in WordPress
- How to insert a logo in the header?
- Why doesn’t default WordPress page view use force_balance_tags?
- Theme Customizer : how to create multiple-level panel
- Automatic Updates For Private And Commercial Themes?
- Grab the first paragraph of each post
- add_image_size is scaling, even though crop is set to true
- Adding inline styles from a widget
- “Cheatin’ uh?” error message on multple theme directories
- Adding WordPress colorpicker in widget settings
- How to use bloginfo( ‘template_directory’ ) in array
- Should I update my _s theme?
- “Display Site Title and Tagline” checkbox not working?
- Setting a Default ‘Theme Location’ When Creating a Menu
- How to set page template on front using starter content?
- Different Admin Theme – Based on Role?
- Finding Page Template and Displaying Content
- Override Constants in Child theme
- How to correctly add JQuery in a WP theme?
- how to change a theme slug
- Same theme name issue with wordpress repository theme
- Removing feeds from header using a function?
- I want to get the home root path
- How to add code in the content area in a WordPress theme?
- How to add theme support?
- Developing WordPress Theme using CSS framework like Bootstrap
- WP_Customize_Color_Control omitting # symbol
- Theme translation not applying
- How to add filter the post thumbnail before save in database?
- Storefront child theme not applying parent theme [closed]
- Prefix best practice, should we use framework name or theme name?
- Theme Javascript.php Overwritten Nightly [closed]
- Theme Inspector “X-Ray”
- Acivate all themes multisite wide automatically
- How to place HTML tags in content from the_content()?
- WordPress Theme Creation [closed]
- What is the meaning of WordPress’s recommended css classes and where are they applied?
- Integrate WooCommerce theme with a WordPress theme [closed]
- Automated Footer information
- How do you use WordPress for a website that’s not in a blog format?
- Managing WordPress Theme
- get_template_directory adding FTP root folders in urls
- Are there any caveats to compiling all of my theme’s SCSS into the style.css file in the theme root?
- Alignment Problem [closed]
- How to track a users last visited page?
- In a Gallery with limited image posts, how do I not limit images on single post?
- LESS not working in WordPress [closed]
- Unwanted empty line at the beginning of document
- How to add custom page elements to the WYSIWYG editor?
- Why is my container argument not working for wp_nav_menu() [closed]
- Why I obtain different visualization when I run the website on my local machine and on remote server?
- How to use the _S framework
- Open portfolio image in light box
- Let visitors show/hide a type of content
- Best practice for implementing a blog page / section in wp_menu_nav()
- how to add a badge on product based on filter?
- How to update mark-up of a gallery block in a custom theme?
- how to create/register menu items that can be added to menus later
- My wordpress theme name isn’t updating straight away
- Why nav_menu_css_class doesn’t work with apply_filters?
- WordPress and Semantic UI
- Displaying front side empty with one file attached problem
- Find out the reason that the Styles and scripts in the theme are loading properly in localhost but Not in server after deploying
- Theme does not allow shortcodes
- Text widget is placing everything side by side. I want to post it above
- What is an alternative to not using child theme to customize a WordPress theme?
- Adding a second logo next to the main one in header
- Menu names not getting translated
- How to generate a rtl.css file for themes?
- Get property of non-object on theme activation
- change wordpress website logo url [duplicate]
- wp_editor some functionality not working on custom theme
- Update modified Shopify third-party theme [closed]
- hide/show a div in wordpress
- Providing updates to your WordPress theme
- One-Page WordPress Template
- How one category can have different fields?
- How do child themes work?
- Fail to install theme on development copy of WordPress on Webmatrix
- How to prevent XSS attack in wordpress theme?
- Featured Image Module Randomly Disappears
- WordPress two sidebar layout or theme
- adding navigation to genesis themes
- Standard Way To Do Custom Work Within A Page?
- Show post thumbnail only if it exists using timthumb
- Getting all months in one year WordPress Archive
- My wordpress site memory exhausted more than 1GB trying to debug with default
- How to automatically set a Template Page Name next to a page in menu screen such as WooCommerce pages, front page, or posts page in wordpress?