<?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>Thomas Griffin Media</title> <atom:link href="http://thomasgriffinmedia.com/feed/" rel="self" type="application/rss+xml" /><link>http://thomasgriffinmedia.com</link> <description>Just another WordPress site</description> <lastBuildDate>Tue, 10 Apr 2012 03:11:45 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Soliloquy for WordPress Has Launched!</title><link>http://thomasgriffinmedia.com/blog/2012/04/soliloquy-for-wordpress-has-launched/</link> <comments>http://thomasgriffinmedia.com/blog/2012/04/soliloquy-for-wordpress-has-launched/#comments</comments> <pubDate>Tue, 10 Apr 2012 03:11:45 +0000</pubDate> <dc:creator>Thomas Griffin</dc:creator> <category><![CDATA[WordPress Customizations]]></category><guid isPermaLink="false">http://thomasgriffinmedia.com/?p=892</guid> <description><![CDATA[I&#8217;ve been grueling over this plugin for about 5 months now, and the time has finally come to launch the plugin out into the world. Say hello to the best jQuery slider plugin for WordPress: Soliloquy. Soliloquy was birthed out of countless hours of frustration when trying to deal with other slider plugins for WordPress. [...]]]></description> <content:encoded><![CDATA[<p>I&#8217;ve been grueling over this plugin for about 5 months now, and the time has finally come to launch the plugin out into the world. Say hello to <a title="Soliloquy - the Best jQuery Slider Plugin for WordPress" href="http://soliloquywp.com" target="_blank">the best jQuery slider plugin for WordPress: Soliloquy</a>.</p><p><a title="Soliloquy - the Best jQuery Slider Plugin for WordPress" href="http://soliloquywp.com" target="_blank">Soliloquy</a> was birthed out of countless hours of frustration when trying to deal with other slider plugins for WordPress. As I would hunt for an easy to use slider plugin for client projects, I kept having to revert to making my own custom slider plugins because the others simply didn&#8217;t cut it. Either the code was horrendous, the UI unfriendly, or they just plain didn&#8217;t work half the time as expected.</p><p>As I began surveying how I could remedy this situation, a thought occurred to me: &#8220;I wonder if other people share the same frustration as me&#8221;. You hear all the time that when a new slider plugin comes out, people say &#8220;Oh great, another slider plugin..&#8221; <strong>That type of attitude is symptomatic of a pandemic of bad slider plugins. </strong></p><p>Just think &#8211; when a new contact form plugin is created, nobody says &#8220;Oh great, another contact form plugin..&#8221;. Why? Because there are great contact form plugins like Gravity Forms that alleviate this symptom of thought. The same goes for SEO (Yoast), performance (W3TC), backups (BackupBuddy) and the list could go on. The type of thinking simply shifts from &#8220;Oh great, another X type of plugin..&#8221; to &#8220;Why do we need another X type of plugin?&#8221;. You see the difference? <strong>The former is out of frustration &#8211; the latter is out of perplexity.</strong></p><p><em><strong>My hope is that Soliloquy will change this way of thinking.</strong></em></p><p>I&#8217;ve not been this excited about something that I&#8217;ve created in a long time. The reason why I am so excited? It&#8217;s going to be a game changer. The possibilities with Soliloquy are endless, and I&#8217;ve only touched the tip of the iceberg.</p><h3>Features</h3><p>I won&#8217;t go into much detail here about the features of Soliloquy (since you can view them from the actual Soliloquy site), but I will tell you that Soliloquy is incredibly efficient and resourceful. Soliloquy keeps everything to itself and doesn&#8217;t creep beyond it&#8217;s post type boundaries. It only loads what it needs when it needs it, and follows WordPress coding standards to the T. Its data security is absolutely the best of its class (the code is audited by <a href="http://markjaquith.com/" target="_blank">Mark Jaquith</a>) and it can be customized with a seemingly endless selection of hooks and filters.</p><p>But I think the best part about the plugin is the response from the WordPress community itself. I&#8217;ve not heard one negative thing yet about the plugin, and the response has been overwhelmingly positive, exciting and encouraging. People are finally beginning to get their slider plugin thirst quenched, and to watch that happen is a wonderful feeling.</p><h3>Final Thoughts</h3><p>Like I said earlier, Soliloquy is going to be a game changer. I&#8217;d love to hear your thoughts and responses on Soliloquy in the comments below! But before you do that, <a title="Soliloquy - the Best jQuery Slider Plugin for WordPress" href="http://soliloquywp.com" target="_blank">head on over to the site, check out all the features and consider purchasing a copy for yourself</a>. <img src='http://cdn.thomasgriffinmedia.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://thomasgriffinmedia.com/blog/2012/04/soliloquy-for-wordpress-has-launched/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>My Presentation for WordCamp Atlanta 2012</title><link>http://thomasgriffinmedia.com/blog/2012/02/my-presentation-for-wordcamp-atlanta-2012/</link> <comments>http://thomasgriffinmedia.com/blog/2012/02/my-presentation-for-wordcamp-atlanta-2012/#comments</comments> <pubDate>Fri, 03 Feb 2012 04:35:15 +0000</pubDate> <dc:creator>Thomas Griffin</dc:creator> <category><![CDATA[WordPress Tutorials]]></category><guid isPermaLink="false">http://thomasgriffinmedia.com/?p=883</guid> <description><![CDATA[I&#8217;ve embedded my presentation for WordCamp Atlanta 2012 below. For some reason, SlideShare won&#8217;t get my font correctly (Helvetica), so you&#8217;ll just have to do with this ridiculously silly looking one instead. WordCamp Atlanta Presentation View more presentations from griffinjt]]></description> <content:encoded><![CDATA[<p>I&#8217;ve embedded my presentation for WordCamp Atlanta 2012 below. For some reason, SlideShare won&#8217;t get my font correctly (Helvetica), so you&#8217;ll just have to do with this ridiculously silly looking one instead. <img src='http://cdn.thomasgriffinmedia.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p><div style="width:425px" id="__ss_11396672"> <strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/griffinjt/wordcamp-atlanta-presentation-11396672" title="WordCamp Atlanta Presentation" target="_blank">WordCamp Atlanta Presentation</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/11396672" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe><div style="padding:5px 0 12px"> View more <a href="http://www.slideshare.net/" target="_blank">presentations</a> from <a href="http://www.slideshare.net/griffinjt" target="_blank">griffinjt</a></div></p></div> ]]></content:encoded> <wfw:commentRss>http://thomasgriffinmedia.com/blog/2012/02/my-presentation-for-wordcamp-atlanta-2012/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Thoughts and Reflections from 2 Years of Web Development</title><link>http://thomasgriffinmedia.com/blog/2012/01/thoughts-and-reflections-from-2-years-of-web-development/</link> <comments>http://thomasgriffinmedia.com/blog/2012/01/thoughts-and-reflections-from-2-years-of-web-development/#comments</comments> <pubDate>Wed, 18 Jan 2012 00:11:11 +0000</pubDate> <dc:creator>Thomas Griffin</dc:creator> <category><![CDATA[Personal]]></category> <category><![CDATA[personal development]]></category><guid isPermaLink="false">http://thomasgriffinmedia.com/?p=881</guid> <description><![CDATA[It would be safe to say that so much has changed in the past two years of my life. In light of thinking on this fact today, I decided it would be good to document my journey in web development and provide some insight for those just getting started. Humble Beginnings October 3 years ago [...]]]></description> <content:encoded><![CDATA[<p>It would be safe to say that so much has changed in the past two years of my life. In light of thinking on this fact today, I decided it would be good to document my journey in web development and provide some insight for those just getting started.</p><h3>Humble Beginnings</h3><p>October 3 years ago (October 2009) I was a sophomore in college at the wonderful Appalachian State University. I&#8217;ve always been pretty good with handling finances, but it just so happened that I was struggling to keep money in the bank. I was the stereotypical &#8220;poor&#8221; college student, yet unlike most college students who say they are poor, I really was.</p><p>I lived from paycheck to paycheck working at a local Cotillion teaching ballroom dancing and social etiquette alongside of the occasional carpet cleaning job. I remember many times eating macaroni and cheese for lunch and supper, and although I was still (and still am) blessed beyond all measure by Jesus, I hated the feeling of wondering if I would have enough money in the bank to get me by until the next paycheck. Jesus was always (and always is) faithful to provide me with money from somewhere (on multiple occasions I received checks in the mail from people who I still don&#8217;t know), but that didn&#8217;t mean I couldn&#8217;t work harder to provide.</p><p>So I decided to do something about it.</p><p>I did what lots of people do when they need money fast &#8211; I typed in &#8220;how to make money online&#8221; in Google and started searching.</p><p>I came across article writing and decided to give it a shot. I saw that it didn&#8217;t pay much, but with every article accepted I would get paid immediately. Immediate payment was nice, so one Sunday afternoon I sat down and began writing articles. I wrote 10 or 12 of them that afternoon, submitted them all and waited.</p><p>Two days later all but one of them were approved and I earned $27.</p><p>$27 wasn&#8217;t a lot, but it was $27 more than I had so I was incredibly excited. The next few months I powered through more than 75 articles on whatever topics intrigued me that day: singing, cleaning, poetry, sports, etc. I ended up making somewhere around $500 for all the articles I had written (including revenues from pageviews).</p><p>As Christmas break came, I sat down and really thought about the sustainability of this whole article writing and marketing thing. I came to the conclusion that the benefit I was receiving wasn&#8217;t worth the work I was putting into it (who could&#8217;ve seen that one coming?), so I went back to the drawing board.</p><p>I began to think to myself, &#8220;What if I had my own website where I wrote and marketed articles myself? Maybe then I would get some more money from pageviews and such.&#8221; Piece of cake, right?</p><p>I had always liked web stuff and had been fairly adept at fighting viruses on PCs, so I figured I would give this website thing a shot. Somehow I came across WordPress and decided it was the right way to go, especially with their &#8220;famous 5-minute installation&#8221;.</p><p>I went ahead and bought my first domain name and hosting and downloaded WordPress. I learned that I needed to setup a database and use FTP in order to upload WordPress to my server. Somehow (by the grace of God) I figured out how to create the database, but for the life of me could not figure out how to work FTP. Specifically, I had no clue what a &#8220;root&#8221; folder was, and so after 6 hours (yes, 6) of trying to upload WordPress, I quit.</p><p>I was so upset that I spent $60 for absolutely nothing and almost got sick to my stomach. $60 is a lot of money when you really don&#8217;t have much to begin with. I thought about getting a refund for the hosting, but the hubris in me (and the providence of God) stopped me from doing it.</p><h3>Moving Forward</h3><p>6 weeks later (around the middle fo February) I decided to give it another shot. Boone, NC had an abnormally cold and wintery season that year, and it just so happened that we were snowed in for a couple days in a row. I tried uploading WordPress and after 30 minutes I finally got it figured out (even though my first install was domain.com/wordpress). I was so excited I couldn&#8217;t help but pace the room and think of all the new possibilities for making some extra income.</p><p>I had been reading about SEO and niche sites when I was writing articles so I decided to put my knowledge to the test. I created my own niche site and started writing away. I got accepted for Google AdSense and thought I had it made.</p><p>That is, until a couple months later my AdSense account got banned for no apparent reason. I was floored. I had made only a handful of change, but it was crushing nonetheless (I successfully appealed the ban some months later to my surprise).</p><p>I then decided that I needed to go another route in order to make some extra money. I had become somewhat intrigued by tweaking my website design and had started to get the hang of CSS. I already knew some HTML from a class in high school, so I thought I would give development a try and see what would happen.</p><p>When I read about Thesis for WordPress and all of its awesome SEO capabilities and easy-to-use options in May 2010, I decided to purchase it and run with it. I had never used PHP before, but the concept of hooks and filters seemed easy enough. Use what you want, replace what you need.</p><p><strong>Wrong.</strong></p><p>No matter how many times people tell you web development is easy, learning a new language is still incredibly difficult. Learning syntax, nuances and best practices for a new programming language is likened to learning a spoken language. Sure, looking back now I wonder how I got so confused and frustrated, but that doesn&#8217;t change the fact that is was really tough in the beginning.</p><p>I can remember spending countless hours watching and reading tutorials on how to work with PHP and integrate it with HTML. Arrays, objects, functions, language constructs &#8211; none of it really made sense. I understood how to make something work, but I didn&#8217;t understand why it worked, and that just left me feeling like I was crawling in the dark all the time. Just in case you were wondering, that isn&#8217;t the most enjoyable place to be.</p><p>Summer rolled around and my dad knew I was trying to get into web development. He needed a website for his business, and so as a nice gift and gesture to get me started on my feet, he gave me $500 to build the website. I was so excited I could hardly stand it. 7 weeks later, I produced my first ever website (which considering it was my first website, I still don&#8217;t think it was all too bad <img src='http://cdn.thomasgriffinmedia.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ): <a title="G &amp; L Building Services, Inc." href="http://glbuilding.com" target="_blank">http://glbuilding.com</a>.</p><p>Even though 7 weeks is an incredibly long time to do a website, it really did take me that long to figure out how to make everything work. I was happy with the finished product, and so far the return on investment for my dad has been absolutely remarkable.</p><p>I was serving as the worship guy at a local church in Boone and got the privilege of doing their website for them as well. This time the website took half the time to make, and I really began to enjoy the development aspect of building websites. I still had no clue what half of PHP meant or how WordPress interacted with it, but one thing I knew for certain&#8230;</p><blockquote><p>If I could get efficient at building websites, this could be a really good way to make extra money on the side.</p></blockquote><h3><strong>The Ultimatum</strong></h3><p>So, on September 1, 2010, I officially created the business I now run today: Thomas Griffin Media. I got my EIN, went down to the Town Hall and filled out my application, gave them a check and had my business license. I can remember going by Cookout afterward and grabbing a milkshake. I couldn&#8217;t help but think of what the future would hold, and I knew it looked promising.</p><p>I&#8217;m a businessman by nature, so I believe that is really what propelled me to get contracts in the beginning &#8211; that and advertising on Google (which much to my surprise always had a positive ROI). From September to the end of the year, I made something like $5,000 doing whatever web design and development projects came my way. $5,000 was a ton of money for me in such a short period of time, so when I came home for Christmas break at the end of 2010 I sat down and made out a budget.</p><p>You see, I was engaged to be married September 2011. After a bunch of incredibly frustrating phone call interviews for jobs, I really, really hated the idea of going to work for &#8220;the man&#8221;. I had been through Dave Ramsey&#8217;s Total Money Makeover book and course (which I cannot recommend highly enough &#8211; I still use it to this day), so I knew that I needed to figure out a budget for my upcoming living expenses.</p><p>It wasn&#8217;t just about me anymore &#8211; I was going to have to provide for myself and my future wife. After digging through expenses and getting advice from my parents, I finally came up with a number &#8211; the amount of money I needed to make per month to get by.</p><p><strong>Starting January 2011, I would do a 3 month trial run. I wrote out that if I made less than that number for any one of those months, I would quit web development and hunt for a job. I figured it this way &#8211; if I didn&#8217;t pursue web development, I would have enough money from those jobs during those months to get me buy until I found a job.</strong></p><p><em>I didn&#8217;t miss that budget once during those 3 months and have yet to come under that budget to this day.</em></p><h3>Growing</h3><p>I really didn&#8217;t start to grasp WordPress until the spring of 2011. I had moved away from Thesis to the Genesis Framework (which I still use and highly recommend) and began to learn how the templating system in WordPress really worked. This proved to be vital in my growth as a developer.</p><p>But the most crucial piece of my development was learning about this function in PHP: print_r().</p><p>Yes, up until this past September I had never heard of or used functions such as print_r() and var_dump(). It is no wonder that PHP didn&#8217;t make sense to me. Before I learned the function print_r(), I had always wondered how in the world people knew what items were stored in particular variables.</p><p>Literally a whole new world opened up to me when I learned how to use print_r(). I finally understood how objects, arrays, loops, keys, values and more worked. And it didn&#8217;t take me long to put it into practice either.</p><p><a title="Automatic Installation and Activation Class for WordPress" href="http://tgmpluginactivation.com" target="_blank">TGM Plugin Activation</a> was the first real application that I built after this enlightenment. While before I was PHP blind, now I saw at least somewhat clearly. With the help, encouragement and constant correction from Gary Jones, TGM Plugin Activation has blossomed into a really powerful piece of software for WordPress.</p><p>Part of growing pains is looking back at things you once did. I cringe at some of the things I made when I first started (and even some of the things on my own site), but I am ok with that because I did everything with integrity and honesty. I never tried to be someone that I wasn&#8217;t, and because of that, I can face the things I did in the past and point to the present.</p><h3>Insights for You</h3><p>The amount of knowledge I have learned from October 2011 until now has been exponential compared to my previous learning curve. I have been immensely blessed and continue to grow each and every day.</p><p>While I have grown tremendously in the past few years, I can honestly say that I still don&#8217;t know that much. I&#8217;m constantly humbled by those that are smarter than me, but that doesn&#8217;t mean that I can&#8217;t share some insight and wisdom from my own experiences in becoming a WordPress developer.</p><ol><li><strong>Don&#8217;t be afraid to look stupid. </strong>I know that I have had my pride handed to me on a cold dish an innumerable amount of times before, and I readily confess that it will happen in the future. But don&#8217;t ever let that stop you from learning. Learning takes time, study and plenty of questions &#8211; some of which may be more obvious to seasoned developers. Smug responses will come, but be quick to put them behind you &#8211; they were once in your shoes, too, at one time or another.</li><li><strong>Ask plenty of questions.</strong> I ask questions all the time (and perhaps too much on some occasions). You won&#8217;t know until you ask, so you may as well ask anyway. You may find out that just asking will help you solve your own problems.</li><li><strong>Be humble.</strong> Not that I am the paradigm of humility, but I have learned that a good dose of it is good for your soul. Don&#8217;t think of yourself higher than others. Remember that there is always someone who knows one more command, has created one more plugin, has a theme that loads .0005 seconds faster than yours, or has more efficient code than you. In humility, strive to become better and thank those that help you along the way.</li><li><strong>You never stop learning.</strong> Don&#8217;t believe the lie that you &#8220;have arrived&#8221;. The fact you constantly have to push out bug fixes, tweaks and new versions of things should be a good reminder you still have room for growth.</li><li><strong>Find some mentors.</strong> I&#8217;m indebted to a few people who (for whatever reason) decided to take some time and invest in me. Learn from your peers and benefit from the wisdom they can impart to you.</li><li><strong>Seek a good name over everything else.</strong> Proverbs 22:1 says <em>&#8220;A good name is to be chosen rather than great riches,</em><br /> <em>and favor is better than silver or gold.&#8221; </em>It is far better to have a good name than to build X number of junky sites or cheat clients out of X amount of dollars. To err is human, so inevitably you will make mistakes (like myself) and miss the mark &#8211; but don&#8217;t let that stop you from striving to have a good name among your peers, clients and other important people in your life.</li></ol><p>It&#8217;s been good to reflect on the past couple years, and I really look forward to the years to come. I love my job as a WordPress developer and can&#8217;t wait to see what the future holds. I have lots to learn and plenty of room for growth, so lookout future &#8211; here I come.</p><p><strong><em>Oh, and remember that first website I created? Last month it received over 86k pageviews and has an email list of over 7,000 people. Who would&#8217;ve guessed it? <img src='http://cdn.thomasgriffinmedia.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </em></strong></p> ]]></content:encoded> <wfw:commentRss>http://thomasgriffinmedia.com/blog/2012/01/thoughts-and-reflections-from-2-years-of-web-development/feed/</wfw:commentRss> <slash:comments>12</slash:comments> </item> <item><title>Explode Your Aweber List with Aweber Comment Optin</title><link>http://thomasgriffinmedia.com/blog/2012/01/explode-your-aweber-list-with-aweber-comment-optin/</link> <comments>http://thomasgriffinmedia.com/blog/2012/01/explode-your-aweber-list-with-aweber-comment-optin/#comments</comments> <pubDate>Tue, 17 Jan 2012 00:15:22 +0000</pubDate> <dc:creator>Thomas Griffin</dc:creator> <category><![CDATA[WordPress Customizations]]></category><guid isPermaLink="false">http://thomasgriffinmedia.com/?p=879</guid> <description><![CDATA[Does the title look familiar? If it does, it&#8217;s because it is very familiar indeed! A few days ago I released a similar plugin for MailChimp called MailChimp Comment Optin. This plugin is identical to that one with a few minor exceptions (as detailed below). The Aweber Comment Optin plugin works with, you guessed it, [...]]]></description> <content:encoded><![CDATA[<p>Does the title look familiar? If it does, it&#8217;s because it is very familiar indeed! A few days ago I released a similar <a title="Explode Your MailChimp List with MailChimp Comment Optin" href="http://thomasgriffinmedia.com/blog/2012/01/explode-your-mailchimp-list-with-mailchimp-comment-optin/">plugin for MailChimp called MailChimp Comment Optin</a>. This plugin is identical to that one with a few minor exceptions (as detailed below).</p><p>The <a title="Aweber Comment Optin" href="http://wordpress.org/extend/plugins/aweber-comment-optin/" target="_blank">Aweber Comment Optin</a> plugin works with, you guessed it, Aweber. It integrates seamlessly with Aweber&#8217;s API to subscribe users to a list of your choosing (their email and optionally their name). Beyond the difference in name, the API works a little bit differently in Aweber vs. MailChimp.</p><p>Aweber&#8217;s API requires OAuth authentication in order for the plugin to gain access to your account, list and subscriber information. OAuth is a security architecture that API platforms can use in order to get around users having to give away their login names and passwords. OAuth connects applications to API using authorization codes (or as I call them &#8216;tokens&#8217;). You will notice with the plugin that Aweber will require you to login and will give an OAuth authorization token before the plugin can access your data. Once you have done this one time, your authorization token will be good as long as you stay logged in. You must get a new authorization token anytime you have to log back in to Aweber and grant the plugin access to your account.</p><p>&#8220;But doesn&#8217;t Aweber&#8217;s official WordPress plugin do this already?&#8221; you might say. Yes, in a way it does, but even their own plugin doesn&#8217;t have the ability to check for pending/already subscribed users, which is a UX shame&#8230;and the code for the plugin is unorganized, sloppy, and has all those <a href="http://justintadlock.com/archives/2010/12/30/wordpress-theme-function-files" target="_blank">silly &#8220;pluggable&#8221; functions everywhere</a>.</p><p>You really do have the opportunity to explode your email list by using this plugin, so don&#8217;t miss out on those valuable subscribers! You officially have no excuse!</p><p>Be sure to give me feedback and suggestions on how I can improve the plugin! <img src='http://cdn.thomasgriffinmedia.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://thomasgriffinmedia.com/blog/2012/01/explode-your-aweber-list-with-aweber-comment-optin/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Explode Your MailChimp List with MailChimp Comment Optin</title><link>http://thomasgriffinmedia.com/blog/2012/01/explode-your-mailchimp-list-with-mailchimp-comment-optin/</link> <comments>http://thomasgriffinmedia.com/blog/2012/01/explode-your-mailchimp-list-with-mailchimp-comment-optin/#comments</comments> <pubDate>Sat, 14 Jan 2012 18:00:50 +0000</pubDate> <dc:creator>Thomas Griffin</dc:creator> <category><![CDATA[WordPress Customizations]]></category><guid isPermaLink="false">http://thomasgriffinmedia.com/?p=878</guid> <description><![CDATA[One of my goals this year is to really work on email marketing for my affiliate and niche product sites. I have somewhere around 20 of them that I manage/update/occasionally write content for, but none of them are using email optin lists to get potentially valuable email addresses. While part of that was on purpose (it&#8217;s [...]]]></description> <content:encoded><![CDATA[<p>One of my goals this year is to really work on email marketing for my affiliate and niche product sites. I have somewhere around 20 of them that I manage/update/occasionally write content for, but none of them are using email optin lists to get potentially valuable email addresses.</p><p>While part of that was on purpose (it&#8217;s been 18 months for most of them), I am now going to give email marketing a go on all of those niche sites (and even here on my own to demonstrate my new plugin).</p><p>A simple (or so it seems) way of gathering email addresses for your list is to provide an option to do so when commenting. This adds an easy way for your users to subscribe without having to enter extra information to optin to your list. My search came up empty for something like this that integrated with MailChimp (which is what I use for all my email lists), so I decided to write my own plugin to do what I need. Enter: <a title="MailChimp Comment Optin" href="http://wordpress.org/extend/plugins/mailchimp-comment-optin/" target="_blank">MailChimp Comment Optin</a>.</p><p><a title="MailChimp Comment Optin" href="http://wordpress.org/extend/plugins/mailchimp-comment-optin/" target="_blank">MailChimp Comment Optin</a> adds just the functionality you need to grab email addresses when you user comments on your posts. Commenters can check a box in order to optin to an email list of your choosing. The process is double optin, so users will receive an activation email before they are confirmed.</p><p>In order to access your account, you will need to enter in a MailChimp API key for your account (which you can find under your account settings in the API Keys &amp; Authorized Apps area). Once your API key has been entered and successfully validated, you will be able to select the list commenters should be subscribed to as well as some other options for customization.</p><p>The plugin checks for 3 different criteria and will display a different message for each:</p><ol><li>&#8216;admin&#8217; &#8211; if you are logged in as an administrator, a simple message is given to you instead of a checkbox (I&#8217;m guessing you don&#8217;t want to subscribe to your own list <img src='http://cdn.thomasgriffinmedia.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> )</li><li>&#8216;pending&#8217; &#8211; this message is displayed if the commenter has subscribed but has not yet activated their account</li><li>&#8216;subscribed&#8217; &#8211; no checkbox is displayed but rather a message saying they are already subscribed to the blog</li></ol><p>If none of these criteria are met, it is assumed that the current commenter is not subscribed to your list and thus a checkbox is displayed.</p><p>Below is a screenshot of the admin area (once you have entered your API key):</p><p><a href="http://i.imgur.com/csj0n.png"><img class="alignnone" src="http://i.imgur.com/csj0n.png" alt="" width="800" height="392" /></a></p><p>And if you want to see an example of what it looks like, well just look below my comment box to see. <img src='http://cdn.thomasgriffinmedia.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p><p>Hope you enjoy the plugin and may your email list explode because of it!</p> ]]></content:encoded> <wfw:commentRss>http://thomasgriffinmedia.com/blog/2012/01/explode-your-mailchimp-list-with-mailchimp-comment-optin/feed/</wfw:commentRss> <slash:comments>20</slash:comments> </item> <item><title>Cinch Templates has officially launched!</title><link>http://thomasgriffinmedia.com/blog/2011/12/cinch-templates-has-officially-launched/</link> <comments>http://thomasgriffinmedia.com/blog/2011/12/cinch-templates-has-officially-launched/#comments</comments> <pubDate>Tue, 20 Dec 2011 16:55:12 +0000</pubDate> <dc:creator>Thomas Griffin</dc:creator> <category><![CDATA[Cinch Templates]]></category><guid isPermaLink="false">http://thomasgriffinmedia.com/?p=871</guid> <description><![CDATA[It would be no lie to say that I have been incredibly busy this December. Traditionally December and January are my busiest months, and this year is no different. For the past few months, I&#8217;ve been working on an exciting new project that finally came to fruition called Cinch Templates &#8211; a landing page template [...]]]></description> <content:encoded><![CDATA[<p><a href="http://cinchtemplates.com"><img class="aligncenter size-full wp-image-872" title="header-image" src="http://cdn.thomasgriffinmedia.com/wp-content/uploads/2011/12/header-image.png" alt="Landing Page Templates by Cinch Templates" width="573" height="150" /></a></p><p>It would be no lie to say that I have been incredibly busy this December. Traditionally December and January are my busiest months, and this year is no different. For the past few months, I&#8217;ve been working on an exciting new project that finally came to fruition called <a title="Landing Page Templates by Cinch Templates" href="http://cinchtemplates.com" target="_blank">Cinch Templates</a> &#8211; a landing page template solution built for WordPress.</p><h3>What are Cinch Templates?</h3><blockquote><p>Cinch Templates are <a title="Landing Page Templates by Cinch Templates" href="http://cinchtemplates.com" target="_blank">landing page templates</a> for WordPress (with HTML versions as well) that are incredibly easy to use and setup, well designed and coded, SEO optimized, and mobile responsive.</p></blockquote><p>This idea was birthed a few months ago out of my frustration to find a good landing page template that wasn&#8217;t insanely expensive or incredibly cumbersome to setup. The average user doesn&#8217;t want to pay a fortune for a one-page solution, nor do they want to edit HTML or use FTP to upload the template to their site. Heck, I&#8217;m a web developer and I feel the same way &#8211; so I decided to do something about it.</p><p>Cinch Templates utilize the power of WordPress to make landing page templates ridiculously easy to setup and use. Here&#8217;s a short rundown of some of the features:</p><ul><li>No HTML or FTP knowledge is needed once inside WordPress (no, really, you don&#8217;t need it)</li><li>Installation and registration is as easy as clicking a file upload field and clicking a button &#8211; WordPress handles the rest for you using its own Filesystem class</li><li>SEO settings can be customized using input fields</li><li>You can choose color schemes right from the settings page</li><li>You can upload and assign images right from the settings page using WordPress&#8217; native media uploader</li><li>You can craft your content using WordPress&#8217; native WYSIWYG editor</li><li>And of course, if you want to use HTML/CSS, there is an area to add custom scripts and styles</li><li>Developers have plenty of hooks and filters to use to add/remove/modify content if they wish</li></ul><p>One of the best things about Cinch Templates are their versatility. They can be used as standalone themes or can be included within existing WordPress themes where they are theme agnostic &#8211; you can use them within any existing WordPress theme or child theme that you desire (by using the Cinch Template Jetpack plugin). You can add and register as many Cinch Templates as you would like within your current theme, and these settings stay the same when changing from one theme to another. All you need to do is re-register the template(s) with the new, active WordPress theme and you are set to go.</p><p>If you head over to the Cinch Templates site now and enter in your email, you can get the first template, <a title="Cinch Template Classic Demo" href="http://demos.cinchtemplates.com/classic/" target="_blank">Classic</a>, absolutely free of charge. It&#8217;s a classic, one-column landing page template design with 5 color schemes, the ability to upload a custom favicon and header and much, much more. And don&#8217;t worry &#8211; if you get lost, I&#8217;ve made an instructional video to help you out. <img src='http://cdn.thomasgriffinmedia.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p><p>So if you need serious <a title="Landing Page Templates by Cinch Templates" href="http://cinchtemplates.com" target="_blank">landing page templates</a> that are easy to setup and use, consider Cinch Templates as your landing page template solution. You won&#8217;t be disappointed.</p> ]]></content:encoded> <wfw:commentRss>http://thomasgriffinmedia.com/blog/2011/12/cinch-templates-has-officially-launched/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Curtail Child Theme for Genesis Officially Released!</title><link>http://thomasgriffinmedia.com/blog/2011/10/curtail-child-theme-for-genesis-officially-released/</link> <comments>http://thomasgriffinmedia.com/blog/2011/10/curtail-child-theme-for-genesis-officially-released/#comments</comments> <pubDate>Thu, 13 Oct 2011 16:30:55 +0000</pubDate> <dc:creator>Thomas Griffin</dc:creator> <category><![CDATA[Themes]]></category> <category><![CDATA[Curtail]]></category><guid isPermaLink="false">http://thomasgriffinmedia.com/?p=861</guid> <description><![CDATA[It&#8217;s official &#8211; my first public child theme for the Genesis Framework, Curtail, has been released in the StudioPress Marketplace. This child theme is packed with lots of theme options to customize your site. Specifically, you can: Choose between 8 different color styles with an intuitive UI (just click the color you want and you [...]]]></description> <content:encoded><![CDATA[<p>It&#8217;s official &#8211; my first public child theme for the Genesis Framework, <a title="Purchase Curtail Now" href="http://market.studiopress.com/themes/curtail" target="_blank">Curtail</a>, has been released in the StudioPress Marketplace.</p><p>This child theme is packed with lots of theme options to customize your site. Specifically, you can:</p><ul><li>Choose between 8 different color styles with an intuitive UI (just click the color you want and you are set)</li><li>Easily place social media buttons within your navigation menu</li><li>Choose to add social media buttons to individual posts</li><li>Customize the home page quote and link</li><li>and so much more!</li></ul><p>Not only does the theme come with these powerful theme options &#8211; it also comes pre-packaged with the Nivo Slider Pro plugin! That&#8217;s a $120 value for only $24.95! You simply cannot beat that.</p><p>Curtail also makes it simple to install the plugin with my <a title="Automatically Install Plugins with Themes for WordPress" href="http://thomasgriffinmedia.com/blog/2011/09/automatically-install-plugins-with-themes-for-wordpress/" target="_blank">automatic plugin activation class</a>. Just follow the admin notices and you will have the Nivo Slider Pro plugin working in no time flat.</p><p>On top of this, the code base for this theme is incredibly well-tuned and defined. It is very well documented for  developers and is optimized for speed and performance.</p><p>So what are you waiting for? You should go <a href="http://market.studiopress.com/themes/curtail" target="_blank">grab a copy of Curtail</a> for yourself today!</p> ]]></content:encoded> <wfw:commentRss>http://thomasgriffinmedia.com/blog/2011/10/curtail-child-theme-for-genesis-officially-released/feed/</wfw:commentRss> <slash:comments>12</slash:comments> </item> <item><title>Automatically Install Plugins with Themes for WordPress</title><link>http://thomasgriffinmedia.com/blog/2011/09/automatically-install-plugins-with-themes-for-wordpress/</link> <comments>http://thomasgriffinmedia.com/blog/2011/09/automatically-install-plugins-with-themes-for-wordpress/#comments</comments> <pubDate>Fri, 30 Sep 2011 14:58:00 +0000</pubDate> <dc:creator>Thomas Griffin</dc:creator> <category><![CDATA[WordPress Customizations]]></category> <category><![CDATA[WordPress Tutorials]]></category><guid isPermaLink="false">http://thomasgriffinmedia.com/?p=854</guid> <description><![CDATA[With v2.2.0 just releasing, we will now be updating all the support information for the TGM Plugin Activation library at this site: http://tgmpluginactivation.com. Please go there for all the latest updates! Today is great day for myself and for the WordPress community. I&#8217;ve been hard at work trying to solve a problem that has plagued [...]]]></description> <content:encoded><![CDATA[<div class="notice">With v2.2.0 just releasing, we will now be updating all the support information for the TGM Plugin Activation library at this site: <a title="TGM Plugin Activation" href="http://tgmpluginactivation.com" target="_blank">http://tgmpluginactivation.com</a>. Please go there for all the latest updates!</div><p>Today is great day for myself and for the WordPress community. I&#8217;ve been hard at work trying to solve a problem that has plagued theme authors for a long time &#8211; <strong>how to include or prompt users to automatically download, install and activate required (or necessary) plugins upon theme activation.</strong></p><p>Well, now that is completely possible with a new class that I have built on top of a lot of WordPress APIs. With some help from <a title="Gary Jones - Genesis Developer" href="http://garyjones.co.uk/" target="_blank">Gary Jones</a>, the TGM_Plugin_Activation class is now available for WordPress theme authors and users everywhere!</p><p><strong>***UPDATE***</strong></p><p>Version 2.0 now has an API for theme authors to hook into to use the class, eliminating the need to change the code within the class. Check out the details below!</p><h3 class="no-border"><a title="Automatically Download/Install Plugins for WordPress Themes" href="https://github.com/thomasgriffin/TGM-Plugin-Activation" target="_blank">Click here to download the class from Github</a></h3><h3>How It Works</h3><p>The TGM_Plugin_Activation class works by taking a set a key =&gt; value pairs from a multidimensional array and processes them to do one of two things:</p><ol><li>Automatically install a plugin that comes pre-packaged with the theme</li><li>Automatically download the .zip file from the WordPress Plugin Repository and install it</li></ol><p>In either case, this new class can handle multiple instances of both, which means that you can include/prompt to download as many plugins as needed!</p><p>On theme activation, users are prompted with admin notices that certain plugins are required for the theme. Users can then click the links that take them to a page where forms are prepared for them to submit. If you just follow the instructions on the Github page without removing the default examples, your users would appear on a page that looks like this:</p><p><a href="http://cdn.thomasgriffinmedia.com/wp-content/uploads/2011/09/Install-Required-Plugins-‹-Test-—-WordPress.png"><img class="aligncenter size-medium wp-image-856" title="Install Required Plugins ‹ Test — WordPress" src="http://cdn.thomasgriffinmedia.com/wp-content/uploads/2011/09/Install-Required-Plugins-‹-Test-—-WordPress-300x145.png" alt="" width="300" height="145" /></a></p><p>The UI is very familiar and intuitive because it follows suit with the rest of the WordPress admin UI. Users can then hit the submit button that installs the plugin. For plugins that come pre-packaged with the theme, they will see a screen that looks like this:</p><p><a href="http://cdn.thomasgriffinmedia.com/wp-content/uploads/2011/09/pre-packed.png"><img class="aligncenter size-medium wp-image-859" title="pre-packed" src="http://cdn.thomasgriffinmedia.com/wp-content/uploads/2011/09/pre-packed-300x145.png" alt="" width="300" height="145" /></a></p><p>For plugins that are to be downloaded the WordPress Plugin Repository, they will see a screen that looks like this:</p><p><a href="http://cdn.thomasgriffinmedia.com/wp-content/uploads/2011/09/repo.png"><img class="aligncenter size-medium wp-image-860" title="repo" src="http://cdn.thomasgriffinmedia.com/wp-content/uploads/2011/09/repo-300x145.png" alt="" width="300" height="145" /></a></p><p>Seen these messages before? You probably have because the TGM_Plugin_Activation class uses the same methods as WordPress itself uses to download, install, upgrade and activate plugins.</p><h3>How To Include the TGM_Plugin_Activation Class with Your Theme</h3><p>Take a look at the following code (taken from the example.php file included with the class):</p><pre class="brush: php; title: ; notranslate">/**
 * Include the TGM_Plugin_Activation class.
 */
