Skip to content

Instantly share code, notes, and snippets.

@jhaus
jhaus / class.View_All_Posts.php
Created December 30, 2010 06:31 — forked from thefuxia/class.View_All_Posts.php
Adds a view all posts page to any archive
<?php
/**
* Adds a view all posts page to any archive.
*
* @author Thomas Scholz http://toscho.de
* @version 1.1
* @license: GPL2
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@jhaus
jhaus / class.TTT_Contactfields.php
Created December 30, 2010 06:18 — forked from anonymous/class.TTT_Contactfields.php
Manage WordPress contact fields
<?php
/**
* Manage WordPress contact fields.
* Usage:
require './class.TTT_Contactfields.php';
$TTT_Contactfields = new TTT_Contactfields(
array (
'Twitter'
, 'Facebook'
@jhaus
jhaus / wp-front-end-post-submit.php
Created December 29, 2010 08:51
basic wordpress template for front end posting via wordpress.stackexchange.com
<?php
$postTitle = $_POST['post_title'];
$post = $_POST['post'];
$submit = $_POST['submit'];
if(isset($submit)){
global $user_ID;
$new_post = array(
Using Wordpress XMLRPC services Jul 5th, 2009 | By admin | Category: Featured, PHP, Tutorials
(1 votes, average: 4.00 out of 5)
Wordpress is a great blogging platform. With tons of plugins available, Wordpress is quickly become a good choice not only for personal blogging purpose but also for making content oriented sites. There are also many sites want to add ‘blog’ feature into it and WP one more time is the chosen one. Although WP’s plugin architecture is really not good, the WP’s team have added in a really interesting tool that help integration between WP blog and hosting site easier. It’s XMLRPC services.
Here are some scenarios if you has a WP blog and you want to integrate it with another site, you will found XMLRPC helpful:
Showing latest posts/comments on the site homepage
Provide links to categories in your blog
Turning your WP blog into a collaborative environment for your site’s authors
@jhaus
jhaus / wp-settings-api.php
Created December 21, 2010 06:35
Wordpress Settings API Example Usage
<?php
/*
Plugin Name: Settings API Example
Plugin URI: http://wpengineer.com/
Description: Complete and practical example of use of the Settings API to add fields on the Writing option page
Author: Ozh
Author URI: http://ozh.org/
*/
// We'll use ozhwpe (Ozh / WP Engineer) as a prefix throughout the plugin
// Register and define the settings
@jhaus
jhaus / default-wp-config.php
Created December 5, 2010 01:39
WP Config file with some useful default settings
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. Get MySQL settings from web host.
* You can find more information by visiting the Codex page:
*
* @link http://codex.wordpress.org/Editing_wp-config.php
*
<?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";
@jhaus
jhaus / wp-remote-edit-post.php
Created December 4, 2010 23:46
remotely edit wordpress posts via: http://bit.ly/gyHw5K
<?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)
<?php
set_time_limit(0);
require_once("IXR_Library.php.inc");
$client->debug = true; // Set it to fase in Production Environment
// Create the client object
$client = new IXR_Client('Your Blog URL/xmlrpc.php');
$username = "Blog Admin/Editor/Author User Name";
<?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);