This is a brief intro to using WordPressSharp to publish a post with C# via the WordPress XML-RPC API.
A few notes… the ‘PostType’ property of the Post class can be set to either “post” or “page” depending on which WordPress type you want to publish. And the ‘Status’ property can be set to either “publish” or “draft” depending on whether you want to publish your new post/page right away or not. In the future I’d like to make these enums or something extendable. But WordPress has them as strings so you can define new ones (ie Custom Post Types) on your own.
Keep in mind this class is merely a simple example. In most cases you might want this in a service layer where you can inject the WordPressSiteConfig class as you need it.
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.
Get more information and let me know you are interested
Featured Image via Heisenberg Media
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
Fork On Github
WordPress Plugin Page
Stackoverflow: jQuery Selector Regular Expressions
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.
Enough of the boring stuff, here’s the code.. And here’s the demo in action using JSON data from the Donor’s Choose 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.
Fork on Github
Have an issue? Report on Github