<?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>Luke Carbis &#187; Tech</title>
	<atom:link href="http://lukecarbis.com/blog/category/tech/feed/" rel="self" type="application/rss+xml" />
	<link>http://lukecarbis.com/blog</link>
	<description>It's more complicated than 42.</description>
	<lastBuildDate>Sun, 13 May 2012 22:14:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Add a parent menu class to wp_nav_menu</title>
		<link>http://lukecarbis.com/blog/2012/04/add-a-parent-menu-class-to-wp_nav_menu/</link>
		<comments>http://lukecarbis.com/blog/2012/04/add-a-parent-menu-class-to-wp_nav_menu/#comments</comments>
		<pubDate>Thu, 05 Apr 2012 02:24:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://lukecarbis.com/blog/?p=755</guid>
		<description><![CDATA[Today I needed to define a class for menu items that have a submenu. The menu items were outputted by wp_nav_menu, and I didn't want to use any Javascript. I found a class filter for when items are being created, and so my first approach was to check if the page had sub pages, which [...]]]></description>
			<content:encoded><![CDATA[<p>Today I needed to define a class for menu items that have a submenu. The menu items were outputted by wp_nav_menu, and I didn't want to use any Javascript.</p>
<p>I found a class filter for when items are being created, and so my first approach was to check if the page had sub pages, which seemed to work at first. I soon realised, however, that just because a page has children, it doesn't mean that it has child menu items, and pages without children can still have child menu items!</p>
<p>So here's my solution. Throw it in your themes functions.php file, and your wp_nav_menu items will receive the class 'parent-menu-item' if they have sub menu items.</p>
<blockquote><p>
function parent_menu_css_class( $classes, $item, $args ) {</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;$menu_items = wp_get_nav_menu_items( $args-&gt;menu );</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;if ( ! $menu_items &amp;&amp; $args-&gt;theme_location &amp;&amp; ( $locations = get_nav_menu_locations() ) &amp;&amp; isset( $locations[ $args-&gt;theme_location ] ) ) :<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$menu = wp_get_nav_menu_object( $locations[ $args-&gt;theme_location ] );<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$menu_items = wp_get_nav_menu_items( $menu-&gt;term_id );<br />
&nbsp;&nbsp;&nbsp;&nbsp;endif;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;foreach ( $menu_items as $menu_item ) :</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( $menu_item-&gt;menu_item_parent == $item-&gt;ID ) :<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$classes[] = 'parent-menu-item';<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;endif;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;endforeach;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;return $classes;<br />
}<br />
add_filter( 'nav_menu_css_class', 'parent_menu_css_class', 10, 3 );</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://lukecarbis.com/blog/2012/04/add-a-parent-menu-class-to-wp_nav_menu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Including a Google Font in your WordPress theme the right way</title>
		<link>http://lukecarbis.com/blog/2012/04/including-a-google-font-in-your-wordpress-theme-the-right-way/</link>
		<comments>http://lukecarbis.com/blog/2012/04/including-a-google-font-in-your-wordpress-theme-the-right-way/#comments</comments>
		<pubDate>Mon, 02 Apr 2012 03:42:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://lukecarbis.com/blog/?p=749</guid>
		<description><![CDATA[Here's the best way to include a Google Font in your WordPress theme. 1. Prepare your font for use on Google Web Fonts. After you've chosen the styles and character sets you would like to include, copy the 'href' attribute of the include code. I'm using the font 'Neuton' in this example. 2. In your theme's [...]]]></description>
			<content:encoded><![CDATA[<p>Here's the best way to include a Google Font in your WordPress theme.</p>
<p>1. Prepare your font for use on Google Web Fonts. After you've chosen the styles and character sets you would like to include, copy the 'href' attribute of the include code. I'm using the font '<em>Neuton</em>' in this example.</p>
<div id="attachment_750" class="wp-caption aligncenter" style="width: 489px"><a href="http://lukecarbis.com/blog/wp-content/uploads/2012/04/Screen-Shot-2012-04-02-at-1.38.19-PM.jpg"><img class="size-full wp-image-750" title="Google Fonts Code" src="http://lukecarbis.com/blog/wp-content/uploads/2012/04/Screen-Shot-2012-04-02-at-1.38.19-PM.jpg" alt="" width="479" height="200" /></a><p class="wp-caption-text">Copy this part!</p></div>
<p>2. In your theme's functions.php file, include the following code, substituting the red example font details for your own:</p>
<blockquote style="text-align:left;"><p>function enqueue_fonts() {<br />
 wp_register_style( '<span style="color: #ff0000;">neuton-font</span>', '<span style="color: #ff0000;">http://fonts.googleapis.com/css?family=Neuton:300,700,400,400italic,200</span>' );<br />
 wp_enqueue_style( '<span style="color: #ff0000;">neuton-font</span>' );<br />
}<br />
add_action( 'init', 'enqueue_fonts' );</p></blockquote>
<p>3. You're good to go - you can now use the font in your stylesheet, as per Google's instructions.</p>
]]></content:encoded>
			<wfw:commentRss>http://lukecarbis.com/blog/2012/04/including-a-google-font-in-your-wordpress-theme-the-right-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

