<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Brett Terpstraxmlrpc page  - Brett Terpstra</title>
	<atom:link href="http://brettterpstra.com/tag/xmlrpc/feed/" rel="self" type="application/rss+xml" />
	<link>http://brettterpstra.com</link>
	<description>Elegant solutions to complex problems.</description>
	<lastBuildDate>Tue, 22 May 2012 02:49:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>WordPress, custom taxonomy, and XML-RPC</title>
		<link>http://brettterpstra.com/wordpress-custom-taxonomy-and-xml-rpc/</link>
		<comments>http://brettterpstra.com/wordpress-custom-taxonomy-and-xml-rpc/#comments</comments>
		<pubDate>Sat, 19 Feb 2011 16:52:52 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[xmlrpc]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=1952</guid>
		<description><![CDATA[<p>This is a quick tip for anyone who may be searching for an answer to the question: “Is there any way to use XMLRPC to send custom post types to WordPress and attach custom taxonomy terms to them?” Yes, there is. It took me longer than it should have to find it, but I’ve successfully uploaded images, and attached them&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/wordpress-custom-taxonomy-and-xml-rpc/">WordPress, custom taxonomy, and XML-RPC</a></p>]]></description>
			<content:encoded><![CDATA[<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2011/02/wordpresslogopeeling.jpg?9d7bd4" alt="Wordpresslogopeeling" border="0" width="284" height="285" class="alignright" />This is a quick tip for anyone who may be searching for an answer to the question: “Is there any way to use <a href="http://www.xmlrpc.com/">XMLRPC</a> to send <a href="http://codex.wordpress.org/Post_Types#Custom_Types">custom post types</a> to <a href="http://wordpress.com/">WordPress</a> <em>and</em> attach custom taxonomy terms to them?” Yes, there is. It took me longer than it should have to find it, but I’ve successfully uploaded images, and attached them to a “howtos” post type with “level” and “topic” set under its custom taxonomies.</p>

<p><span id="more-1952"></span>
The custom post part is easy, and if you’re working with XML-RPC, you’ve probably already figured it out. Just set your ‘post_type’ to your registered custom post type when you pass the construct to create a new post.</p>

<p>Then it got sticky for me. I ended up finding a nearly <a href="http://core.trac.wordpress.org/ticket/10776">2-year-old patch</a> to the xmlrpc.php file with the answer, and I was pleasantly surprised to see it had already been applied in current versions. So much for documentation. <strong>The construct just needs an element called <code>mt_taxonomy</code>, and it takes an associative array with two keys: <code>tags</code> and <code>taxonomy</code>. <code>tags</code> holds the terms you want to apply, either as another array or in a comma-separated list, and <code>taxonomy</code> is the name of the custom taxonomy they’re assigned/available to.</strong></p>

<p>I ended up adding my own methods to the MetaWeblog interface for handling my specific post types. Quick example:</p>


<div class="wp_syntax"><div class="code"><pre class="php">add_filter<span class="br0">&#40;</span><span class="st_h">'xmlrpc_methods'</span><span class="sy0">,</span> <span class="st_h">'bt_xmlrpc_methods'</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw2">function</span> bt_xmlrpc_methods<span class="br0">&#40;</span><span class="re0">$methods</span><span class="br0">&#41;</span>
<span class="br0">&#123;</span>
	<span class="re0">$methods</span><span class="br0">&#91;</span><span class="st_h">'metaWeblog.addHowTo'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st_h">'bt_add_howto'</span><span class="sy0">;</span>
	<span class="kw1">return</span> <span class="re0">$methods</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>


<p>Then a function called <code>bt_add_howto</code> receives the $args, which will generally be:</p>


<div class="wp_syntax"><div class="code"><pre class="php"><span class="re0">$post_ID</span>         <span class="sy0">=</span> <span class="br0">&#40;</span>int<span class="br0">&#41;</span> <span class="re0">$args</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">;</span>
<span class="re0">$username</span>        <span class="sy0">=</span> <span class="re0">$args</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="sy0">;</span>
<span class="re0">$password</span>        <span class="sy0">=</span> <span class="re0">$args</span><span class="br0">&#91;</span><span class="nu0">2</span><span class="br0">&#93;</span><span class="sy0">;</span>
<span class="re0">$content_struct</span> <span class="sy0">=</span> <span class="re0">$args</span><span class="br0">&#91;</span><span class="nu0">3</span><span class="br0">&#93;</span><span class="sy0">;</span>
<span class="re0">$publish</span>         <span class="sy0">=</span> <span class="re0">$args</span><span class="br0">&#91;</span><span class="nu0">4</span><span class="br0">&#93;</span><span class="sy0">;</span></pre></div></div>


<p>At this point, I think I’m just taking notes for myself. Hopefully this pointer will be enough to help someone else not spend an hour banging their head against the desk. Custom post types are fun, and growing more flexible, but there are a lot of walls you can run into right now.</p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/adding-a-tinymce-button/' rel='bookmark' title='Adding a TinyMCE button to WordPress'>Adding a TinyMCE button to WordPress</a></li>
<li><a href='http://brettterpstra.com/edit-your-wordpress-quicktags-the-right-way/' rel='bookmark' title='Edit your WordPress QuickTags the right way'>Edit your WordPress QuickTags the right way</a></li>
<li><a href='http://brettterpstra.com/evernote-site-memory-tagger-for-wordpress/' rel='bookmark' title='Evernote Site Memory tagger for WordPress'>Evernote Site Memory tagger for WordPress</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/wordpress-custom-taxonomy-and-xml-rpc/">WordPress, custom taxonomy, and XML-RPC</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/wordpress-custom-taxonomy-and-xml-rpc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Getting back into real TextMate blogging</title>
		<link>http://brettterpstra.com/getting-back-into-real-textmate-blogging/</link>
		<comments>http://brettterpstra.com/getting-back-into-real-textmate-blogging/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 06:49:20 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[bundle]]></category>
		<category><![CDATA[textmate]]></category>
		<category><![CDATA[xmlrpc]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=115</guid>
		<description><![CDATA[<p>It may take me a while to convert my setup back to the old days of TextMate blogging. I’ve primarily been blogging for TUAW, which uses a blogging system with very poor XMLRPC support. The end result of this, for me, was the development of an elaborate TextMate bundle which emulated the ease-of-use that TextMate provides to bloggers on WordPress&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/getting-back-into-real-textmate-blogging/">Getting back into real TextMate blogging</a></p>]]></description>
			<content:encoded><![CDATA[<p><img style=' display:none'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2009/11/textmateblogging110409.jpg?9d7bd4" alt="textmateblogging110409" title="textmateblogging110409" width="440" height="187" class="headerimg alignnone size-full wp-image-119" />
It may take me a while to convert my setup back to the old days of TextMate blogging. I’ve primarily been blogging for <a href="http://tuaw.com">TUAW</a>, which uses a blogging system with very poor <a href="http://en.wikipedia.org/wiki/XMLRPC" title="Wikipedia Entry: XML-RPC">XMLRPC</a> support. The end result of this, for me, was the development of <a href="http://github.com/ttscoff/blogsmith-tmbundle">an elaborate TextMate bundle</a> which emulated the ease-of-use that TextMate provides to bloggers on WordPress (and other platforms). I have, I guess, forgotten how to do this. So this post is going to begin as a test, to be continued with some ideas, some tools, and some discoveries I’ve made in my time away from the glory of TextMate blogging.</p>

<p><img style=' float: left; padding: 4px; margin: 0 7px 2px 0;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2009/11/textmateicon_1601.jpg?9d7bd4" alt="Textmateicon 160" height="160" width="160" class="alignleft"  />This paragraph is just to see if I can get an XMLRPC image upload to float left without additional Markdown code.</p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/autotag2-smarter-tagging-for-textmate-and-wordpress/' rel='bookmark' title='AutoTag2: smarter tagging for TextMate and WordPress'>AutoTag2: smarter tagging for TextMate and WordPress</a></li>
<li><a href='http://brettterpstra.com/wordpress-custom-taxonomy-and-xml-rpc/' rel='bookmark' title='WordPress, custom taxonomy, and XML-RPC'>WordPress, custom taxonomy, and XML-RPC</a></li>
<li><a href='http://brettterpstra.com/multimarkdown-in-marsedit/' rel='bookmark' title='MultiMarkdown in MarsEdit'>MultiMarkdown in MarsEdit</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/getting-back-into-real-textmate-blogging/">Getting back into real TextMate blogging</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/getting-back-into-real-textmate-blogging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced
Database Caching 12/32 queries in 0.067 seconds using xcache
Object Caching 1082/1093 objects using xcache
Content Delivery Network via cdn2.brettterpstra.com

Served from: brettterpstra.com @ 2012-05-23 05:12:32 -->
