1 – it’s up to you and subject to opinion, so not best suited to WPSE.
2 – Never hardcode paths. WP has whole range of functions for finding file paths and URLS. plugins_url()
will get you the full URL to the plugins directory, handling whether you are using http or https and canonicalising the domain name for you. It will take parameters for a file relative to your plugin’s directory by using PHP’s magic __FILE__
constant too: plugins_url( 'images/plugin_icon.png', __FILE__ )
for example.
Similarly, plugin_dir_path( __FILE__ )
within a plugin file will get the full system file path to the file.
Related Posts:
- What is better way to use Bootstrap inside admin panel?
- Twenty-seventy theme remove additional CSS from head
- How do I add CSS options to my plugin without using inline styles?
- Is it ever okay to include inline CSS in plugins?
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- How to prevent loading of all plugin’s resources?
- What is the best way to provide plugin users with a way to customized the styles
- wp_enqueue_style built in styles
- Backslashes being stripped from CSS
- Dequeue theme stylesheets but keep widget styling on custom page template
- How to check if a stylesheet is already loaded?
- how to include javascript file and css file in wordpress
- How can I add a CSS rule to edit.php?
- Remove Internal Style Sheet if no Value Provided?
- How do I include background images in my stylesheets in a plugin?
- What parameter should I pass to wp_enqueue_style to depend on the themes stylesheet?
- Is there no admin ui guide for 4.x?
- Correct check for any admin page with editor
- how to add stylesheet to particular plugin only?
- How to remove default style of header in wordpress metabox
- CSS not affecting widget output
- How can I avoid conflicts between plugin and theme?
- Plugin Development/ Stop CSS clashes.
- Can’t change the style of a submit input type? [closed]
- Make a plugin page out of influence of the theme’s style
- My stylesheets are not enqueuing
- Custom Plugin – CSS works, JS doesn’t
- Are there any official or unofficial guidelines for the styling of a widget?
- Proper way to include stylesheet for panels
- Apply styles to blockquote element with the WYSIWYG editor
- Styles don’t load correctly. Insecure content
- Completely isolate a plugin view so it doesn’t load the theme
- Is it possible to load the css just on my plugin admin page?
- Enqueue a file that’s not js or css
- Does WordPress default CSS have Grids?
- How to insert HTML/CSS/JS into my iframe plugin?
- How To Protect Plugin Display From Being Affected By Theme’s CSS
- Load stylesheet in edit category page?
- CSS not being applied using wp_enqueue_style
- WordPress Plugin Authoring question about jquery and css
- How to add some basic inline CSS using existing plugin or theme?
- Why my theme’s css not working on another site
- WordPress plugin development theme issue
- Why does theme’s reset CSS have higher precedence of plugin’s CSS?
- How to customize the size of Featured Images or Post Thumbnails in WordPress?
- Publish, Save Draft and Preview buttons do not work after being moved with jQuery
- Unable to link CSS file
- How can I add the Post ID to Class Name in Jquery?
- Let user override plugin CSS
- Best practice to include custom user styles in widgets
- How to create A – Z List with pictures?
- how to add contact form 7 shortcode in javascript variable
- Add custom CSS for plugin admin Page
- Problem with inline style CSS properties issue on DIV
- Load specific CSS file
- Select a Text for CSS
- How to give a NavWalker its own stylesheet?
- Settings API: Setting default option via ‘get_option’ fails
- Show content without a post
- Setting a JSON web token from a secondary api as a secure cookie on WordPress
- How to create a digital product download link that can’t be used twice?
- WP ajax requests not stacking?
- How to save post meta as an array in Gutenberg?
- How to redirect to login page when user not loggedin on a particular page
- Do I need to create an endpoint?
- How to display the categories on page using shortcode?
- In wordpress plugin wp_signon shows error
- How to find where an object first instantiatiation
- WordPress Rest API with rest_do_request, possible race condition?
- Need help about understand api, wp, $ syntax in WordPress plugin script
- How to get the url of logo image?
- Plugin path comes wrongly
- How to use apiFetch to get author information in Gutenberg properly?
- Gutenberg blocks error: Each child in a list should have a unique “key” prop
- How to access all array values from do_action_ref_array()?
- I have this error notice ‘wp_enqueue_script was called incorrectly’ in my plugin
- Catching Form Submission in WordPress Admin Panel
- Redirect in WordPress plugin
- Can we use a library under MIT license in a WooCommerce plugin?
- Converting data-name editor plugin to Gutenberg plugin
- Add a check box in Menu Settings
- Filter posts in pre_get_posts order by meta value date (desc or asc)
- Logout after clicking URL link results in “headers already sent” error
- How to display the category id along with category name on categories list?
- How do I find the page/url where a search came from when using pre_get_posts filter?
- My WordPress Plugin code breaks customize.php viewpoint
- Updating transient value frequently
- Set _regular_price 0 if empty in woocommerce product
- how to load the comment template from a plugin
- Custom filter not working
- Shortcode conflicts
- How do I get rid of my inclusion race-condition on wp_enqueue_script
- Why aren’t some plugin styles loading when I load a template?
- Change/Set Page Title and Meta Tags from Page Called within a Plugin
- How can I add rewrite rules to a class-based plugin?
- hook update_option/updated_option empty $old_value and $value
- Issues Updating Post Meta with AJAX (Seems simple but cannot figure it out)
- WooCommerce Endpoints content
- How to get post image root URL?
- Access to apache logs from plugin