require_once dirname( __FILE__ ) . '/class-tgm-plugin-activation.php';

add_action( 'tgmpa_register', 'my_theme_register_required_plugins' );
/**
 * Register the required plugins for this theme.
 *
 * In this example, we register two plugins - one included with the TGMPA library
 * and one from the .org repo.
 *
 * The variable passed to tgmpa_register_plugins() should be an array of plugin
 * arrays.
 *
 * This function is hooked into tgmpa_init, which is fired within the
 * TGM_Plugin_Activation class constructor.
 */
function my_theme_register_required_plugins() {

	/**
	 * Array of plugin arrays. Required keys are name and slug.
	 * If the source is NOT from the .org repo, then source is also required.
	 */
	$plugins = array(
		/** This is an example of how to include a plugin pre-packaged with a theme */
		array(
			'name'     =&gt; 'TGM Example Plugin', // The plugin name
			'slug'     =&gt; 'tgm-example-plugin', // The plugin slug (typically the folder name)
			'source'   =&gt; get_stylesheet_directory() . '/lib/plugins/tgm-example-plugin.zip', // The plugin source
			'required' =&gt; false,
		),
		/** This is an example of how to include a plugin from the WordPress Plugin Repository */
		array(
			'name' =&gt; 'Edit Howdy',
			'slug' =&gt; 'edit-howdy',
		),
	);

	/** Change this to your theme text domain, used for internationalising strings */
	$theme_text_domain = 'tgmpa';

	/**
	 * Array of configuration settings. Uncomment and amend each line as needed.
	 * If you want the default strings to be available under your own theme domain,
	 * uncomment the strings and domain.
	 * Some of the strings are added into a sprintf, so see the comments at the
	 * end of each line for what each argument will be.
	 */
	$config = array(
		/*'domain'       =&gt; $theme_text_domain,         // Text domain - likely want to be the same as your theme. */
		/*'default_path' =&gt; '',                         // Default absolute path to pre-packaged plugins */
		/*'menu'         =&gt; 'install-my-theme-plugins', // Menu slug */
		'strings'      =&gt; array(
			/*'page_title'             =&gt; __( 'Install Required Plugins', $theme_text_domain ), // */
			/*'menu_title'             =&gt; __( 'Install Plugins', $theme_text_domain ), // */
			/*'instructions_install'   =&gt; __( 'The %1$s plugin is required for this theme. Click on the big blue button below to install and activate %1$s.', $theme_text_domain ), // %1$s = plugin name */
			/*'instructions_activate'  =&gt; __( 'The %1$s is installed but currently inactive. Please go to the &lt;a href=&quot;%2$s&quot;&gt;plugin administration page&lt;/a&gt; page to activate it.', $theme_text_domain ), // %1$s = plugin name, %2$s = plugins page URL */
			/*'button'                 =&gt; __( 'Install %s Now', $theme_text_domain ), // %1$s = plugin name */
			/*'installing'             =&gt; __( 'Installing Plugin: %s', $theme_text_domain ), // %1$s = plugin name */
			/*'oops'                   =&gt; __( 'Something went wrong with the plugin API.', $theme_text_domain ), // */
			/*'notice_can_install'     =&gt; __( 'This theme requires the %1$s plugin. &lt;a href=&quot;%2$s&quot;&gt;&lt;strong&gt;Click here to begin the installation process&lt;/strong&gt;&lt;/a&gt;. You may be asked for FTP credentials based on your server setup.', $theme_text_domain ), // %1$s = plugin name, %2$s = TGMPA page URL */
			/*'notice_cannot_install'  =&gt; __( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', $theme_text_domain ), // %1$s = plugin name */
			/*'notice_can_activate'    =&gt; __( 'This theme requires the %1$s plugin. That plugin is currently inactive, so please go to the &lt;a href=&quot;%2$s&quot;&gt;plugin administration page&lt;/a&gt; to activate it.', $theme_text_domain ), // %1$s = plugin name, %2$s = plugins page URL */
			/*'notice_cannot_activate' =&gt; __( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', $theme_text_domain ), // %1$s = plugin name */
			/*'return'                 =&gt; __( 'Return to Required Plugins Installer', $theme_text_domain ), // */
		),
	);

	tgmpa( $plugins, $config );

}</pre><p>This may seem like a lot of code, but don&#8217;t let it scare you. Most of it is commenting to help you understand what each part does and how the API interacts with the class.</p><p>First you need to include the class for use within your <code>functions.php</code> file. This is done by the require_once line. You should amend the path so that it targets wherever you decide to place the class within your theme directory structure.</p><p>The crux of the API is the <code>tgmpa_register()</code> hook and the <code>tgmpa()</code> function. Your plugin information and configurations are added within a function that is added to the <code>tgmpa_register</code> hook. There are three variables for you to play with: <code>$plugins</code>, <code>$config</code> and <code>$theme_text_domain</code>.</p><p>The <code>$plugins</code> variables is required for you to fill out to include your plugins. The variable takes multiple arrays of arguments for your plugins. The keys &#8216;name&#8217; and &#8216;slug&#8217; are required for both pre-packaged and repo plugins. If you plugin is pre-packaged, the &#8216;source&#8217; key is also required. The &#8216;required&#8217; key is a boolean that will soon be used to determine whether your plugin is required or simply recommended. You can leave this out for now as it will not be active until a future update.</p><p>The <code>$theme_text_domain</code> is for localization. You set your own text domain here so that the strings used by the class can be localized along with your other theme text strings.</p><p>The <code>$config</code> variable allows you to set the theme text domain, the default absolute path to your pre-packaged plugins, the menu slug for the install plugins page, and an array of strings to customize admin notices and other messages to your theme users. Refer to the <code>example.php</code> file to learn how you can customize these for your theme.</p><h3>A Look at What&#8217;s Inside</h3><p>This automatic plugin installer class makes use of quite a few of WordPress&#8217; own classes. Specifically, this class uses WP_Filesystem, Plugin_Upgrader, Plugin_Skin_Installer and WP_Error. This class also makes use of the plugins_api function as well for preparation for the plugin install and activation.</p><p>Unfortunately, none of these classes have extensive documentation (apart from WP_Error). <a href="http://ottopress.com/2011/tutorial-using-the-wp_filesystem/" target="_blank">Otto has a great tutorial on WP_Filesystem</a> which I recommend you read get an understand of how to instantiate it. I will make a tutorial soon on how to use WP_Filesystem is correlation with other WordPress classes so you too can learn how to make applications like this one. <img src='http://cdn.thomasgriffinmedia.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>Questions? Comments? I&#8217;d love to have them! Please post any bugs you find or any questions that may arise when using this class because I would love to work them out. I believe this class has some great potential within the WordPress community, so please make sure you let everyone know about it!</p><p>Thomas</p> ]]></content:encoded> <wfw:commentRss>http://thomasgriffinmedia.com/blog/2011/09/automatically-install-plugins-with-themes-for-wordpress/feed/</wfw:commentRss> <slash:comments>26</slash:comments> </item> <item><title>How to Add Child Theme Options to the Genesis Framework</title><link>http://thomasgriffinmedia.com/blog/2011/09/how-to-add-child-theme-options-to-the-genesis-framework/</link> <comments>http://thomasgriffinmedia.com/blog/2011/09/how-to-add-child-theme-options-to-the-genesis-framework/#comments</comments> <pubDate>Thu, 22 Sep 2011 20:00:08 +0000</pubDate> <dc:creator>Thomas Griffin</dc:creator> <category><![CDATA[Genesis Tutorials]]></category> <category><![CDATA[theme options]]></category><guid isPermaLink="false">http://thomasgriffinmedia.com/?p=785</guid> <description><![CDATA[In this tutorial, I am going to teach how to correctly add child theme options with the Genesis Framework. Theme options are quite popular because they add perceived value to themes and allow users to customize the themes without having to touch any code. We will be adding these child theme options to the Genesis [...]]]></description> <content:encoded><![CDATA[<p>In this tutorial, I am going to teach how to correctly add child theme options with the <a href="http://thomasgriffinmedia.com/get-genesis/" target="_blank">Genesis Framework</a>. Theme options are quite popular because they add perceived value to themes and allow users to customize the themes without having to touch any code. We will be adding these child theme options to the Genesis Framework following the standards provided in <a href="http://dev.studiopress.com/new-settings" target="_blank">this article on StudioPress&#8217; website</a>.</p><p>If you want to go ahead and download the source files, <a href="http://cdn.thomasgriffinmedia.com/wp-content/uploads/2011/09/ctsettings.zip">click this link here to download them</a>.</p><h3>Setting Up Our Directory Structure</h3><p>The first thing we need to do is setup our directory and file structure. Make sure that your child theme already has a <code>style.css</code> and <code>functions.php</code> file as we will be using them later on in this tutorial. While in the root of your child theme, create a folder called <code>lib</code>. Within the <code>lib</code> folder, create another folder called <code>admin</code>. And finally, within the <code>admin</code> folder create a file called <code>childthemename-theme-settings.php</code>. Simply replace <code>childthemename</code> with your custom child theme&#8217;s name. Your structure should look similar to this (my child theme is called <code>ctsettings</code>):</p><p><a href="http://cdn.thomasgriffinmedia.com/wp-content/uploads/2011/09/ctsettings-structure.png"><img class="aligncenter size-medium wp-image-786" title="ctsettings-structure" src="http://cdn.thomasgriffinmedia.com/wp-content/uploads/2011/09/ctsettings-structure-300x187.png" alt="" width="300" height="187" /></a></p><p>Next, go to your child theme&#8217;s <code>functions.php</code> file and place this code right below the <code>require_once( TEMPLATEPATH . '/lib/init.php' );</code> line:</p><pre class="brush: php; title: ; notranslate">
require_once( CHILD_DIR . '/lib/admin/childthemename-theme-settings.php' );
</pre><p><strong>Remember to replace <code>childthemename</code> with your custom child theme name!</strong></p><p>Now that you have your structure in place, let&#8217;s begin building out our child theme options in our new file.</p><h3>Setting Up the File Structure and Defining Constants</h3><p>Let&#8217;s begin by setting up the file structure and defining any constants that we will use throughout our settings page (in this tutorial we will use just one constant). Copy and paste the following code into your <code>childthemename-theme-settings.php</code> file:</p><pre class="brush: php; title: ; notranslate">
&lt;?php
/**
 * CT Settings Theme Settings
 *
 * @package      CT Settings
 * @author       Thomas Griffin &lt;http://thomasgriffinmedia.com/&gt;
 * @copyright    Copyright (c) 2011, Thomas Griffin
 * @license      http://opensource.org/licenses/gpl-2.0.php GNU Public License
 *
 */
</pre><p>In order to follow best coding standards, we should make sure that we comment everything. In the commented section, simply change anywhere you see CT Settings to your custom child theme name. You should also change the author and copyright lines to reflect your own work.</p><p>Next we need to define our settings constant. Defining constants is beneficial because if we for some reason decide to change the name of our setting, we only have to change one line instead of searching through the entire document and changing every reference. Copy and paste the following code below your commented block:</p><pre class="brush: php; title: ; notranslate">/* Define our constants
------------------------------------------------------------ */

define( 'CTSETTINGS_SETTINGS_FIELD', 'ct-settings' );</pre><p>This will define a constant to use for our settings field. Once again, change <code>CTSETTINGS</code> and <code>ct-settings</code> to your custom child theme&#8217;s name. Now that we have defined our settings field, we can easily grab options using Genesis&#8217; <code>genesis_get_option</code> function:</p><pre class="brush: php; title: ; notranslate">genesis_get_option( 'childthemename_custom_option', CTSETTINGS_SETTINGS_FIELD );</pre><h3>Setting Up Default Options</h3><p>Let&#8217;s go ahead and register our default options for our child theme settings. We always want to store our options in an array in order to optimize performance. <strong>Always remember to prefix your options with your child theme&#8217;s name!</strong> Copy and paste the following code into your <code>childthemename-theme-settings.php</code> file:</p><pre class="brush: php; title: ; notranslate">/* Setup default options
------------------------------------------------------------ */

