[wp-hackers] map file path to url in PHP/WordPress
xiaohan2012 at gmail.com
Sat Oct 22 02:17:53 UTC 2011
Thanks very much, Dion. This is what I want.
But now I have problem with registering the style sheet.
I did as the Wordpress function references suggest.
$screen_filepath = WP_PLUGIN_DIR.'/'.'css/screen.css';
The *add_pll_style_sheet*() won't execute at all! (I tested it adding a *
die*() in the front, but nothing happens)
And I don't think the action *wp_print_styles *is wrong, because I did as
the wordpress reference suggests.
And the context is correct, I think.Because other functions(hooks) are
executed smoothly, except this one.
2011/10/22 Dion Hulse (dd32) <wordpress at dd32.id.au>
> If you're referring to the file from within a plugin, you'd use something
> such as:
> echo plugins_url('mystyle.css', __FILE__); (The __FILE__ part makes it
> to mystyle.css relative to the current file)
> If you were refering to a themes file, you'd use something such as:
> echo get_template_directory_uri() . '/some-style-file.css';
> On 22 October 2011 12:31, 肖晗 <xiaohan2012 at gmail.com> wrote:
> > Hi guys,
> > I do not know how to map file path to url in PHP/WordPress.
> > Suppose my css sheet is in path
> > /var/www/wordpress/wp-content/plugins/my-plugin/mystyle.css.
> > And suppose my domain is domain.com.
> > How can I map the path
> > /var/www/wordpress/wp-content/plugins/my-plugin/mystyle.css
> > to
> > http://domain.com/wordpress/wp-content/plugins/my-plugin/mystyle.css
> > Any useful functions and Wordpress API will be appreciated
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers