While designing a new theme for a client a problem came up that has come up before. Making a horizontal area a widgetized area, ie the header area next to a logo. This could also be in the footer of a theme. Instead of hardcoded the widths of each widget and making the layout static, I decided to make it have dynamic widths. By dynamic I’m not just talking about using percentage widths, but making the widths dependent on how many widgets are added to the area. Luckily WordPress has a handy function that will give counts of all the widgets currently active and in which area they are active. The documentation on the function is quite sparse wp_get_sidebars_widgets Continue reading
Making Theme Widget Areas More Dynamic
Google Maps API
In a recent project it was asked to provide a Google map on a number of pages. It would have been too time consuming to create a custom map and manually place the code on each page. Instead using the Google Maps API was a better choice because the address could be pulled from a custom field in the post and used to create the map. With the code below adding a Google Map is simple.
The first step is signing up for a API key, as with most Google products is free and only requires a Google account. After you’ve received your key, you can then edit the functions.php file of your current theme. The below code has some key spots to take note of and maybe change some values. I will highlight these after the full code.
WordPress Self-Hosted Plugin Update API
Have a plugin that can’t be submitted to the official repository?
Code is now on GitHub please see here for updated version.
Many reasons exist but the biggest is that the plugin/support is sold therefore can’t be downloaded for free. But why should the end user be punished after all they bought the plugin and updates should be just as seamless as from the official repo. With this script this can be accomplished. Examples and a package of sample code can be downloaded below.
WordPress Theme Developers Tip – Theme Update Noticifications
While doing some work for a client, they were wanting to tie into the update notifications that a user gets when a theme has an updated version in the WordPress theme directory. The catch is this was a premium theme that was being sold so couldn’t be submitted to the directory. While not as robust as the WordPress update system it doesn’t need to be most premium themes require you to log in to download updates. So a simple notification was sufficient. Please read more to see code and explanations. Continue reading
Summer Time Rush
Summer time is a busy time for me at work and updates will be sparse but I will still be answering questions on the support forum. Please stay tuned for updates. If you’d like please subscribe to my RSS feed for updates.