/**
 * ctsettings_default_theme_options function.
 *
 * This function stores the default CT Settings theme options. It can be filtered using ctsettings_default_theme_options.
 *
 * @return $options, filtered by ctsettings_default_theme_options
 *
 * @since 1.0.0
 *
 */
function ctsettings_default_theme_options() {
	$options = array(
		'ctsettings_facebook_link' 	=&gt; 0,
		'ctsettings_twitter_link' 	=&gt; 0,
		'ctsettings_google_link' 	=&gt; 0
	);
	return apply_filters( 'ctsettings_default_theme_options', $options );
}</pre><p>Once again, remember to change out <code>ctsettings</code> to your child theme&#8217;s custom name. In this block of code, we are building out a function that will be used to register and store our child theme settings in the database. Our settings in this tutorial will be used to add Facebook Like, Tweet and Google+ buttons to our posts. On return, we have a filter setup so that default options can be added or removed using the <code>ctsettings_default_theme_options</code> filter. Now we are -almost- ready to register our settings and store our defaults in WordPress, but before we do this, we need to make sure that these options are properly sanitized using Genesis&#8217; new sanitization class and filters.</p><h3>Sanitizing Our Options</h3><p>We always want our options to be secure, and in accordance to a security audit for Genesis, a new sanitization class was birthed that allows us to easily sanitize and secure our options for use. There are currently 4 sanitizing filters that can be utilized: <code>one_zero</code>, <code>no_html</code>, <code>safe_html</code> and <code>requires_unfiltered_html</code>. For this tutorial, we will only be using the <code>one_zero</code> filter for our checkboxes. Copy and paste the following code in your <code>childthemename-theme-settings.php</code> file:</p><pre class="brush: php; title: ; notranslate">/* Sanitize any inputs
------------------------------------------------------------ */

