gortsleigh
Forum Replies Created
-
Forum: Plugins
In reply to: dbx_page_sidebar successor in 2.6?Hi, Steph.
Any chance you’re looking for
edit_page_advanced
action hook?It lets you put HTML in after the post editor.
Forum: Plugins
In reply to: Elementary PHP problemHi, Ian — I thought I’d post the results of my efforts in hope it might help someone.
I have found two ways to accomplish what you’re doing.
Method 1: You can simply place the CSS via a hook. The only real downside is that the theme user would have to edit functions.php instead of style.css.
That solution looks like this:
function mytheme_custom_css() { print "<style type=\"text/css\">#wrapper { background: url($customurl) !important; }</script>\n"; } add_action('wp_header', 'mytheme_custom_css');
Method 2: Have your theme create a cookie-based session. Then you can still do everything in style.php! We can use the $_SESSION “superglobal” to get the value.
That solution is here:
--- functions.php (revision 645) +++ functions.php (working copy) @@ -36,9 +36,17 @@ } +function mytheme_start_session() { + session_name("wp_mytheme"); + session_start(); + session_register('customurl'); +} +add_action('init', 'mytheme_start_session'); +
Then in style.php:
body { background: url({$_SESSION['customurl']}) !important;}
Cheers,
-Gregory GrubbsForum: Everything else WordPress
In reply to: Different User Levels on RegistrationThank you, Eric! I had the exact same need, you have saved me two days’ effort!
Forum: Plugins
In reply to: Aaaarrrgh… wp-style-switcher pluginI was having problems with the style switcher and did some debugging. My symptoms: the default style I had selected — either in wp-style-switcher.php or in the wp_stylesheet() call in index.php — would always be displayed, no matter which style I selected on the page.
The problem is that my browser cookie was not getting set at all. I had the user and password cookie values, but the ‘wpstyle’ cookie value was never getting set, therefore the wp_stylesheet function would revert to the default setting.
The solution: I used a fully-qualified name for my webserver in the browser (i.e.: ‘poobah.hoochiepep.home’ instead of just ‘poobah’) . Many people who are testing on an Apache server using ‘localhost’ as the server name will have the same problem. This is some weird bug with cookies not getting set when there is not at least one ‘.’ in the hostname! I experienced this problem on Linux/Apache 2, by the way – so it’s not just a Windows problem!
I have done a lot of PHP programming myself, and long ago gave up on setting cookies directly. I’ve had much better luck using the PHP session functions (session_name, session_register, etc.). I’ve had no problems like the above using those functions.
Hope this helps someone!
-Greg