This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SimplestWidget_Widget extends Strx_Widget { | |
function w_id(){ return 'simplest-widget'; } | |
function w_name(){ return 'My Simplest Widget'; } | |
/** Return the dashboard admin form */ | |
function w_form($instance){ | |
return '<p>'.$this->w_form_input($instance, 'title').'</p>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Initialize the Class and add the action | |
add_action('init', 'pTypesInit'); | |
function pTypesInit() { | |
global $sites; | |
$sites = new TypeSites(); | |
} | |
// Create a post type class for 'Site' posts | |
// To use as a bookmarking post type for sites you want to save/share. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// hook into wordpress search function | |
add_filter( 'the_search_query', 'aggregated_search' );// Define what post types to search | |
function aggregated_search( $query ) { | |
if( $query->is_search ) { | |
$query->set( 'post_type', array( 'post', 'page', 'feed', 'attachment', 'movies', 'quotes' ));//define search types | |
} | |
return $query; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Create a post type class for site posts | |
// To use as a bookmarking post type for sites you want to save/share. | |
class TypeSites { | |
public $meta_fields = array( 'title', 'description', 'siteurl', 'category', 'post_tags' ); | |
public function TypeSites() { | |
$siteArgs = array( | |
'labels' => array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$q = new WP_query(); | |
$q->query( 'post_type=site' ); | |
/* Begin the Loop */ | |
if ($q->have_posts()) : | |
while ($q->have_posts()) : $q->the_post(); | |
/** | |
* Now instantiate the Sites class we made in posttypes.php setting the $s variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* YouTube RSS */ | |
$query = 'select description from rss(5) where url="http://gdata.youtube.com/feeds/base/users/chrisheilmann/uploads?alt=rss&v=2&orderby=published&client=ytapi-youtube-profile";'; | |
/* Flickr search by user id */ | |
$query .= 'select farm,id,owner,secret,server,title from flickr.photos.search where user_id="11414938@N00";'; | |
/* Delicious RSS */ | |
$query .= 'select title,link from rss where url="http://feeds.delicious.com/v2/rss/codepo8?count=10";'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -x | |
# script by Stephanie Booth aka bunny http://stephanie-booth.com/ to install wordpress automatically (geeky, but useful for mass installs), with help from many people: drauh, io_error, zedrdave, roddie... and all those I've forgotten to mention. | |
# variables: $1 whatever, $2 wp_user, $3 wp_pass, $4 root password | |
# prerequisites: an existing mysql db, and a root password | |
# care! .htaccess is not generated, needs to be done manually, by clicking on "Update Permalinks" in Options once everything is installed | |
# todo: add themes, check plugin list, make wrapper script for multiple installs, prepare php patch template for options and common stuff, see if the script can edit the vhost conf files for mass installs, prepare alternate version for French, add bilingual plugin and maybe cache. Add an extra user to the WP install. Also an alternate version for upgrading the school blogs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Update a Selected Post | |
$title= "Updated Title"; // The Title of the Post | |
$bodycontent="Updated Blog Article Content"; // Article Content | |
$categoriesu= array('Category1', 'Category2'); // Pre Existing Categories - Updated | |
$tagsu="tag1, tag2, $tag3"; // Updated Tags | |
$content = array('title'=>$title, 'description'=>$bodycontent,'categories'=>$categoriesu,'mt_keywords'=>$tagsu); | |
$params = array(163,$username,$password,$content,1); // First Parameter is mandatory Post Id (get your post id via Recent Blogs entries) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once("IXR_Library.php.inc"); | |
$client->debug = true; //Set it to false in Production Environment | |
$title="Blog Title"; // $title variable will insert your blog title | |
$body="Blog Content"; // $body will insert your blog content (article content) | |
$category="category1, category2"; // Comma seperated pre existing categories. Ensure that these categories exists in your blog. | |
$keywords="keyword1, keyword2, keyword3"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wpPostXMLRPC($title,$body,$rpcurl,$username,$password,$categories=array(1)){ | |
$categories = implode(",", $categories); | |
$XML = "<title>$title</title>". | |
"<category>$categories</category>". | |
$body; | |
$params = array('','',$username,$password,$XML,1); | |
$request = xmlrpc_encode_request('blogger.newPost',$params); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $request); |
OlderNewer