You are using a child theme here, it means that you should use get_stylesheet_directory_uri()
to get the child theme’s directory.
So, in your case, get_stylesheet_directory_uri()
will return:
localhost:8888/wp-content/themes/x-child/
and get_template_directory_uri()
will return:
localhost:8888/wp-content/themes/x/
Use this to build your paths. Also, pay attention that you need to include a forward slash before your style/script’s name, since these functions do not provide a trailing slash:
wp_enqueue_style( 'main', get_template_directory_uri() . '/main.css' );
Which will return:
localhost:8888/wp-content/themes/x/main.css
Related Posts:
- Enqueue styles properly in a child theme and stylesheets location
- Is my child theme working properly
- How to override JavaScript files in child theme?
- How do I dequeue a parent theme’s CSS file?
- Issues enqueueing parent & child theme stylesheets with revised Codex method
- Why is the Child Theme Stylesheet Not Loading?
- Give priority to child theme stylesheet
- Get parent theme version
- How to use parent theme’s enqueue methods
- How to maintain wp_enqueue_style dependencies set in parent theme style enqueuing
- How to dequeue / deregister parent theme style
- Style.css in child theme is loaded before Bootstrap
- How are updates to the style.css file in child theme recognized?
- How do I set up a child-theme without using @import
- Find a Parent Theme’s stylesheet $handle when it registers a stylesheet
- Dequeue only stylesheets but not inline style added using wp_add_inline_style
- Enqueue stylesheets if parent theme has more than one .css file
- ERROR MESSAGE: Missing index.php—Child Theme
- Priority loading file css in child theme
- WP .js script file not loading
- Child theme style repeated
- wp_add_inline_script not adding when script_loader_tag filtered
- How to NOT call Font Awesome or font icons in WordPress
- @font-face broken in child theme
- Prevent a base themes css file from loading
- How to enqueue scripts in order of Head section
- Cannot dequeue script in child theme
- WordPress Child theme’s css not loading
- Confused about how to use wp_enqueue_style
- Child theme stylesheet not always overriding “index”
- Child style loads before all parent styles
- Enqueue custom css file on specific page
- javascript not being enqueued correctly
- How can I get this child theme stylesheet to properly load? Or if it is correct, why doesn’t my child theme appearance match the parent?
- How to make child theme in wordpress with wp_enqueue_style ? Using Enough Theme
- wp_enqueue wont work on some files?
- Can only override parent theme styling with ‘!important’ in child style.css
- Can’t seem to get javascript code working from child theme
- Why does using wp_register_style without wp_enqueue load and print CSS tags in the front-end?
- Add custom css file after plugin css with WordPress Child Theme functions.php
- Child theme is not rendering parent and own javascripts (but css loaded properly, js not)
- Remove Stylesheet by URL that has not been enqueued
- How to enqueue multiple style sheets into my child theme in wordpress (oceanwp)
- Enqueuing multiple stylesheets with a child theme
- using a child theme, after enqueing my js file it is loading before jquery
- Why won’t my Custom CSS Load
- custom template – override plugin template in child theme – issue with scripts
- WordPress | enqueue_scripts in a child’s theme returns error
- How to create my own style.css file in an wordpress child-theme
- Get list of scripts / styles and show file which enqueued them
- Why I can’t add a CSS style in this WordPress theme?
- Get the list of enqueued/registered scripts for a specific post?
- Do I need to update the child theme too after updating the parent?
- Get info (url) from already enqueued styles
- Child Theme – what is the scope of overwriting files?
- Add last modified time as version to css and js
- Loading scripts & styles from a meta box callback function
- Overiding functions.php with child-theme
- Custom Plugin Development: What priority should wp_enqueue_scripts have?
- Register script/style: Is it possible to customize the version query string via plugin?
- Child theme implementation issues
- Optimizing WordPress’s styles and scripts
- How to enqueue a style using wp_enqueue_scripts()?
- enqueue admin styling and scripts only on plugin page
- How to use custom stylesheet only for a template in child theme
- Creating a child theme from Twenty Seventeen
- Child theme .css files are not overriding their parent .css files
- How can I make this Advanced Custom Field Save & Store local json work?
- why this media query is not working / not loading when I put it in child theme?
- How to add anchor tag at the top of posts, past the header and nav bar?
- changing parent theme into child theme
- filemtime(): stat failed warning within a child theme
- How to override parent theme template files?
- Using filter to override “get_parent_theme_file_path” in child-theme
- Link featured image to post
- What are the best practices for maintaining and deploying several parent themes?
- How to make my shortcode load scripts and styles, from within the plugin?
- Why is WordPress enqueuing admin relevant scripts (e.g., React, ReactDOM, Redux, hooks, TinyMCE etc) when not logged in?
- Load custom CSS before admin CSS
- is it possible to add new template in theme twenty seventeen?
- Two stylesheets acting on one element
- Is the front-page.php template reserved in wordpress twenty twelve theme?
- Referencing parent theme image from child theme
- How to load Javascript code or functions.php later in a child theme?
- Can I place “parent theme” inside a child theme folder?
- Change templates in a child theme
- Enqueued script fails
- wp enqueue style on about us page
- How do I dequeue js/css at the last possible moment?
- How does a Genesis child theme understand that the Genesis theme is the parent theme?
- Loading my main.js file from my child theme
- Calling Category name without the link
- When I change some content in function of template-tags file in inc folder then its not working and show same as loke before
- Child Theme Issue – activated but does not show in preview
- How to configure folders with ‘Child Theme’?
- PHP Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered
- How to handle a large child theme
- Scripts don’t enqueue after removing plugin
- Child theme customizer preview doesn’t work/load
- theme.json should be in the child theme folder when using xxxx.json style located in the styles folder?