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
- PHP unit testing WordPress?
- List of all theme customizer control types?
- How to remove hardcoded characters from playlists?
- The difference between calling wp_enqueue_scripts to load scripts and styles in custom theme
- function_exists call in function.php
- Debugging an error: wp_enqueue_style was called incorrectly
- Hide a menu-item and its submenus and display a ‘Log in’ link if the user is logged out
- The best way to customize “nav-menu-template.php” to add if the ‘link_before’ is “checkbox”
- “wp_enqueue_style();” don’t load new edited style
- Multiple do_shortcode($content) within one shortcode
- Remove css styles from specific page
- Is it recommended to pass some data to scripts in `wp_enqueue_scripts`?
- PHP Customization: Taxonomies and Queries, why? [closed]
- Widgets not showing in my custom theme
- if file_exists not working with wp_enqueue_style
- What is the fastest way to load PHP functions that are only used in one theme template?
- My Own layout in WooCommerce pages [closed]
- How do I access the media settings
- Adding tawk.to code just before body tag on functions.php file
- Can’t load WP function into external function
- Implement toggle switch for theme options in settings API
- How can i upload images in an admin page?
- Parent theme CSS overriding child CSS rules
- Wp-login appears White Screen, Error: Cannot modify header information
- Need Help Fixing My Iframes [closed]
- 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
- How do I link a button I created in theme customizer to a function?
- can i fetch a custom metabox data in another page or post type?
- 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?
- jQuery code not working when included in functions.php
- ‘Post-thumbnails’ feature does not seem to register
- 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?
- Admin ToolBar not being displayed at top of site
- Royalty-Free Sliders used in theme development
- Reason to add a name of the theme like (‘menu-1’ => __( ‘Primary’, ‘twentynineteen’ ),) in PHP?
- Separation of presentation and code – WordPress
- Search form does not work in my website
- zip unzip attachments in wordpress
- Live to Local on MAMP, not working, outputting functions.php code
- How to Update an old theme for the latest wordpress version
- Adding Updated Post Date PHP Custom Theme
- get_comments_number() returns 0
- How to make a cookie be on the whole site instead of being on a specific page/
- Search only working on front page (index) , not working on other pages
- Why the dynamic_sidebar() call is putted into an ul tag?
- ‘Bones’ theme: Load stock scripts in footer instead of header?
- Uncaught TypeError: extract(): Argument #1 ($array) must be of type array, null given
- How do I edit the terms output args or array data?
- Header is not displaying on certain pages of wordpress theme [closed]
- When I click for the redirect link it is showing the content of index.php instead of single_assignment_page.php
- How can I prevent a shortcode div from extending beyond its boundaries?
- Find out the reason that the Styles and scripts in the theme are loading properly in localhost but Not in server after deploying
- Should I set a page as “No-index” if I include it’s content within the front-Page.php via this method?
- Importing the style and scripts in the plugin doesn’t work as well as in the theme
- WordPress child theme, creating a custom php template page
- Menu to the right of screen on desktop using Bootstrap 4
- Custom theme admin-ajax.php 400 (Bad Request)
- Customizer: How to Sanitize a Decimal Number Range
- PHP code printed into CSS classes
- How to send Ajax Call from frontend without using wp_localize_script in Theme
- Get the image title and alt from custom query
- Add Text Area To Child Theme’s Home Page
- What syntax is this? “{{post.price}}”
- How to add thumbnails from recent posts to owl-carousel in wordpress automatically?
- Custom theme: adding unwanted tags in the content
- Relative post date in recent posts list
- WordPress get_post_meta issue
- append links with unique number string
- How to add button to top of theme customizer?
- Adding Media button to only pages
- Sidebar doesnt get updated?
- How to implement conditional PHP in Footer
- Adding php within a return statement [closed]
- Predefine Magazine Style Layouts
- Pagination not working properly
- How can I fix my pagination?
- Woocommerce Convert existing order to the cart
- WordPress PHP8 Critical Error in class-wp-widget.php