I believe your mistake is using main
as handle keyword for both script and style, handle must be unique.
You don’t have to use wp_register_script
(and style) enqueue function does this automatically. You typically use wp_register_script
(style) only if you are not sure if script/style will be needed later, if it is enqueued conditionally, but you want to avoid having several versions of the same script/style loaded. You should check browsers console, you might as well specified incorrect path to those scripts. You can also use newer get_theme_file_uri()
function to find path for scripts/styles which has some advantages (see manual).
Related Posts:
- Enqueue less file not working in child theme?
- Is it possible to use the featured image of a page as a css background without inlining?
- How to enqueue CSS and JS only on specific template?
- Deregistering a script in WordPress seems impossible
- I have a problem in the order of enqueues while enqueuing stylesheets and scripts for a specific page in my function.php
- Is the wp_enqueue method efficient?
- linking stylesheets and scripts with functions.php
- get_template_directory adding FTP root folders in urls
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- Enqueueing a code block from an options framework
- Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?
- Enqueue assets from multiple directories using add_action/do_action
- Call a single function on two different methods with hooks
- Load script and styles using an array of resources
- Chosen Select jquery Not Working in Plugin
- How can I print out a single stylesheet or javascript link?
- wp_enqueue_style conflict when using in different action hooks
- Hide categories that are not used in the post type
- How do I add custom bulk actions to multiple custom post types?
- Add_action not working in required file of functions.php
- How to set up VS Code for WP plugin/theme development in 2021? [closed]
- How to inject variables into public-facing JS using wp_enqueue_script
- adding custom user input fields in WordPress admin dashboard gives error The link you followed has expired. Please try again
- what is the best practice to add new field to an api route
- Grab posts by multiple categories
- Can’t access variable outside for loop
- add custom link to wordpress media gallery modal
- How to only enqueue script if it’s a post
- Need Help Fixing My Iframes [closed]
- Avoid parallax images hardcoding
- Improve page speed loading using CDN and async or defer attribute
- populate form fields in a loop with ajax
- Error in custom php function doesn’t exist
- Customizer: active_callback and sanitize_callback incompatibility?
- post created but no permalink
- Populate editor with some content of a page with a page template
- Two queries for a WP_User_Query search work perfectly apart, but not together
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- enqueue styles for only mobile wp
- Catchable fatal error: Object of class stdClass could not be converted to string after WP 4.7
- Menu jumping when calling it via PHP
- Displaying recent posts on static page with template-part via shortcode
- How to edit widget code to add unique class name to each div?
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- Skt full width basic slideshow problem
- WordPress Scripts Being Loaded in Footer
- How to disable controls in theme customizer?
- How do I link a button I created in theme customizer to a function?
- Trying to retrieve post meta
- Need help enqueueing webfonts
- Whats the proper way to use a php stylesheet in a wordpress theme? [duplicate]
- can i fetch a custom metabox data in another page or post type?
- Font Awesome changing default WordPress Font
- Jquery function working in Dev Console but not otherwise [duplicate]
- responsive.css in the WordPress should be prioritized
- Is there a way to conditionally check whether a WordPress post title is empty?
- How to change menu labels
- Is the “_s” on this `sprintf(__(‘Page %s’, ‘_s’), max($paged, $page))` just refer to a text domain?
- Which is the correct way to conditionally enqueue a CSS file?
- get_template_part for specific page
- How do I create my own .php file with a code part and echo it on different pages?
- jQuery code not working when included in functions.php
- How to remove woocommerce_breadcrumb() from do_action( ‘woocommerce_before_main_content’ ); [closed]
- ‘Post-thumbnails’ feature does not seem to register
- if statement with is_active_sidebar()
- WordPress admin-ajax.php
- Use .php file as page instead of wordpress page & template file?
- Use WordPress function in php file
- What does this mean in wordpress? Easy question
- How to obtain the current website URL in my theme?
- Syntax error when I try to insert my loop into an unordered list? [closed]
- What exactly do this function declared into functions.php file of a WP theme?
- Conditional Javascript based on WP Version
- Admin ToolBar not being displayed at top of site
- Royalty-Free Sliders used in theme development
- Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
- Correct way to enqueue page specific CSS file
- How to set up a If is_singular statement?
- Reason to add a name of the theme like (‘menu-1’ => __( ‘Primary’, ‘twentynineteen’ ),) in PHP?
- Underscore – Self hosted fonts
- Separation of presentation and code – WordPress
- Search form does not work in my website
- Show About and Contact Us page when they’re clicked in the top menu.
- Is There A Way To Make Theme Files Accept Shortcodes?
- get_template_part() not firing within a switch statement when template has new WP_Query
- WordPress Customizer Default Image
- How to call multiple functions from multiple files into a WordPress page template [closed]
- Theme’s Options Page included with require_once *.php in functions.php not visible anymore
- Double jQuery loaded
- zip unzip attachments in wordpress
- Get title attribute from galleries
- How to show an entire post content and not also the excerpt?
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- WordPress import media error
- Why in my theme I can’t see all the statics content under the posts?
- Why is an array created in a function hooked to customize register populated when customizer is loaded but not when the front-end is loaded?
- Theme not calling Jquery properly
- How can I use a sliced image As banner? [closed]
- WordPress get_media_embedded
- Hide Heading if ACF Field is empty