• Home
  • Contact Me
  • Forum
  • Podcast
WordPress Tavern
Where Every Drink Is On The House
Browse: Home / php
Plugin And Theme Devs Have Reason To Celebrate

Plugin And Theme Devs Have Reason To Celebrate

By Jeffro on July 27, 2010

A topic of discussion that’s popped up numerous times within the WP Hackers Mailing List as well as other places throughout the community is when WordPress would stop supporting PHP version 4 and move up to version 5. Well, the good news for all WordPress theme and plugin developers is here in that starting with WordPress 3.2 scheduled for release sometime in the first half of 2011, the minimum required PHP version will be 5.2 while MySQL will be raised to 5.0.15. Mark Jaquith explained on the WordPress development blog why the time was right to finally make the move:

The numbers are now, finally, strongly in favor of this move. Only around 11 percent of WordPress installs are running on a PHP version below 5.2. Many of them are on hosts who support PHP 5.2 — users merely need to change a setting in their hosting control panel to activate it. We believe that percentage will only go down over the rest of the year as hosting providers realize that to support the newest versions of WordPress (or Drupal, or Joomla), they’re going to have to pull the trigger.

Just for the sake of knowing, WPTavern.com is running on a shared webhosting server running PHP 5.2.4.

Posted in News | Tagged mysql, php, Plugins, Themes | 12 Responses

Even A Widgetifyr Stumps Me

Even A Widgetifyr Stumps Me

By Jeffro on May 22, 2009

widgetifyrlogo

A few days ago, Glenn Bennett got in touch with me to let me know about a site called Widgetifyr.com. This site is a service which aims at making the WordPress widget creation process much easier than creating the code from scratch every time.

If you’ve ever tried to turn your code into a wordpress plugin (which is how WordPress widgets get installed) you know it can get a bit tedious. Our service lets you just paste your code into a form along with some addition information and we “magically” turn it into a WordPress Plugin that allows your widget to be used in WordPress.

Immediately I thought this was a cool idea. So I took it for a test drive to see if I could create a widget using a regular WordPress function such as get_posts. As it turns out, even a widget generator can stump me.

creatingthewidget

The way this works is that you create a plugin file which you can download at the end, upload it to your plugins folder, activate it and then use the widget. So the first part of the process deals with the basic plugin stuff such as the name, version, author, etc. At the bottom of this page is the important part. This is where you name your PHP Function Name. In the text area, you’re supposed to paste your PHP code which would reside between the brackets. Here is what mine looked like.

phpfunctionname

I used this code from the example shown on the codex related to this function. Once that was done, I clicked on the create button which takes the function, wraps it with the widget code and then gives me the chance to view the code in a txt editor to copy, paste in my favorite editor and than save that file as get_posts.php. I then uploaded this file to my plugins folder. Upon activation, I was greeted with a fatal error:

Parse error: syntax error, unexpected ‘}’ in public_html/wptavern/wp-content/plugins/get_posts.php.php on line 33

Here is line 33.

line33

I received this error anytime I tried to activate a plugin I created. I’m not sure what I did wrong but after looking through the widgetifyr help page, to get a gist as to what the widget code is supposed to look like, and it’s obvious that you need to have a little PHP experience in order to really use this tool to its fullest potential.

The more I tinkered with the site, the more I realized that Otto’s Executable PHP Widget is a much easier, speedier solution for me. With this plugin, I can create widgets without having to worry about HTML or echoing anything. Here is one example of how I use this plugin.

widgetinaction

No copying of code, no uploading, and it just works (as long as I put the function in correctly). If you’re a coder, let me know if the service makes it easier for you to create widgets. As for myself, I’ll stick with a Otto’s solution.

Posted in WordPress | Tagged code, generator, php, widgets | 5 Responses

© Copyright WPTavern 2012 All rights reserved About / Stats / Poll Archive / Site Archive // Powered by WordPress Mtn. Dew And Hybrid