add_action( 'genesis_settings_sanitizer_init', 'ctsettings_sanitize_inputs' );
/**
 * ctsettings_sanitize_inputs function.
 *
 * This function accesses Genesis' sanitization class to sanitize all users inputs and options in the CT Settings settings area.
 *
 * @since 1.0.0
 *
 */
function ctsettings_sanitize_inputs() {
    genesis_add_option_filter( 'one_zero', CTSETTINGS_SETTINGS_FIELD, array( 'ctsettings_facebook_link', 'ctsettings_twitter_link', 'ctsettings_google_link' ) );
}</pre><p>We are added our options to be sanitized into the <code>genesis_settings_sanitizer_init</code> action hook. The <code>genesis_add_option_filter</code> takes 3 parameters: <code>$filter</code>, <code>$option</code> and <code>$suboption</code>. The <code>$filter</code> option is the specific one we would like to use, which I listed previously. The <code>$option</code> parameter is for the settings field used in the sanitizer, which in this case is the one we defined at the beginning of our file, <code>CTSETTINGS_SETTINGS_FIELD</code>. The third parameter <code>$suboption</code> is an array of options that are tied to our settings field. Thus we have the code above! Now we can finally register and store our default options.</p><h3>Registering, Storing and Restoring Our Default Settings</h3><p>Copy and paste the following code below your previously pasted code in your <code>childthemename-theme-settings.php</code> file:</p><pre class="brush: php; title: ; notranslate">/* Register our settings and add the options to the database
------------------------------------------------------------ */

