<?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>Aliso the GeekPosts in ‘WordPress’ | Aliso the Geek</title>
	<atom:link href="http://alisothegeek.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://alisothegeek.com</link>
	<description>A coder in love with WordPress</description>
	<lastBuildDate>Tue, 15 Nov 2011 16:46:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Customize admin menu colors in WordPress 3.2 (the easy way)</title>
		<link>http://alisothegeek.com/2011/07/customize-admin-menu-colors-wordpress-3-2/</link>
		<comments>http://alisothegeek.com/2011/07/customize-admin-menu-colors-wordpress-3-2/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 12:48:53 +0000</pubDate>
		<dc:creator>Alison Barrett</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[admin customization]]></category>
		<category><![CDATA[downloads]]></category>

		<guid isPermaLink="false">http://alisothegeek.com/?p=1114</guid>
		<description><![CDATA[The updates to the admin UI in WordPress 3.2 are pretty great. I love the new interface. The only thing I didn&#8217;t love was the loss of the blocky header and footer of the admin section—that was the easiest and fastest way to customize the look of the admin area for client&#8217;s sites (or for [...]]]></description>
			<content:encoded><![CDATA[<p>The updates to the admin UI in WordPress 3.2 are pretty great. I love the new interface. The only thing I didn&#8217;t love was the loss of the blocky header and footer of the admin section—that was the easiest and fastest way to customize the look of the admin area for client&#8217;s sites (or for fun). With the admin menu being separated from the rest of the page in version 3.2, though, I can customize the colors of that instead, and it still looks pretty darn slick.</p>
<p style="text-align: center;"><a href="http://alisothegeek.com/wp-content/uploads/2011/06/Picture-2.png"><img class="aligncenter size-large wp-image-1115" title="Customized admin menu screenshot" src="http://alisothegeek.com/wp-content/uploads/2011/06/Picture-2-520x396.png" alt="Customized admin menu screenshot" width="520" height="396" /></a></p>
<p>It looks simple enough, but when you take a closer look at the CSS (or just at the menu itself) you realize there are lots of different elements colors need to be applied to:</p>
<ul>
<li>Menu background</li>
<li>Menu header borders</li>
<li>Menu header link text</li>
<li>Separators</li>
<li>Selected background</li>
<li>Selected header borders</li>
<li>Selected header link text</li>
<li>Selected header text shadow</li>
</ul>
<p>And to account for minimized menus with pop-out submenus:</p>
<ul>
<li>Pop-out menu headers</li>
<li>Pop-out menu borders</li>
<li>Pop-out menu header link text</li>
<li>Selected pop-out menu header</li>
<li>Selected pop-out menu link text</li>
</ul>
<p>I went through and customized all of these things with simplistic colors (#069, etc.) and ended up with a pretty sweet menu. Then I wanted to change the color scheme, and I realized there were a zillion (24 actually) places I needed to change colors to make that happen.</p>
<p>This is by no means impossible, but it&#8217;s kind of a pain in the ass. So I did some Googling and found <a title="The CSS_Color class from BarelyFitz" href="http://www.barelyfitz.com/projects/csscolor/" target="_blank">a great PHP script to generate CSS color variations</a> from one base color. I had to modify the script a little (I don&#8217;t have PEAR installed on my dev server) but I ultimately got it to work.</p>
<p>Here&#8217;s the beginning of the stylesheet, so you can see how it works:</p>
<pre>&lt;?php
header( 'Content-type: text/css' );
require_once( '_inc/csscolor.php' );

$base = new CSS_Color( '3B4C7A' );
$selected = new CSS_Color( 'BB7101' );
?&gt;
/* @group Admin Menu Coloring
----------------------------------------------- */

/* Background color of entire menu */
#adminmenuback, #adminmenuwrap, #adminmenu .wp-submenu .wp-submenu-head {
	background: #&lt;?php echo $base-&gt;bg['0']; ?&gt;;
}</pre>
<p>First I&#8217;m tricking the browser into thinking this PHP file is really a CSS file. I&#8217;m sneaky like that. Then I&#8217;m including the modified color script.</p>
<p>Next I define two colors: &#8220;base&#8221; for the overall menu look and &#8220;selected&#8221; for the current menu header.</p>
<p>From here on out, I can use those two variables to print variations of the original color. The script returns a &#8220;bg&#8221; component (the background color) and a &#8220;fg&#8221; component (the foreground color &#8211; white or black, depending on the shade of the background). You can go from -5 to +5 in range (<a title="The CSS_Color class from BarelyFitz" href="http://www.barelyfitz.com/projects/csscolor/" target="_blank">see the original script&#8217;s website for a great visual example</a>). This worked GREAT.</p>
<p>If you want to download the whole package (CSS/PHP file + CSS_Color class file), here you go:</p>
<p><a class="bolts-download-link" href="http://alisothegeek.com/wp-content/uploads/2011/07/wp3.2-admin-menu.zip">WordPress 3.2 Admin Menu Custom Colors</a></p>
<p>To use it in your theme, put both of the files (<code>admin-menu.css.php</code> and <code>csscolor.php</code>) in your theme folder, and add this code to your <code>functions.php</code> file:</p>
<pre>add_action( 'admin_print_styles', 'atg_slick_menu_style' );
function atg_slick_menu_style() {
	wp_register_style( 'slick-admin-menu', get_bloginfo( 'stylesheet_directory' ) . '/admin-menu.css.php' );
	wp_enqueue_style( 'slick-admin-menu' );
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://alisothegeek.com/2011/07/customize-admin-menu-colors-wordpress-3-2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>I&#8217;m going to WordCamp Chicago!</title>
		<link>http://alisothegeek.com/2011/06/im-going-to-wordcamp-chicago/</link>
		<comments>http://alisothegeek.com/2011/06/im-going-to-wordcamp-chicago/#comments</comments>
		<pubDate>Sun, 26 Jun 2011 20:04:49 +0000</pubDate>
		<dc:creator>Alison Barrett</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WC Chicago]]></category>
		<category><![CDATA[WordCamp]]></category>

		<guid isPermaLink="false">http://alisothegeek.com/?p=1123</guid>
		<description><![CDATA[A couple of days ago, my plane tickets were purchased and my hotel reservation was made. I&#8217;m headed to WordCamp Chicago! Brave New Media, the company I work for, is sending me along with our other (awesome) developer, Jerry Kramer. I&#8217;ll definitely be tweeting throughout the event, and you can expect a post or two [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://2011.chicago.wordcamp.org/"><img class="alignleft size-full wp-image-1124" title="WordCamp Chicago attendee badge" src="http://alisothegeek.com/wp-content/uploads/2011/06/wc-chicago-att.jpg" alt="WordCamp Chicago attendee badge" width="200" height="250" /></a>A couple of days ago, my plane tickets were purchased and my hotel reservation was made. I&#8217;m headed to WordCamp Chicago!</p>
<p>Brave New Media, the company I work for, is sending me along with our other (awesome) developer, Jerry Kramer.</p>
<p>I&#8217;ll definitely be tweeting throughout the event, and you can expect a post or two on my blog. I&#8217;ll also be writing on the <a title="Brave New Media's blog" href="http://blog.bravenewmedia.net/">Brave New Media blog</a>—that stuff will be less technical, and my blog will be more developer-oriented. Follow me <a title="Aliso the Geek on Twitter" href="http://twitter.com/alisothegeek">@alisothegeek</a> if you want to hear all the juicy details as events unfold!</p>
]]></content:encoded>
			<wfw:commentRss>http://alisothegeek.com/2011/06/im-going-to-wordcamp-chicago/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WPMU Dev Copyright Infringement: Looking at the Code</title>
		<link>http://alisothegeek.com/2011/06/wpmu-dev-copyright-infringement-looking-at-the-code/</link>
		<comments>http://alisothegeek.com/2011/06/wpmu-dev-copyright-infringement-looking-at-the-code/#comments</comments>
		<pubDate>Sat, 11 Jun 2011 02:55:44 +0000</pubDate>
		<dc:creator>Alison Barrett</dc:creator>
				<category><![CDATA[Opinion]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[GPL]]></category>
		<category><![CDATA[WPMU Dev]]></category>
		<category><![CDATA[Yoast]]></category>

		<guid isPermaLink="false">http://alisothegeek.com/?p=1090</guid>
		<description><![CDATA[I&#8217;ve followed all the hubbub online about WPMU Dev&#8216;s copyright infringement on Yoast&#8217;s WordPress SEO plugin. There are some people taking sides, and I haven&#8217;t vocally been one of them until now. I&#8217;ve used WPMU Dev&#8217;s plugins before, and once WP_DEBUG is turned on, lots of errors usually pop up. Between that and their sleazy [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-thumbnail wp-image-1091" title="WordPress SEO code comparison" src="http://alisothegeek.com/wp-content/uploads/2011/06/Screen-shot-2011-06-10-at-9.00.39-PM-e1307758210295-150x150.png" alt="WordPress SEO code comparison" width="150" height="150" />I&#8217;ve followed <a href="http://yoast.com/wpmu-dev-response/" target="_blank">all the hubbub online</a> about <a href="http://premium.wpmudev.org/" target="_blank">WPMU Dev</a>&#8216;s copyright infringement on Yoast&#8217;s <a href="http://yoast.com/wordpress/seo/" target="_blank">WordPress SEO</a> plugin. There are some people taking sides, and I haven&#8217;t vocally been one of them until now.<span id="more-1090"></span></p>
<p>I&#8217;ve used WPMU Dev&#8217;s plugins before, and once <code>WP_DEBUG</code> is turned on, lots of errors usually pop up. Between that and their sleazy autoblog plugins, I wasn&#8217;t too surprised when I heard that they may have violated copyright law and copied someone else&#8217;s code. After all, WordPress SEO is by far the best SEO plugin I&#8217;ve ever used for WordPress, and I consider it a standard part of any of my WordPress sites these days. If I was going to be a dick and copy someone&#8217;s code for my own SEO plugin, I&#8217;d probably start there.</p>
<p>I made a fresh install of WordPress on my dev server (with <code>WP_DEBUG</code> on) and installed <a href="http://premium.wpmudev.org/project/wpmu-dev-seo" target="_blank">WPMU DEV SEO</a>. As soon as I activated it, I saw this:</p>
<p><a href="http://alisothegeek.com/wp-content/uploads/2011/06/Screen-shot-2011-06-10-at-8.40.21-PM.png"><img class="aligncenter size-large wp-image-1092" title="WPMU DEV SEO activation" src="http://alisothegeek.com/wp-content/uploads/2011/06/Screen-shot-2011-06-10-at-8.40.21-PM-520x133.png" alt="WPMU DEV SEO activation" width="520" height="133" /></a></p>
<p>316 characters of unexpected output. Wonder what those were. Oh, and what&#8217;s that on the top? An error notice for an undefined array index (from <code>wp_upload_dir()</code>: <code>$dir['basedir']</code>).</p>
<p>Also, I get a glaring warning that I need to install their Update Notifications plugin. So I downloaded and activated that, and lo and behold:</p>
<p><a href="http://alisothegeek.com/wp-content/uploads/2011/06/Screen-shot-2011-06-10-at-8.46.13-PM.png"><img class="aligncenter size-large wp-image-1093" title="WPMU Dev Update Notifications activation" src="http://alisothegeek.com/wp-content/uploads/2011/06/Screen-shot-2011-06-10-at-8.46.13-PM-520x417.png" alt="WPMU Dev Update Notifications activation" width="520" height="417" /></a></p>
<p><abbr title="What the frak?">WTF?</abbr> I just wanted to get notified about updates, not plastered with a giant video advertising your paid memberships. Can&#8217;t you see I have a members-only plugin installed next to this one?</p>
<p>The best part of that alert was that it was on <strong>every admin page. </strong>At least it had a tiny &#8220;Dismiss&#8221; link in the bottom corner.</p>
<p>In case you didn&#8217;t see it, there were also two more notices generated by that plugin.</p>
<hr class="bolts-divider" />
<p>So there were a few notices generated for sloppy code, and a giant ad covering my entire admin screen. That&#8217;s not horrible, it&#8217;s just annoying. So I finally opened up the two SEO plugins side by side and started comparing code. The only section I&#8217;ll post about here is the part that replaces the placeholder tags (i.e. replacing <code>%%sitename%%</code> with the name of the blog).</p>
<p>Let&#8217;s start with the function name:</p>
<p><a href="http://alisothegeek.com/wp-content/uploads/2011/06/Screen-shot-2011-06-10-at-8.56.28-PM.png"><img class="aligncenter size-large wp-image-1094" title="SEO plugin function names" src="http://alisothegeek.com/wp-content/uploads/2011/06/Screen-shot-2011-06-10-at-8.56.28-PM-520x10.png" alt="SEO plugin function names" width="520" height="10" /></a></p>
<p><code>wpseo_replace_vars()</code> versus <code>wds_replace_vars()</code>. Similar, but forgivable&#8230; until you look at the rest of the function.</p>
<p><a href="http://alisothegeek.com/wp-content/uploads/2011/06/Screen-shot-2011-06-10-at-8.58.57-PM.png"><img class="aligncenter size-large wp-image-1095" title="$defaults comparison" src="http://alisothegeek.com/wp-content/uploads/2011/06/Screen-shot-2011-06-10-at-8.58.57-PM-520x132.png" alt="$defaults comparison" width="520" height="132" /></a></p>
<p>In the <code>$defaults</code> array, they removed two lines. Indentation, quote type, item order, and the variable names are all the same.</p>
<p><a href="http://alisothegeek.com/wp-content/uploads/2011/06/Screen-shot-2011-06-10-at-8.59.26-PM.png"><img class="aligncenter size-large wp-image-1096" title="$pagenum comparison" src="http://alisothegeek.com/wp-content/uploads/2011/06/Screen-shot-2011-06-10-at-8.59.26-PM-520x59.png" alt="$pagenum comparison" width="520" height="59" /></a></p>
<p>Here, they took the if-else statement and converted it to the shorthand version.</p>
<p><a href="http://alisothegeek.com/wp-content/uploads/2011/06/Screen-shot-2011-06-10-at-9.00.39-PM1.png"><img class="aligncenter size-large wp-image-1097" title="SEO replacements array comparison" src="http://alisothegeek.com/wp-content/uploads/2011/06/Screen-shot-2011-06-10-at-9.00.39-PM1-520x121.png" alt="SEO replacements array comparison" width="520" height="121" /></a></p>
<p>This was my favorite part. The <code>$r</code> variable, which holds the function arguments, was an object in Yoast&#8217;s plugin. WPMU Dev turned it into an array instead, so <code>$r-&gt;post_title</code> becomes <code>$r['post_title']</code>. Other than some slight differences, the <code>$replacements</code> arrays in both plugins are way too similar. Again, indentation and item order are the same. Some items got removed.</p>
<p>Yoast took care of six replacements before this array, but WPMU Dev lumped them all into one array. I removed those six from WPMU Dev&#8217;s code to show the comparison—I did not change the order, syntax, or appearance (or anything else) of the code in the screenshot.</p>
<p>This was just a tiny part of the code that makes up  the plugins. Browsing through the rest of it, there are equally obvious similarities. Bad form, WPMU Dev.</p>
]]></content:encoded>
			<wfw:commentRss>http://alisothegeek.com/2011/06/wpmu-dev-copyright-infringement-looking-at-the-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Email obfuscation in WordPress</title>
		<link>http://alisothegeek.com/2011/06/email-obfuscation-in-wordpress/</link>
		<comments>http://alisothegeek.com/2011/06/email-obfuscation-in-wordpress/#comments</comments>
		<pubDate>Sat, 11 Jun 2011 02:06:39 +0000</pubDate>
		<dc:creator>Alison Barrett</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[tips & tricks]]></category>
		<category><![CDATA[WordPress functions]]></category>

		<guid isPermaLink="false">http://alisothegeek.com/?p=1088</guid>
		<description><![CDATA[For those who don&#8217;t know about the antispambot() function in WordPress, it automatically obfuscates email addresses so it&#8217;s safe to use mailto: links. It turns email@example.com into &#38;#101;&#38;#109;a&#38;#105;&#38;#108;&#38;#64;e&#38;#120;&#38;#97;mp&#38;#108;e.c&#38;#111;m . Cool, huh?]]></description>
			<content:encoded><![CDATA[<p>For those who don&#8217;t know about the <code>antispambot()</code> function in WordPress, it automatically obfuscates email addresses so it&#8217;s safe to use <code>mailto:</code> links. It turns <code>email@example.com</code> into <code>&amp;#101;&amp;#109;a&amp;#105;&amp;#108;&amp;#64;e&amp;#120;&amp;#97;mp&amp;#108;e.c&amp;#111;m</code> . Cool, huh?</p>
]]></content:encoded>
			<wfw:commentRss>http://alisothegeek.com/2011/06/email-obfuscation-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing Bolts, a WordPress Parent Theme</title>
		<link>http://alisothegeek.com/2011/06/introducing-bolts-a-wordpress-parent-theme/</link>
		<comments>http://alisothegeek.com/2011/06/introducing-bolts-a-wordpress-parent-theme/#comments</comments>
		<pubDate>Sat, 04 Jun 2011 21:45:13 +0000</pubDate>
		<dc:creator>Alison Barrett</dc:creator>
				<category><![CDATA[Themes]]></category>
		<category><![CDATA[Bolts]]></category>
		<category><![CDATA[Themejack]]></category>

		<guid isPermaLink="false">http://alisothegeek.com/?p=1062</guid>
		<description><![CDATA[I could endlessly tinker with Bolts, adding one more feature or making one more change before release, but then it would never reach 1.0. So, without further adieu, here it is: Bolts 1.0 It&#8217;s not perfect, but nothing ever is. Please enjoy using it, and I welcome any and all feedback! The fact that Bolts is [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-1064 alignright" title="Bolts" src="http://alisothegeek.com/wp-content/uploads/2011/06/screenshot.png" alt="Bolts" width="300" height="225" />I could endlessly tinker with Bolts, adding one more feature or making one more change before release, but then it would never reach 1.0. So, without further adieu, here it is:</p>
<p><a class="bolts-download-link" href="http://alisothegeek.com/wp-content/uploads/2011/06/bolts.1.0.zip">Bolts 1.0</a></p>
<p>It&#8217;s not perfect, but nothing ever is. Please enjoy using it, and I welcome any and all feedback!</p>
<p>The fact that Bolts is launch-able means that Themejack is that much closer to being a reality. Keep an eye on <a title="Themejack" href="http://themejack.net/">themejack.net</a>, because Bolts will ultimately live there. Once Themejack is launched, I&#8217;ll probably submit this to the WordPress theme repository!</p>
]]></content:encoded>
			<wfw:commentRss>http://alisothegeek.com/2011/06/introducing-bolts-a-wordpress-parent-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mastering the TinyMCE Styles Dropdown in the WordPress Visual Editor</title>
		<link>http://alisothegeek.com/2011/05/tinymce-styles-dropdown-wordpress-visual-editor/</link>
		<comments>http://alisothegeek.com/2011/05/tinymce-styles-dropdown-wordpress-visual-editor/#comments</comments>
		<pubDate>Sat, 07 May 2011 00:52:46 +0000</pubDate>
		<dc:creator>Alison Barrett</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[TinyMCE]]></category>

		<guid isPermaLink="false">http://alisothegeek.com/?p=1036</guid>
		<description><![CDATA[I&#8217;ll just come out and say it: I write my blog posts in the visual editor. Yes, it may be blasphemy for a developer to do that, but I just don&#8217;t care. I like seeing the post I&#8217;m writing come to life as I&#8217;m writing it. Since I&#8217;m such a fan of the visual editor, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://alisothegeek.com/wp-content/uploads/2011/05/styles-dropdown.png"><img class="alignleft size-thumbnail wp-image-1045" title="Styles dropdown menu" src="http://alisothegeek.com/wp-content/uploads/2011/05/styles-dropdown-150x150.png" alt="TinyMCE Styles dropdown menu" width="150" height="150" /></a>I&#8217;ll just come out and say it: I write my blog posts in the visual editor. Yes, it may be blasphemy for a developer to do that, but I just don&#8217;t care. I like seeing the post I&#8217;m writing come to life as I&#8217;m writing it. Since I&#8217;m such a fan of the visual editor, I&#8217;m always looking for new ways to stretch its capabilities without adding a truckload of extra markup to my post. There&#8217;s a slightly more detailed story that leads to how I got to writing this particular post,* but that&#8217;s not why you&#8217;re reading this. You&#8217;re reading this because you want to learn about the styles dropdown in the visual editor. Here we go!</p>
<p><span id="more-1036"></span></p>
<p>Most people know about the &#8220;Kitchen Sink&#8221; button in the WordPress visual editor—the one that toggles the second row of buttons. On that second row, there&#8217;s the familiar Format dropdown menu. Well, there&#8217;s another dropdown menu available that isn&#8217;t on the toolbar by default: the Styles dropdown. This makes it easy to add custom classes to the visual editor in WordPress (which is particularly great for client websites, when clients need a foolproof way to add HTML to the post).</p>
<div id="attachment_1046" class="wp-caption aligncenter" style="width: 530px"><a href="http://alisothegeek.com/wp-content/uploads/2011/05/styles-dropdown-results.png"><img class="size-large wp-image-1046" title="TinyMCE editor screenshot" src="http://alisothegeek.com/wp-content/uploads/2011/05/styles-dropdown-results-520x253.png" alt="TinyMCE editor screenshot" width="520" height="253" /></a><p class="wp-caption-text">The power of the TinyMCE Styles dropdown menu.</p></div>
<h2 id="method-1-comma-separated-string-of-styles">Method 1: Comma-separated string of styles</h2>
<p>I learned about the Styles dropdown a couple of years ago, and through a few Google searches I found out how to make it show up and list my custom classes. This is what I learned then, and it&#8217;s still prevalent in Google search results:</p>
<pre>add_filter( 'tiny_mce_before_init', 'my_custom_tinymce' );

function my_custom_tinymce( $init ) {
	$init['theme_advanced_buttons2_add_before'] = 'styleselect';
	$init['theme_advanced_styles'] = 'Button=button,Callout Box=callout';
	return $init;
}</pre>
<p>(That code would go in your theme&#8217;s <code>functions.php</code> file.)</p>
<p>This is pretty straightforward. We&#8217;re adding the Styles dropdown (<code>'styleselect'</code>) to the second row of buttons (<code>theme_advanced_buttons2_add</code>) at the beginning of the row (<code>_before</code>). Then we&#8217;re adding our own styles to the list.</p>
<p>In the list of styles, the title comes before the equals sign and the CSS class comes afterward. Separate multiple styles with a comma. Violà!</p>
<h3 id="so-whats-wrong-with-that">So what&#8217;s wrong with that?</h3>
<p>This method is 100% okay to use. It&#8217;s short and sweet, requires very little code, and gets the job done. However, it&#8217;s a little restricting. This will take whatever text is highlighted in the editor and wrap a <code>&lt;span&gt;</code> element around it, applying the CSS class to the span. Here&#8217;s what it won&#8217;t do:</p>
<ul>
<li>Apply a class to an existing block element</li>
<li>Limit a style to a specific HTML tag</li>
<li>Wrap multiple block elements in another block element with a custom class</li>
<li>Apply inline styles to an element</li>
</ul>
<p>I definitely want to be able to do all of those things. Don&#8217;t you? (Well, maybe not inline styles, but the point is that you <em>can.</em>)</p>
<h2 id="method-2-arrays-using-tinymce-parameters">Method 2: Arrays using TinyMCE parameters</h2>
<h3 id="step-1-add-the-styles-dropdown-to-the-toolbar">Step 1: Add the Styles dropdown to the toolbar</h3>
<p>Add this code to <code>functions.php</code>:</p>
<pre>add_filter( 'mce_buttons_2', 'my_mce_buttons_2' );

function my_mce_buttons_2( $buttons ) {
    array_unshift( $buttons, 'styleselect' );
    return $buttons;
}</pre>
<p>A slightly different way of adding the dropdown. This filter applies only to the buttons, so it feels a little more <em>right.</em></p>
<h3 id="step-2-add-kick-ass-custom-styles">Step 2: Add KICK-ASS custom styles</h3>
<p>After that, add this code:</p>
<pre>add_filter( 'tiny_mce_before_init', 'my_mce_before_init' );

function my_mce_before_init( $settings ) {

    $style_formats = array(
    	array(
    		'title' =&gt; 'Button',
    		'selector' =&gt; 'a',
    		'classes' =&gt; 'button'
    	),
        array(
        	'title' =&gt; 'Callout Box',
        	'block' =&gt; 'div',
        	'classes' =&gt; 'callout',
        	'wrapper' =&gt; true
        ),
        array(
        	'title' =&gt; 'Bold Red Text',
        	'inline' =&gt; 'span',
        	'styles' =&gt; array(
        		'color' =&gt; '#f00',
        		'fontWeight' =&gt; 'bold'
        	)
        )
    );

    $settings['style_formats'] = json_encode( $style_formats );

    return $settings;

}</pre>
<p>This is also fairly simple once you know the syntax. All we&#8217;re doing is defining the formats, then encoding them as JSON so they&#8217;re TinyMCE-friendly, then assigning them to the TinyMCE settings.</p>
<p>Let&#8217;s break apart the array and look at the different options.</p>
<table>
<tbody>
<tr>
<td><strong>title</strong> [required]</td>
<td>label for this dropdown item</td>
</tr>
<tr>
<td><strong>selector</strong> | <strong>block</strong> | <strong>inline</strong> [required]</td>
<td>
<ul>
<li><strong>selector</strong> limits the style to a specific HTML tag, and will apply the style to an existing tag instead of creating one</li>
<li><strong>block</strong> creates a new block-level element with the style applied, and will replace the existing block element around the cursor</li>
<li><strong>inline</strong> creates a new inline element with the style applied, and will wrap whatever is selected in the editor, not replacing any tags</li>
</ul>
</td>
</tr>
<tr>
<td><strong>classes</strong> [optional]</td>
<td>space-separated list of classes to apply to the element</td>
</tr>
<tr>
<td><strong>styles</strong> [optional]</td>
<td>array of inline styles to apply to the element (two-word attributes, like <em>font-weight</em>, are written in Javascript-friendly camel case: <em>fontWeight</em>)</td>
</tr>
<tr>
<td><strong>attributes</strong> [optional]</td>
<td>assigns attributes to the element (same syntax as <strong>styles</strong>)</td>
</tr>
<tr>
<td><strong>wrapper</strong> [optional, default = false]</td>
<td>if set to <strong>true</strong>, creates a new block-level element around any selected block-level elements</td>
</tr>
<tr>
<td><strong>exact</strong> [optional, default = false]</td>
<td>disables the &#8220;merge similar styles&#8221; feature, needed for some CSS inheritance issues</td>
</tr>
</tbody>
</table>
<p>Note that while <code>classes</code> and <code>styles</code> are both optional, one of the two should be present in each array. (Otherwise, why are you adding this to the dropdown anyway?)</p>
<h3 id="step-3-add-your-stylesheet-to-the-visual-editor">Step 3: Add your stylesheet to the visual editor</h3>
<p>WordPress made this one easy in version 3.1. Just add this to <code>functions.php</code>:</p>
<pre>add_editor_style();</pre>
<p>Then put a file in your theme folder named <code>editor-style.css</code>. Any styles in there are applied to the visual editor.</p>
<p>Update 6/11/11: I&#8217;ve made a plugin version of this so your customizations will be preserved when updating your theme (especially important if you&#8217;re using a regularly updated theme like Twenty Ten). Download it below.</p>
<p><a class="bolts-download-link" href="http://alisothegeek.com/wp-content/uploads/2011/05/atg-styles-dropdown.php_.zip">Download the Custom Styles Dropdown plugin</a></p>
<p>To use it, just unzip the download and put the PHP file in your <code>wp-content/plugins</code> folder, then activate it!</p>
<p>That&#8217;s it! For more TinyMCE parameter examples, check out <a title="WordPress Answers" href="http://wordpress.stackexchange.com/questions/3882/can-i-add-a-custom-format-to-the-format-option-in-the-text-panel">this post at WordPress Answers</a> and <a title="TinyMCE Documentation" href="http://tinymce.moxiecode.com/wiki.php/Configuration:formats">this documentation for TinyMCE</a>.</p>
<div class="bolts-callout note">
<p>* Here&#8217;s the story I mentioned earlier: I am just days away from launching Themejack, where my husband and I will be creating and selling premium WordPress themes based on my Bolts framework. I had a bunch of fancy custom shortcodes defined for things like callout boxes, download links, and buttons, when I happened upon <a title="Dealing with shortcode madness" href="http://justintadlock.com/archives/2011/05/02/dealing-with-shortcode-madness">this post by Justin Tadlock</a>. Basically he&#8217;s saying that shortcodes are often overused, and replaced only with basic HTML. This has certain disadvantages for the user (read his post for more details on that). I really admire Justin Tadlock&#8217;s work—he definitely knows his stuff, and he&#8217;s one of the developers that inspires my work in WordPress—so I tend to listen to what he says when he expresses opinions as strongly as he did in that post.</p>
<p>So I did plenty of Google searching and somehow landed on the TinyMCE Styles dropdown. It makes much more sense than shortcodes when you think about it. Changes can be visible immediately in the visual editor (if you&#8217;re using a custom editor stylesheet) and if the user switches themes, there aren&#8217;t a bunch of useless shortcodes left in the content. I was running into that lack of flexibility, though, and didn&#8217;t find these advanced TinyMCE parameters right away. When I did track them down, they were scattered across a <a href="http://wordpress.stackexchange.com/questions/3882/can-i-add-a-custom-format-to-the-format-option-in-the-text-panel">few</a> <a href="http://tinymce.moxiecode.com/wiki.php/Configuration:formats">different</a> <a href="http://codex.wordpress.org/Function_Reference/add_editor_style">sites</a>, some of which were on pages 3 &amp; 4 in the search results. Hopefully putting them all in one place will make someone else&#8217;s search less exhausting than my own!</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://alisothegeek.com/2011/05/tinymce-styles-dropdown-wordpress-visual-editor/feed/</wfw:commentRss>
		<slash:comments>47</slash:comments>
		</item>
		<item>
		<title>WordPress Settings API Tutorial Follow-Up</title>
		<link>http://alisothegeek.com/2011/04/wordpress-settings-api-tutorial-follow-up/</link>
		<comments>http://alisothegeek.com/2011/04/wordpress-settings-api-tutorial-follow-up/#comments</comments>
		<pubDate>Mon, 25 Apr 2011 00:49:22 +0000</pubDate>
		<dc:creator>Alison Barrett</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Settings API]]></category>
		<category><![CDATA[theme options]]></category>

		<guid isPermaLink="false">http://alisothegeek.com/?p=1018</guid>
		<description><![CDATA[I received a lot of feedback on my Settings API tutorial (thank you so much!) and a few people found some bugs. There was also confusion on how to reference these options in the theme. Well, I have an updated class file and answers to your questions in this post! Updated PHP and CSS files [...]]]></description>
			<content:encoded><![CDATA[<p>I received a lot of feedback on my Settings API tutorial (thank you so much!) and a few people found some bugs. There was also confusion on how to reference these options in the theme. Well, I have an updated class file and answers to your questions in this post!</p>
<p><span id="more-1018"></span></p>
<h2 id="updated-php-and-css-files">Updated PHP and CSS files</h2>
<p><a class="bolts-download-link" href="http://alisothegeek.com/wp-content/uploads/2011/01/settings-api-tutorial.zip">settings-api-tutorial.zip (updated June 5, 2011)</a></p>
<p>In my WordPress parent theme, Bolts, I&#8217;ve been using the same code from my tutorial and making various improvements along the way. These include:</p>
<ul>
<li>Options being saved properly</li>
<li>Checkboxes being set &amp; remembered properly</li>
<li>Using <code>checked()</code> and <code>selected()</code> instead of conditional statements</li>
<li>A pre-written function to easily retrieve settings from the database</li>
</ul>
<h3 id="implementing-the-class-in-your-own-theme">Implementing the class in your own theme</h3>
<p>Put the class in your theme folder, then put this code in your <code>functions.php</code> file:</p>
<pre><code>if ( file_exists( STYLESHEETPATH . '/class.my-theme-options.php' ) )
	include_once( STYLESHEETPATH . '/class.my-theme-options.php' );</code></pre>
<p>Of course, if you&#8217;re changing the name of the class and the filename, apply those changes to this code.</p>
<p>The style of the theme options page now matches the tabbed style in WordPress 3.1. Download and tweak to your heart&#8217;s desire.</p>
<h2 id="getting-options-from-the-database">Getting options from the database</h2>
<p>Put this in your <code>functions.php</code> file:</p>
<pre><code>function mytheme_option( $option ) {
	$options = get_option( 'mytheme_options' );
	if ( isset( $options[$option] ) )
		return $options[$option];
	else
		return false;
}</code></pre>
<p>Now you can use the <code>mytheme_option()</code> function to reference any saved option you want. Just put the option ID in the parentheses (the &#8216;id&#8217; field specified when creating an option in the theme options class). For example: <code>mytheme_option( 'rss_url' )</code> would return <code>http://example.com/feed/</code> (or whatever was specified on the theme options page). For checkboxes, just use a conditional statement:</p>
<pre><code>if ( mytheme_option( 'footer_credit_link' ) )
	echo '&lt;p&gt;Powered by &lt;a href="http://example.com/"&gt;Example.com&lt;/a&gt; and &lt;a href="http://wordpress.org/"&gt;WordPress&lt;/a&gt;&lt;p&gt;';</code></pre>
<p>Thanks to everyone again for using my theme options class and leaving comments to help me improve it! In the future, you&#8217;ll be able to find the most recent version of my theme options class in the Bolts theme, which will be in its first stable release next week! (Also, if I can manage it, it will be available in the WordPress theme repository!)</p>
]]></content:encoded>
			<wfw:commentRss>http://alisothegeek.com/2011/04/wordpress-settings-api-tutorial-follow-up/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>Bolts issue tracker now up and running</title>
		<link>http://alisothegeek.com/2011/04/bolts-issue-tracker-now-up-and-running/</link>
		<comments>http://alisothegeek.com/2011/04/bolts-issue-tracker-now-up-and-running/#comments</comments>
		<pubDate>Sun, 10 Apr 2011 17:37:33 +0000</pubDate>
		<dc:creator>Alison Barrett</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Themejack]]></category>

		<guid isPermaLink="false">http://alisothegeek.com/?p=1010</guid>
		<description><![CDATA[I&#8217;m now even closer to reaching Bolts 1.0! I&#8217;ve gotten some feedback for Bolts Beta, and it&#8217;s been very helpful. In the spirit of really squashing every bug and optimizing every feature, I&#8217;ve put up an issue tracker site to, well, track the issues. Visit the Themejack Tracker Update 6/4/11: We&#8217;re setting up Themejack at [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://themejack.net/tickets/"><img class="alignleft size-medium wp-image-1011" title="Themejack Tracker" src="http://alisothegeek.com/wp-content/uploads/2011/04/Screen-shot-2011-04-10-at-12.34.09-PM-300x171.png" alt="" width="240" height="137" /></a>I&#8217;m now even closer to reaching Bolts 1.0! I&#8217;ve gotten some feedback for Bolts Beta, and it&#8217;s been very helpful. In the spirit of really squashing every bug and optimizing every feature, I&#8217;ve put up an issue tracker site to, well, track the issues.</p>
<p><del><a href="#">Visit the Themejack Tracker</a></del></p>
<div class="bolts-callout alert">Update 6/4/11: We&#8217;re setting up Themejack at Zendesk right now, so the old issue tracker is down.</div>
<p>&nbsp;</p>
<p>For now, if you want to submit a ticket, use the <a title="Contact Me" href="http://alisothegeek.com/contact/">contact form</a> on this site.</p>
<p>And for anyone who wants to know—the tracker site is using an older version of the <a title="Quality Control website" href="http://getqualitycontrol.com/">Quality Control theme</a> (back when it was available for free). That theme rocks my socks.</p>
]]></content:encoded>
			<wfw:commentRss>http://alisothegeek.com/2011/04/bolts-issue-tracker-now-up-and-running/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bolts WordPress Parent Theme: Beta Release</title>
		<link>http://alisothegeek.com/2011/03/bolts-wordpress-parent-theme-beta-release/</link>
		<comments>http://alisothegeek.com/2011/03/bolts-wordpress-parent-theme-beta-release/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 14:28:51 +0000</pubDate>
		<dc:creator>Alison Barrett</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[child themes]]></category>
		<category><![CDATA[theme development]]></category>

		<guid isPermaLink="false">http://alisothegeek.com/?p=974</guid>
		<description><![CDATA[For the past several months, I&#8217;ve been working on developing a parent theme to use for Barrett Creative&#8217;s upcoming premium themes, as well as for client and personal projects. It&#8217;s called Bolts (as in &#8220;nuts and bolts&#8221;) and it&#8217;s meant to make theme development swift and simple. It&#8217;s got some cool extras built in, like [...]]]></description>
			<content:encoded><![CDATA[<script type='text/javascript' src='http://connect.facebook.net/en_US/all.js#xfbml=1'></script>
<script type='text/javascript' src='http://alisothegeek.com/wp-content/themes/bolts/library/scripts/fbml5.js'></script>
<script type='text/javascript' src='http://alisothegeek.com/wp-content/themes/bolts/library/scripts/fbml5.init.js'></script>
<script type='text/javascript' src='http://platform.twitter.com/widgets.js'></script>
<script type='text/javascript' src='http://widgets.digg.com/buttons.js'></script>
<p><img class="alignleft size-full wp-image-976" title="Bolts" src="http://alisothegeek.com/wp-content/uploads/2011/03/screenshot.png" alt="" width="300" height="225" />For the past several months, I&#8217;ve been working on developing a parent theme to use for Barrett Creative&#8217;s upcoming premium themes, as well as for client and personal projects. It&#8217;s called Bolts (as in &#8220;nuts and bolts&#8221;) and it&#8217;s meant to make theme development swift and simple. It&#8217;s got some cool extras built in, like custom widgets, shortcodes, a contact form, and more. It&#8217;s not revolutionary, but I&#8217;m excited to release a beta version of it for anyone to use. Hopefully, some people will be true beta testers and give me feedback! That is the point, after all.</p>
<p>Without further adieu, here it is:</p>
<p>[download link="http://alisothegeek.com/wp-content/uploads/2011/03/bolts-1.0b1.zip"]Download Bolts 1.0 Beta 1[/download]</p>
<p>If you do want to give me feedback, contact me through this site. Shortcode examples after the break.<span id="more-974"></span></p>
<p>[button]Default Button[/button] [button type="primary"]Primary Button[/button] [button type="cancel"]Cancel Button[/button] [button type="disabled"]Disabled Button[/button]</p>
<hr class="bolts-divider" />
<div class="bolts-callout warning">Warning box</div>
<div class="bolts-callout alert">Alert box with <a href="#">a link</a>.</div>
<div class="bolts-callout success">Success box</div>
<div class="bolts-callout info">Info box</div>
<div class="bolts-callout note">Default/note box</div>
<p><embed data-fb="like" data-href="http://alisothegeek.com/2011/03/bolts-wordpress-parent-theme-beta-release/" data-layout="box_count" data-action="like" data-font="arial" data-show_faces="true" data-colorscheme="light" /> <a href="http://twitter.com/share" class="twitter-share-button" data-count="vertical" data-via="alisothegeek" data-lang="en" data-url="http://alisothegeek.com/2011/03/bolts-wordpress-parent-theme-beta-release/">Tweet</a> <a style="text-decoration: none;" class="DiggThisButton DiggMedium" href="http://digg.com/submit?url=http://alisothegeek.com/2011/03/bolts-wordpress-parent-theme-beta-release/"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://alisothegeek.com/2011/03/bolts-wordpress-parent-theme-beta-release/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>New WordPress Sugar for Espresso</title>
		<link>http://alisothegeek.com/2011/02/new-wordpress-sugar-for-espresso/</link>
		<comments>http://alisothegeek.com/2011/02/new-wordpress-sugar-for-espresso/#comments</comments>
		<pubDate>Wed, 09 Feb 2011 02:34:01 +0000</pubDate>
		<dc:creator>Alison Barrett</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[auto-complete]]></category>
		<category><![CDATA[Espresso]]></category>
		<category><![CDATA[sugar]]></category>

		<guid isPermaLink="false">http://alisothegeek.com/?p=958</guid>
		<description><![CDATA[Update 11/15/11: The sugar is now compatible with Espresso 2! Download version 2.0 below. (Thank you for this, Diego!) Update 3/7/11: I&#8217;ve updated this to include several functions that were missing from autocomplete. Download version 1.3 below. Here it is! I finally updated my Espresso sugar for WordPress 3.1. I rewrote the functions list to include [...]]]></description>
			<content:encoded><![CDATA[<div class="bolts-callout info"><strong>Update 11/15/11:</strong> The sugar is now compatible with Espresso 2! Download version 2.0 below. (Thank you for this, <a href="http://www.sinestesia.co/" target="_blank">Diego</a>!)</div>
<div class="bolts-callout info"><strong>Update 3/7/11:</strong> I&#8217;ve updated this to include several functions that were missing from autocomplete. Download version 1.3 below.</div>
<p>Here it is! I finally updated my Espresso sugar for WordPress 3.1. I rewrote the functions list to include every non-deprecated function in the <a href="http://codex.wordpress.org/Function_Reference">WordPress Function Reference</a>. This includes:</p>
<ul>
<li>Multisite functions</li>
<li>Theme/plugin authoring functions, such as wp_enqueue_script</li>
<li>Post Format functions</li>
</ul>
<p>I also revamped the included snippets. These are the snippets that are included in the sugar:</p>
<ul>
<li>Loop (now in HTML 5)</li>
<li>Custom loop (now in HTML 5)</li>
<li>Register custom menu</li>
<li>Register custom post type</li>
<li>Register sidebar</li>
<li>Register custom taxonomy</li>
<li>Stylesheet link</li>
<li>Theme CSS header</li>
</ul>
<p>On top of all the new stuff, I updated the snippets to conform with <a href="http://codex.wordpress.org/WordPress_Coding_Standards">WordPress coding standards</a>.</p>
<p><a class="bolts-download-link" href="http://alisothegeek.com/wp-content/uploads/2011/02/WordPress.sugar_1.zip">Download WordPress Sugar for Espresso v2.0</a></p>
]]></content:encoded>
			<wfw:commentRss>http://alisothegeek.com/2011/02/new-wordpress-sugar-for-espresso/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
	</channel>
</rss>

