Tagged: add-ons, stylesheet
- This topic has 1 reply, 2 voices, and was last updated 6 years, 3 months ago by
Steve.
-
AuthorPosts
-
-
October 21, 2015 at 6:31 pm #4663
mcmasterMemberI was trying to activate the custom stylesheet I defined for one of my Piklist add-ons. My plugin is in
plugins/mcw-piklist-custom. Under that I have anadd-onsdirectory. The only activated add-on ismcw-post-custom.I looked at the way Piklist Demos does it and found the following function:
add_filter('piklist_assets', 'piklist_demo_assets'); function piklist_demo_assets($assets) { array_push($assets['styles'], array( 'handle' => 'piklist-demos' ,'src' => piklist::$addons['piklist']['url'] . '/add-ons/piklist-demos/parts/css/piklist-demo.css' ,'media' => 'screen, projection' ,'enqueue' => true ,'admin' => true )); return $assets; }I found it curious the way it’s using the piklist::$addons array to pick up the URL. Looked at that array, and here’s what I saw:
Array ( [piklist] => Array ( [path] => /Users/donna/Sites/marys/wp-content/plugins/piklist [url] => http://marys.dev/wp-content/plugins/piklist ) [theme] => Array ( [path] => /Users/donna/Sites/marys/wp-content/themes/marysriver/piklist [url] => http://marys.dev/wp-content/themes/marysriver/piklist ) [mcw-piklist-custom] => Array ( [path] => /Users/donna/Sites/marys/wp-content/plugins/mcw-piklist-custom [url] => http://marys.dev/wp-content/plugins/mcw-piklist-custom ) [wp-helpers] => Array ( [path] => /Users/donna/Sites/marys/wp-content/plugins/wp-helpers [url] => http://marys.dev/wp-content/plugins/wp-helpers ) [piklist-demos] => Array ( [path] => /Users/donna/Sites/marys/wp-content/plugins/piklist/add-ons/piklist-demos [url] => http://marys.dev/wp-content/plugins/add-ons ) [mcw-post-custom] => Array ( [path] => /Users/donna/Sites/marys/wp-content/plugins/mcw-piklist-custom/add-ons/mcw-post-custom [url] => http://marys.dev/wp-content/plugins/add-ons ) )I have two thoughts:
1. I am uncomfortable accessing a class variable like this; would rather call a function to return a value. (data hiding) E.g.,
piklist::add_on_data( 'mcw-post-custom', 'url' )2. I’m curious as to why the add-on URLs do not have the correct path. E.g., for
piklist-demosit should behttp://marys.dev/wp-content/plugins/piklist/add-ons/piklist-demos.Thanks,
Donna -
October 21, 2015 at 9:04 pm #4667
SteveKeymasterThe URL for add-ons will be fixed in v0.9.9.5.
-
-
AuthorPosts
- You must be logged in to reply to this topic.