add_action( 'admin_init', 'ctsettings_register_settings' );
/**
 * ctsettings_register_settings function.
 *
 * This function registers the settings for use in the CT Settings theme settings area. It also restores default options when
 * the Reset button is selected.
 *
 * @since 1.0.0
 *
 */
function ctsettings_register_settings() {
	register_setting( CTSETTINGS_SETTINGS_FIELD, CTSETTINGS_SETTINGS_FIELD );
	add_option( CTSETTINGS_SETTINGS_FIELD, ctsettings_default_theme_options() );

	if ( genesis_get_option( 'reset', CTSETTINGS_SETTINGS_FIELD ) ) {
		update_option( CTSETTINGS_SETTINGS_FIELD, ctsettings_default_theme_options() );
		genesis_admin_redirect( CTSETTINGS_SETTINGS_FIELD, array( 'reset' =&gt; 'true' ) );
		exit;
	}
}</pre><p>We hook this function into the <code>admin_init</code> hook. This function registers our settings and adds them into the database. We also add the reset option functionality into this function as well. We test if the reset button has been successfully submitted, and if so, we update our option field back to the defaults and refresh the page so that the defaults are present again (using the <code>genesis_admin_redirect</code> function). Remember to change <code>CTSETTINGS_SETTINGS_FIELD</code> to the constant you defined at the beginning of the file.</p><h3>Adding Admin Notices for Updated Settings</h3><p>Our last piece of overhead is to add in our admin notices when our settings are updated. This is the last piece of code needed before we actually begin to build out our page. After this, you will have laid the entire framework for your child theme options. Copy and paste the following code into your file:</p><pre class="brush: php; title: ; notranslate">/* Admin notices for when options are saved/reset
------------------------------------------------------------ */

add_action( 'admin_notices', 'ctsettings_theme_settings_notice' );
/**
 * ctsettings_theme_settings_notice function.
 *
 * This function displays admin notices when the user updates CT Settings' theme settings area.
 *
 * @since 1.0.0
 *
 */
function ctsettings_theme_settings_notice() {
	if ( ! isset( $_REQUEST['page'] ) || $_REQUEST['page'] != CTSETTINGS_SETTINGS_FIELD )
		return;

	if ( isset( $_REQUEST['reset'] ) &amp;&amp; 'true' == $_REQUEST['reset'] )
		echo '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;&lt;strong&gt;' . __( 'Settings reset.', 'genesis' ) . '&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;';
	elseif ( isset( $_REQUEST['settings-updated'] ) &amp;&amp; 'true' == $_REQUEST['settings-updated'] )
		echo '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;&lt;strong&gt;' . __( 'Settings saved.', 'genesis' ) . '&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;';
}</pre><p>This function hooks into the <code>admin_notices</code> hook and alerts your users when they have either updated or reset their settings. This is a pretty straightforward function so I won&#8217;t go into great detail explaining it. Basically we check to make sure we are on the correct page, and if so, we then display messages based on the button the user has selected to update the child theme options. Now let&#8217;s go and build out our page!</p><h3>Creating Your Child Theme Options Page</h3><p>Finally we are ready to create our child theme&#8217;s options page. Copy and paste the following code into your file:</p><pre class="brush: php; title: ; notranslate">/* Register our theme options page
------------------------------------------------------------ */

add_action( 'admin_menu', 'ctsettings_theme_options' );
/**
 * ctsettings_theme_options function.
 *
 * This function registers the CT Settings settings page and prepares the styles, scripts and metaboxes to be loaded.
 *
 * @global $_ctsettings_settings_pagehook
 *
 * @since 1.0.0
 *
 */
function ctsettings_theme_options() {
	global $_ctsettings_settings_pagehook;
	$_ctsettings_settings_pagehook = add_submenu_page( 'genesis', 'CT Settings', 'CT Settings', 'edit_theme_options', CTSETTINGS_SETTINGS_FIELD, 'ctsettings_theme_options_page' );

	//add_action( 'load-'.$_ctsettings_settings_pagehook, 'ctsettings_settings_styles' );
	add_action( 'load-'.$_ctsettings_settings_pagehook, 'ctsettings_settings_scripts' );
	add_action( 'load-'.$_ctsettings_settings_pagehook, 'ctsettings_settings_boxes' );
}</pre><p>By hooking into the <code>admin_menu</code> action hook, we are able to create our child theme options page. This page is created as a sub-menu page of the parent Genesis, as specified by the child theme standards document on StudioPress&#8217; website. We setup a global variable called <code>$_ctsettings_settings_pagehook</code> so that we load our styles, scripts, metaboxes and forms only on our page. The last parameter of the <code>add_submenu_page</code> function is the callback function that will hold our form that displays and submits user inputted options.</p><p>Also in the function we are hooking into the <code>load-$hookname</code> action hook, which runs specified callback functions on the specific pagehook. For this tutorial, I have commented out the <code>ctsettings_settings_styles</code> action because we will not be using custom styles. If you wanted to add a custom stylesheet, you would uncomment that line and enqueue your admin stylesheet. Now we need to populate those callback functions that we just added to the action hooks.</p><h3>Enqueuing Our Scripts</h3><p>First we will populate the <code>ctsettings_settings_scripts</code> function. Copy and paste the following code into your file:</p><pre class="brush: php; title: ; notranslate">/* Setup our scripts
------------------------------------------------------------ */

/**
 * ctsettings_settings_scripts function.
 *
 * This function enqueues the scripts needed for the CT Settings settings page.
 *
 * @global $_ctsettings_settings_pagehook
 *
 * @since 1.0.0
 *
 */
function ctsettings_settings_scripts() {
	global $_ctsettings_settings_pagehook;
	wp_enqueue_script( 'common' );
	wp_enqueue_script( 'wp-lists' );
	wp_enqueue_script( 'postbox' );
}</pre><p>This function simply enqueues the necessary scripts needed to make our page function like the Genesis theme option page functions. No more explanation necessary. <img src='http://cdn.thomasgriffinmedia.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><h3>Adding Our Metaboxes to Our Child Theme Options Page</h3><p>Next we need to populate our <code>ctsettings_settings_boxes</code> function. Copy and paste the following code into your file:</p><pre class="brush: php; title: ; notranslate">/* Setup our metaboxes
------------------------------------------------------------ */

