WordPress and Custom PHP single SignOn

You can integrate the wordpress authentication with the apache webserver and then configure which additional resources need a login on your webserver. This works with PHP as well with HTML and images. For more information, please see mod_auth_mysql and phpass.

How to create Sub Sub domain Multi User blogs?

While this question is several months old and you’ve probably figured something out already, I figured it was worth answering anyway. This is possible to do using the WP Multi Network Plugin. WordPress has the underlying structure to accomplish this, but no accompanying UI — this plugin merely offers that interface. Some things are not … Read more

WordPress 2.8.5 & ‘Responsive Twenty Ten’ – error

home_url() function is implemented in WordPress since version 3.0.0, and you are using version 2.8.5. To fix this error edit wp-content/themes/twentyten 3/header.php file – replace: home_url(); with: ‘http://’.$_SERVER[“SERVER_NAME”] This is hotfix, and i’m afraid you will receive more errors like this. “Responsive Twenty Ten’ are compatible with 2.8+” – as you see it’s not true … Read more

Passing POST data from one WP post to another

You need to register the query var so it doesn’t get stripped by WP. Add this to your functions.php file. function foo_add_query_var($vars) { $vars[] = ‘discount’; return $vars; } add_filter(‘query_vars’, ‘foo_add_query_var’); To call this in your template, simply use the following: $discount = get_query_var(‘discount’);

Output data like WP’s plugin installer/updater

Yes, WordPress uses output buffering for displaying these messages. There’s a nifty function you can use within your loop called show_message() which utilizes wp_ob_end_flush_all(); function show_message($message) { if ( is_wp_error($message) ){ if ( $message->get_error_data() ) $message = $message->get_error_message() . ‘: ‘ . $message->get_error_data(); else $message = $message->get_error_message(); } echo “<p>$message</p>\n”; wp_ob_end_flush_all(); flush(); } You might … Read more

How do I list the_tags() into HTML data-attribute

Use json_encode(): <li class=”griditemleft” data-tags=”<?php $posttags = get_the_tags(); $data = array(); foreach($posttags as $tag) { $data[] = $tag->name; } echo json_encode( $data ); Later, in your JavaScript, iterate over the li items and for each item use: // get an array of tag names with jQuery’s parseJSON() var itemtags = $.parseJSON( item.data(‘tags’) ); See jQuery … Read more

Using wp_get_image_editor in a standalone script

Turns out I’m just silly. WP_Error was the undefined method, not resize. I was sending a bad image location through the resize function. How silly of me! It was working all along. I’ve included this on top $parse_uri = explode( ‘wp-content’, $_SERVER[‘SCRIPT_FILENAME’] ); require_once( $parse_uri[0] . ‘wp-load.php’ ); and this is my image resize function … Read more