It’s known and well-published that you can add custom columns to your WordPress admin post overview screen. For instance see this article on the codex.Then you can make this custom column(s) sortable, as described here.
For a recent project I had to make something like that, but including a checkbox with it. By default WordPress will start to sort your columns ascending, from low to high. This checkbox basically has two values, 0 or 1 ( boolean-like ) so starting ascending the posts who were not marked came first, so you had to click twice if you wanted to see tagged posts ( and why sort on a column like that otherwise ).
The solution is a small snippet that’s not really documented:
// second param is sort desc by default
$columns["checkbox_post"] = array(‘featured’,1);
Usually in tutorials the column is defined by $columns[name] => title. By simple making it an array with the second position 1 WordPress will not sort your column descending when you click it first.
A tip I would like to throw out since many people seem to be searching for this. It’s a difficult problem, but here is a (rather dirty) way to use a background color on inline element (like span) and have padding as well. This is a solution when you want text with a background color plus padding – without filling the whole element block .
An inline element doesn’t begin new lines usually. If you ever tried you would see that padding will only apply to the begin and end of this element. If there are line-breaks it doesn’t look pretty. This means limited styling options.
A block element does support padding but you can’t put the background on the text only.
Most problems can be overcome by defining the inline element as a block level element ( or better just use a block element like <div> .
If you can control the output this way, you can put every line output on a different container. This often doesn’t fly with CMS-systems where the system outputs the whole ( as content ).
Better yet, punch the designer who thought of this.
In this specific case you want the best of both worlds and that often doesn’t fly with web design.
Fortunately there is a Jquery plugin by Jeremy Harris which does this after your page loaded. This is important since often it’s not sure how many lines exactly your output will take (especially when the content is dynamic). The plugin splits the lines into seperate containers which you can use to style your padded background on.
This also works if you need to animate or do other tricky stuff with multi-line content.
Another short tip on a site that is remarkably hard to find but very handy: Wikimatrix. I often use wiki’s to store information and short notes to be able to find things back quickly. As always the problem is what wiki software to run. There are literally thousands of options.
On Wikimatrix.org they offer a wizard which will help to narrow down to choices. Besides you can side-by-side compare different wiki’s. Not all wiki’s are that good though ( keep in mind ) but this site will help to narrow down your search.
Today I want to share a short hint on using Skype under Linux which cost me some time to discover. I was having audio when calling but the notifications somehow didn’t work. Which is annoying when being ‘Away from Keyboard’ but expecting some calls.
Continue reading →
I’m happy to announce that the new version of Feedwordpress Advanced Filters has just been released. Yesterday I celebrated the 1000th download from the WordPress plugin directory and what better to way to celebrate then releasing a new and better-than-ever version?
The last month I spend when I had time to test various functions of the plugin, especially the rather complex image filters. This means most filters have undergone some changes to make them more robust and less likely to fail with strange inputs.
Included in this release of Feedwordpress Advanced Filters is the ability to add enclosure images from your feed to your local WordPress installation. Also new is the (beta) release of the link filter. You can set external links easily to target=_blank for opening in a new window. Plus a very simple rewrite function which allows you to set URLs to some local script.
Also showing the growth of Feedwordpress Advanced Filters are the emerging of user-built filters around, like this simple filter using regular expressions to remove certain parts of the content, by Frank Mahon. If you made a custom filter please share with us to built a wide feature-set of FAF!
For the near future I will be concentrating on making the image filters use the PHP DOM model instead of the regular expression clutter now used for retrieving images. This will also allow for a bunch of new features.
The new link filter already works this way. I’m really curious whether this method works on all servers around there. You can help me by providing reports!
Talking about the link filter. I’m curious to which Link trackers are widely used around the globe for tracking outbound links. Let me know by commenting ( or otherwise ) and I might support the plugin for tracking URLs.
If you are already happy with Feedwordpress Advanced Filters help by spreading the word and of course rating ( or reviewing ) my plugin to help justify to spend more time on FAF ^^
Last, if you have a great idea I should incorporate into the plugin, just let me know. I’m keen to add new features.
Today I will be releasing a new version of Feedwordpress Advanced Filters, version 0.5.9. Yes, it’s really close to number 0.6 and initially I was hoping I wouldn’t have to include another release before that, but I have encountered lately a number of important bugs that needed fixing.
Most important fix is that in a number of circumstances posts would filter normally when called manually, but would fail when a cron was doing the updating. Another important one is the category keyword filter that would fail when multiple keywords where being used.
Apart from that I can announce a few new cool things in Feedwordpress Advanced Filters. On request ( I was pointed in this way by a comment on this blog, thanks! ) it’s now possible to add images from your feed to the WordPress ‘Featured Image’ functionality. It’s now also possible to exclude several images from processing or remove them.
To prevent serious bugs from roaring their ugly heads in the feature I’m setting up a Unit Testing infrastructure which I hope will guard the quality of the plugin.
Give your feeds and feedback
Parsing feeds is often a struggle between not being able to control what the input is like ( and often including a lot of garbage ) and needing your output to be perfect. Myself I’m testing with various mutilated feeds to ensure even exceptions are not a breaking point for Feedwordpress Advanced Filters.
Help development by reporting weird occurrences, feeds that might not break things and of course if you have cool ideas about what should be included in the plugin; you are more than welcome.
Just another quick tip but might be useful for you, lazy web developers, out there. Recently I needed to clean CSS stylesheets for one of my projects which has a theme from years ago ( 2007 or 2008 ) and needless to say many changes where done since.
I didn’t want to manually try half of the selectors and see if it would change anything somehow so I started to look for some online tools to do this tasks. There are quite a few but in the end I went for a Firebug extension called ‘ Dust-me selectors‘.
The way it works is quite inventive. Instead of trying to scan and parse your pages you can simply select ‘scan’ and click around your site. Every selector encountered is listed as ‘used’ so in the end you end up with a list of unused selectors which you can export to another file.
If you have a very polluted stylesheet you can just replace to old one (backup!) with the new one and start working from there by deleting the UNUSED tags Dust Me creates and rebuilding whatever needed to be done anyway. In my case I just a diff tool to just for differences and work my way through the stylesheet in this matter.
Hint: If you are scanning your pages be sure to click through every possible page. Especially unfolding menu’s and selectors like a:hover, a:visited are sometimes ‘forgotten’ while being in use.
Dust-me selectors is not a magic stick which will output very clean CSS just by the click of a button but is a very useful tool to help you in cleaning CSS stylesheets in an organized way.
I already posted earlier that Feedwordpress Advanced Filters now supports the possibility to add your own custom filters.
One of the core features of FAF has always been to be able to easily extend the feature set. With the most recent version it’s easy to drop your own filter into FAF. This post will also serve as the beginning of some public documentation.
Warning! After this it will get a bit technical
Continue reading →