/**
 * ctsettings_settings_boxes function.
 *
 * This function sets up the metaboxes to be populated by their respective callback functions.
 *
 * @global $_ctsettings_settings_pagehook
 *
 * @since 1.0.0
 *
 */
function ctsettings_settings_boxes() {
	global $_ctsettings_settings_pagehook;
	add_meta_box( 'ctsettings-social-box', __( 'CT Settings Social Sharing', 'genesis' ), 'ctsettings_social_metabox', $_ctsettings_settings_pagehook, 'main' );
}</pre><p>This function adds our metabox into the system. Once again, we access the global variable <code>$_ctsettings_settings_pagehook</code> to ensure that we are doing this only on our child theme&#8217;s options page. In this tutorial, the add_meta_box function is taking 5 parameters: <code>$id</code>, <code>$title</code>, <code>$callback</code>, <code>$page</code>, and <code>$context</code>. We now need to populate our callback function<code> ctsettings_social_metabox</code> so that we can see our new metabox.</p><h3>Creating and Displaying Our Metabox</h3><p>Copy and paste this code into your file:</p><pre class="brush: php; title: ; notranslate">/* Add our custom post metabox for social sharing
------------------------------------------------------------ */

/**
 * ctsettings_social_metabox function.
 *
 * Callback function for the CT Settings Social Sharing metabox.
 *
 * @since 1.0.0
 *
 */
function ctsettings_social_metabox() { ?&gt;

	&lt;p&gt;&lt;?php _e( 'Check any of the following if you want Facebook, Twitter or Google+ buttons for your posts.', 'genesis' ); ?&gt;&lt;/p&gt;
	&lt;table class=&quot;form-table ctsettings-social&quot;&gt;
		&lt;tbody&gt;
			&lt;tr valign=&quot;top&quot;&gt;
				&lt;th scope=&quot;row&quot;&gt;
					&lt;input type=&quot;checkbox&quot; name=&quot;&lt;?php echo CTSETTINGS_SETTINGS_FIELD; ?&gt;[ctsettings_facebook_link]&quot; id=&quot;&lt;?php echo CTSETTINGS_SETTINGS_FIELD; ?&gt;[ctsettings_facebook_link]&quot; value=&quot;1&quot; &lt;?php checked( 1, genesis_get_option( 'ctsettings_facebook_link', CTSETTINGS_SETTINGS_FIELD ) ); ?&gt; /&gt; &lt;label for=&quot;&lt;?php echo CTSETTINGS_SETTINGS_FIELD; ?&gt;[ctsettings_facebook_link]&quot;&gt;&lt;?php _e( 'Include a Facebook Like button on your posts?', 'genesis' ); ?&gt;&lt;/label&gt;
				&lt;/th&gt;
			&lt;/tr&gt;
			&lt;tr valign=&quot;top&quot;&gt;
				&lt;th scope=&quot;row&quot;&gt;
					&lt;input type=&quot;checkbox&quot; name=&quot;&lt;?php echo CTSETTINGS_SETTINGS_FIELD; ?&gt;[ctsettings_twitter_link]&quot; id=&quot;&lt;?php echo CTSETTINGS_SETTINGS_FIELD; ?&gt;[ctsettings_twitter_link]&quot; value=&quot;1&quot; &lt;?php checked( 1, genesis_get_option( 'ctsettings_twitter_link', CTSETTINGS_SETTINGS_FIELD ) ); ?&gt; /&gt; &lt;label for=&quot;&lt;?php echo CTSETTINGS_SETTINGS_FIELD; ?&gt;[ctsettings_twitter_link]&quot;&gt;&lt;?php _e( 'Include a Twitter Tweet button on your posts?', 'genesis' ); ?&gt;&lt;/label&gt;
				&lt;/th&gt;
			&lt;/tr&gt;
			&lt;tr valign=&quot;top&quot;&gt;
				&lt;th scope=&quot;row&quot;&gt;
					&lt;input type=&quot;checkbox&quot; name=&quot;&lt;?php echo CTSETTINGS_SETTINGS_FIELD; ?&gt;[ctsettings_google_link]&quot; id=&quot;&lt;?php echo CTSETTINGS_SETTINGS_FIELD; ?&gt;[ctsettings_google_link]&quot; value=&quot;1&quot; &lt;?php checked( 1, genesis_get_option( 'ctsettings_google_link', CTSETTINGS_SETTINGS_FIELD ) ); ?&gt; /&gt; &lt;label for=&quot;&lt;?php echo CTSETTINGS_SETTINGS_FIELD; ?&gt;[ctsettings_google_link]&quot;&gt;&lt;?php _e( 'Include a Google Plus button on your posts?', 'genesis' ); ?&gt;&lt;/label&gt;
				&lt;/th&gt;
			&lt;/tr&gt;
		&lt;/tbody&gt;
	&lt;/table&gt;

&lt;?php }</pre><p>Phew, this is a giant chunk of code, but don&#8217;t be afraid. All we are doing is setting up our input fields to display our options. What is important is that you make sure that the constant <code>CTSETTINGS_SETTINGS_FIELD</code> matches the constant you set at the beginning of the file and the each individual option (such as <code>ctsettings_google_link</code>) matches the default options you set at the beginning of the file. Now, let&#8217;s make our screen one column to mimic how Genesis has its theme options and get our metabox displayed!</p><h3>Setting the Screen to One Column and Displaying Our Options</h3><p>Copy and paste the following function into your file. It will set the screen column to 1 for our options page:</p><pre class="brush: php; title: ; notranslate">/* Set the screen layout to one column
------------------------------------------------------------ */

add_filter( 'screen_layout_columns', 'ctsettings_settings_layout_columns', 10, 2 );
/**
 * ctsettings_settings_layout_columns function.
 *
 * This function sets the column layout to one for the CT Settings settings page.
 *
 * @param mixed $columns
 * @param mixed $screen
 * @return $columns
 *
 * @since 1.0.0
 *
 */
function ctsettings_settings_layout_columns( $columns, $screen ) {
	global $_ctsettings_settings_pagehook;
	if ( $screen == $_ctsettings_settings_pagehook ) {
		$columns[$_ctsettings_settings_pagehook] = 1;
	}
	return $columns;
}</pre><p>Now let&#8217;s display our form and metaboxes, shall we? Copy and paste the following code into your file:</p><pre class="brush: php; title: ; notranslate">/* Build our theme options page
------------------------------------------------------------ */

/**
 * ctsettings_theme_options_page function.
 *
 * This function displays the content for the CT Settings settings page, builds the forms and outputs the metaboxes.
 *
 * @global $_ctsettings_settings_pagehook
 * @global $screen_layout_columns
 *
 * @since 1.0.0
 *
 */
function ctsettings_theme_options_page() {

	global $_ctsettings_settings_pagehook, $screen_layout_columns;
	$width = &quot;width: 99%;&quot;;
	$hide2 = $hide3 = &quot; display: none;&quot;;
	?&gt;

	&lt;div id=&quot;ctsettings&quot; class=&quot;wrap genesis-metaboxes&quot;&gt;
		&lt;form method=&quot;post&quot; action=&quot;options.php&quot;&gt;

			&lt;?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?&gt;
			&lt;?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?&gt;
			&lt;?php settings_fields( CTSETTINGS_SETTINGS_FIELD ); ?&gt;

			&lt;?php screen_icon( 'options-general' ); ?&gt;

			&lt;h2&gt;
				&lt;?php _e( 'CT Settings - Theme Settings', 'genesis' ); ?&gt;
				&lt;input type=&quot;submit&quot; class=&quot;button-primary genesis-h2-button&quot; value=&quot;&lt;?php _e( 'Save Settings', 'genesis' ) ?&gt;&quot; /&gt;
				&lt;input type=&quot;submit&quot; class=&quot;button-highlighted genesis-h2-button&quot; name=&quot;&lt;?php echo CTSETTINGS_SETTINGS_FIELD; ?&gt;[reset]&quot; value=&quot;&lt;?php _e( 'Reset Settings', 'genesis' ); ?&gt;&quot; onclick=&quot;return genesis_confirm('&lt;?php echo esc_js( __( 'Are you sure you want to reset?', 'genesis' ) ); ?&gt;');&quot; /&gt;
			&lt;/h2&gt;

			&lt;div class=&quot;metabox-holder&quot;&gt;
				&lt;div class=&quot;postbox-container&quot; style=&quot;&lt;?php echo $width; ?&gt;&quot;&gt;
					&lt;?php do_meta_boxes( $_ctsettings_settings_pagehook, 'main', null ); ?&gt;
				&lt;/div&gt;
			&lt;/div&gt;

		&lt;/form&gt;
	&lt;/div&gt;
	&lt;script type=&quot;text/javascript&quot;&gt;
		//&lt;![CDATA[
		jQuery(document).ready( function($) {
			// close postboxes that should be closed
			$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
			// postboxes setup
			postboxes.add_postbox_toggles('&lt;?php echo $_ctsettings_settings_pagehook; ?&gt;');
		});
		//]]&gt;
	&lt;/script&gt;

&lt;?php }</pre><p>Finally, we are able to actually display our form. We use the <code>settings_fields</code> function to output our security nonces and forms. We also add our submit/reset buttons to the top of the page. We use the <code>do_meta_boxes</code> function to fire and execute our metaboxes. Finally, we add some jQuery to make sure that our metaboxes toggle and move like they should. Now you can go into your Dashboard, refresh the page and check out your new child them options page! It should look something like this:</p><p><a href="http://cdn.thomasgriffinmedia.com/wp-content/uploads/2011/09/CT-Settings-‹-Test-—-WordPress.png"><img class="aligncenter size-medium wp-image-787" title="CT Settings ‹ Test — WordPress" src="http://cdn.thomasgriffinmedia.com/wp-content/uploads/2011/09/CT-Settings-‹-Test-—-WordPress-300x145.png" alt="" width="300" height="145" /></a></p><p>Now your users can select if they want to have any of these social sharing options displayed on their posts. Now we can create the functions that will conditionally add these social sharing options.</p><h3>Adding in the Functionality to Your Child Theme&#8217;s functions.php File</h3><p>For this tutorial, we are going to hook into the <code>genesis_before_post_content</code> action hook to add our social buttons. There are a wealth of other hooks that you can access, but we will use this one for this tutorial. Copy and paste the following code into your child theme&#8217;s <code>functions.php</code> file:</p><pre class="brush: php; title: ; notranslate">/* Add our social sharing buttons to our theme
------------------------------------------------------------ */

