If you are in Central Iowa and love WordPress – please let me know if you’d like to attend a monthly user group. I am currently organizing an early 2015 launch – gathering interest and getting some direction from other user group organizers.
On a recent WordPress project I had a requirement that any files be opened in a new tab or window. Now this can be easily accomplished by the users when they create the post or page by linking to the file and marking the checkbox “Open Link In A New Window/Tab”. But we all know users can’t be trusted so in order to “double check” them I wrote a WordPress plugin that will hunt the page for anchor tags that link to something with a file extension, and simply add “target=’_blank'” to them.
Basically all the plugin does is enqueue a jQuery script that does the work. I got the idea to use the jQuery .filter() method from @nickf and the regular expression (because I suck at them) from @már-Örlygsson.
jQuery Open Files In New Tab Or Window
Links and References
Data Tables makes it super easy to add pagination, searching, and sorting to tabular data bound with KnockoutJS
TL;DR: DataTables provides simple pagination, sorting, and searching capabilties to tabular data bound with KnockoutJS – DEMO
So I was working on a WordPress plugin that pulled data from a SQL Server database via ASP.Net Web API and was using KnockoutJS to make the binding super easy. This worked great and was surprisingly simple to accomplish. However some of the data that was coming back was over 1,000 rows. This obviously didn’t look great to the users and was not really practical nor usable.
So I started down the path of handling paging at the API level and passing the page as a parameter… Yada Yada Yada you’ve been there.
But then I found DataTables … an excellent table plugin for jQuery.
Hey I need that!
DataTables provides extremely simple pagination, searching, sorting and more functionality to any HTML table. So in order to get this to work you can use the declarative foreach feature of Knockout to build out your table with the JSON data coming back from your API.
Everyone loves Gravity Forms and everyone loves Bootstrap. But they don’t look too good when combined. So I set out to find a nice way to combine the two. After some Googling around I came across Devin Walker’s gist to apply Bootstrap styles to Gravity Forms. After a few tweaks using that I decided to package it up in to a WordPress plugin.
To accomplish this I modified Devin’s CSS and then properly enqueue the style into the WordPress theme with the plugin. Pretty straightforward.
- Install and enable the plugin via Dashboard or download
- In Gravity Forms Settings, turn off “Output CSS”
- In Gravity Forms Settings, turn on “Output HTML5″
- Done! Have a beer.
I’m working on a massive WordPress migration project and after we defined taxonomies they needed to be changed or updated. I tried doing this with SQL but that turned into an Inner Join nightmare due to how taxonomies are related to posts in the database. This script also comes in handy if you want to run mass updates to add all posts to a new category. When you are dealing with thousands of pages doing this manually in the WordPress admin becomes tedious.
So, you can drop these handy little scripts in your theme’s functions.php file for one time updates. These work for posts, pages, custom post types along with categories, tags, and custom taxonomies.
Apply Category To All Posts
Swap All Pages From One Custom Taxonomy Category To Another
This is one of the main reasons I wrote this script. We had hundreds of miss-classified pages in our custom taxonomy and I wanted to swap everything categorized as “News Releases” to another category called “Featured”. As mentioned above
Hopefully this saves you some time. Let me know in the comments if you have any questions.