318 reputation
28
bio website
location
age
visits member for 3 years, 3 months
seen Jul 1 at 22:09

Oct
18
comment What should I use instead of WP_CONTENT_DIR and WP_PLUGIN_DIR?
Many thanks – that gives me enough to work with!
Oct
16
comment What should I use instead of WP_CONTENT_DIR and WP_PLUGIN_DIR?
@CharlesClarkson I reference that page in the first sentence of my question. It says not to use the above constants, but doesn't suggest an alternative to things like WP_PLUGIN_DIR, hence my question here.
Oct
16
comment What should I use instead of WP_CONTENT_DIR and WP_PLUGIN_DIR?
(I'm specifically interested in finding the full path to installed plugins other than the plugin that contains my own code, in case that helps to explain.)
Oct
16
comment What should I use instead of WP_CONTENT_DIR and WP_PLUGIN_DIR?
Thanks for this, but your answer seems to deal with URLs rather than absolute server paths, which is what I was interested in. For example, plugins_url() returns the URL to the plugins folder, not the full path to the directory on the server. Are there similar functions for handling directories that I'm not aware of? Or is the advice not to use the WP_PLUGIN_DIR constant simply wrong?
Jun
7
comment Detecting a WordPress URL without doing a full HTTP GET?
@Rarst Yes - that's the caveat. It's possible for sites to spoof this, and there may be some that use the page_id variable already. Any sort of detection method using headers can probably be spoofed, so I don't think it's worth worrying too much about that. Which just leaves false positives for custom CMS. I couldn't think of a more WordPress-specific variable that would be less likely to be used elsewhere. Is there one?
Jan
31
comment check for shortcode in post/pages AND widgets AND template files
You're welcome. Worth noting that the original poster would need to call the hooks wp_print_styles or wp_enqueue_scripts from the plugin or shortcode function. It won't work if you use the functions wp_enqueue_style() or wp_enqueue_scripts() directly inside the plugin/hook -- those functions have to be inside whichever function the wp_print_styles and wp_enqueue_scripts hooks call.
Jan
31
comment check for shortcode in post/pages AND widgets AND template files
+1 From the developer notes for v3.3: "WordPress 3.3 allows wp_enqueue_script() to work mid-page, which means most of that Jedi logic is no longer needed."
Jan
26
comment Creating a table from shortcode avoiding wpautop for each row
Thank you for this! For others, the relevant line to strip <br/> tags from shortcodes is simply $content = str_replace('<br />', '', $content);