add_action( 'genesis_before_post_content', 'ctsettings_social_sharing_buttons' );
/**
 * ctsettings_social_sharing_buttons function.
 *
 * This function displays social sharing buttons based on the options selected by the user.
 *
 * @since 1.0.0
 *
 */
function ctsettings_social_sharing_buttons() {

	$perm = get_permalink();
	$title = get_the_title();

	if ( genesis_get_option( 'ctsettings_facebook_link', CTSETTINGS_SETTINGS_FIELD ) )
		echo '&lt;div class=&quot;ctsettings-fb-like ctsettings-social-share&quot;&gt;' . '&lt;div id=&quot;fb-root&quot;&gt;&lt;/div&gt;&lt;script src=&quot;http://connect.facebook.net/en_US/all.js#xfbml=1&quot;&gt;&lt;/script&gt;&lt;fb:like href=&quot;'.$perm.'&quot; send=&quot;false&quot; layout=&quot;button_count&quot; width=&quot;120&quot; show_faces=&quot;false&quot; action=&quot;like&quot; font=&quot;lucida grande&quot;&gt;&lt;/fb:like&gt;' . '&lt;/div&gt;';

	if ( genesis_get_option( 'ctsettings_twitter_link', CTSETTINGS_SETTINGS_FIELD ) )
		echo '&lt;div class=&quot;ctsettings-tweet ctsettings-social-share&quot;&gt;' . '&lt;a href=&quot;http://twitter.com/share&quot; class=&quot;twitter-share-button&quot; data-count=&quot;horizontal&quot; data-url=&quot;'.$perm.'&quot; data-text=&quot;'.$title.'&quot;&gt;Tweet&lt;/a&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;http://platform.twitter.com/widgets.js&quot;&gt;&lt;/script&gt;' . '&lt;/div&gt;';

	if ( genesis_get_option( 'ctsettings_google_link', CTSETTINGS_SETTINGS_FIELD ) )
		echo '&lt;div class=&quot;ctsettings-google ctsettings-social-share&quot;&gt;' . '&lt;g:plusone size=&quot;medium&quot; href=&quot;'.$perm.'&quot;&gt;&lt;/g:plusone&gt;&lt;script type=&quot;text/javascript&quot;&gt;
			(function() {
   			var po = document.createElement(&quot;script&quot;); po.type = &quot;text/javascript&quot;; po.async = true;
    		po.src = &quot;https://apis.google.com/js/plusone.js&quot;;
    		var s = document.getElementsByTagName(&quot;script&quot;)[0]; s.parentNode.insertBefore(po, s);
  			})();
		&lt;/script&gt;' . '&lt;/div&gt;';

}</pre><p>All this code is doing is checking to see if our option has been checked. If it has been checked, it display s the appropriate social sharing button. This bit of code also includes div classes so that you can these as needed.</p><p>And there you have it folks! You have no successfully and securely added child theme options to the Genesis Framework! Now go have some fun, tell all your friends and don&#8217;t forget to ask me questions if you have them. <img src='http://cdn.thomasgriffinmedia.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>Once again, here are the source files. <a href="http://cdn.thomasgriffinmedia.com/wp-content/uploads/2011/09/ctsettings.zip">Click on this link to download them now</a>!</p> ]]></content:encoded> <wfw:commentRss>http://thomasgriffinmedia.com/blog/2011/09/how-to-add-child-theme-options-to-the-genesis-framework/feed/</wfw:commentRss> <slash:comments>10</slash:comments> </item> <item><title>How to Automatically Add Meta Boxes to Custom Post Types</title><link>http://thomasgriffinmedia.com/blog/2011/07/how-to-automatically-add-meta-boxes-to-custom-post-types/</link> <comments>http://thomasgriffinmedia.com/blog/2011/07/how-to-automatically-add-meta-boxes-to-custom-post-types/#comments</comments> <pubDate>Wed, 20 Jul 2011 20:36:25 +0000</pubDate> <dc:creator>Thomas Griffin</dc:creator> <category><![CDATA[WordPress Tutorials]]></category> <category><![CDATA[meta boxes]]></category><guid isPermaLink="false">http://thomasgriffinmedia.com/?p=764</guid> <description><![CDATA[Today we will learn how to automatically add meta boxes to custom post types in WordPress. Without modifications, the add_meta_box function only adds your meta box to the post type that you have specified. I will give you the code today that will allow you to add them dynamically to any new custom post types [...]]]></description> <content:encoded><![CDATA[<p><strong>Today we will learn how to automatically add meta boxes to custom post types in WordPress.</strong> Without modifications, the <code>add_meta_box</code> function only adds your meta box to the post type that you have specified. I will give you the code today that will allow you to add them dynamically to any new custom post types that your create. I will also show you the code so that you can skip specific post types if you so desire. Let&#8217;s get started!</p><h3>Setting Up the Function</h3><p>I am going to be assuming you are using WordPress 3.0 or greater. If you are not, you need to update today! <img src='http://cdn.thomasgriffinmedia.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> I&#8217;m not going to go through the data validation process (or input fields) for meta boxes, just the setup that displays the meta box. Here is what a typical setup for this will look like. Place the following code in your theme&#8217;s <code>functions.php</code> file:</p><pre class="brush: php; title: ; notranslate">add_action( 'add_meta_boxes', 'tgm_custom_meta_box' );
/**
 * tgm_custom_meta_box function.
 *
 * This function registers a metabox with the callback tgm_custom_meta_box_callback.
 * For reference: add_meta_box( $id, $title, $callback, $page, $context, $priority, $callback_args );
 *
 */
function tgm_custom_meta_box() {
    add_meta_box( 'meta_id', 'My Custom Meta Box', 'tgm_custom_meta_box_callback', 'post', 'normal', 'high' );
}</pre><p>This is your basic meta box setup. Putting this into your <code>functions.php</code> file will display a meta box for the &#8216;post&#8217; post type up under the Visual Editor with nothing in it (it may contain a warning, but that isn&#8217;t relevant for this tutorial). The limitation to this is that it only adds a meta box to the &#8216;post&#8217; edit screen. Let&#8217;s change up the function tgm<code>_custom_meta_box</code> so that it will automatically add the meta box to each new post type we create, including the default post types of post and page.</p><pre class="brush: php; title: ; notranslate">/**
 * tgm_custom_meta_box function.
 *
 * This is an alternate version of tgm_custom_meta_box. This function adds a metabox to each registered post type in WordPress.
 *
 */
function tgm_custom_meta_box() {
	$post_types = get_post_types();
	foreach ( $post_types as $post_type ) {
    	add_meta_box( 'meta_id', 'My Custom Meta Box', 'tgm_custom_meta_box_callback', $post_type, 'normal', 'high' );
    }
}</pre><p>The <code>$post_types</code> variable uses the <code>get_post_types</code> function to grab all of our post types. Then we simply use a foreach statement to apply this code to each meta box. Viola! This bit of code now automatically adds meta boxes to any new custom post types that you create. Pretty nifty, right?</p><h3>Even More Uses</h3><p>This is pretty cool, but what if you want to specify some post types for the meta boxes not to show up? We can easily do that too. Take a look at the following modification to our function:</p><pre class="brush: php; title: ; notranslate">/**
 * tgm_custom_meta_box function.
 *
 * This function adds a metabox only to custom post types that are set to be viewed as public.
 * This function also passes over the post types 'post' and 'page', meaning that the metabox will not appear on those respective edit screens.
 *
 */
function tgm_custom_meta_box() {
	$post_types = get_post_types( array( 'public' =&gt; true ) );
	foreach ( $post_types as $post_type ) {
		if ( $post_type == 'page' || $post_type =='post' )
			continue;
    	add_meta_box( 'meta_id', 'My Custom Meta Box', 'tgm_custom_meta_box_callback', $post_type, 'normal', 'high' );
    }
}</pre><p>This is a more customized version of this function. First of all, our <code>$post_types</code> variable now has a condition. The <code>$post_types</code> variable will only accept post types that have the public argument set to true. There is a whole slew of arguments you could pass here. Just refer to the <a href="http://codex.wordpress.org/Function_Reference/register_post_type" target="_blank">Codex on custom post types</a> to learn about all the ones you could use.</p><p>Now check out the new &#8220;if&#8221; statement within the foreach construct. This &#8220;if&#8221; statement checks to see if the post type is either &#8216;page&#8217; or &#8216;post&#8217;. If any of the &#8220;if&#8221; arguments are true, then we use continue statement to pass over that post type and go to the next post type (if there are any left in the array). You can add or take away from this as you would like to customize where your meta boxes are displayed.</p><p>And that just about wraps it up! I hope you&#8217;ve enjoyed the tutorial on how to automatically add meta boxes to custom post types. Be sure to tell all your friends! <img src='http://cdn.thomasgriffinmedia.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://thomasgriffinmedia.com/blog/2011/07/how-to-automatically-add-meta-boxes-to-custom-post-types/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>

<!-- W3 Total Cache: Minify debug info:
Engine:             apc
Theme:              34b7c
Template:           index
-->
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching using apc
Object Caching 658/783 objects using apc
Content Delivery Network via cdn.thomasgriffinmedia.com

Served from: thomasgriffinmedia.com @ 2012-04-10 18:48:21 -->
