Today I was building a list of links on a WordPress site using wp_list_bookmarks. I wanted to create a comma-separated list such that each link title would have a link after it. No problem.
Except….the final link also has a comma after it. The result looks like this:
link 1, link 2, link 3, link 4,
I want it to look like this (with no trailing comma):
link 1, link 2, link 3, link 4
To accomplish this, I used a few php functions as follows:
'',
'after' => ', ',
'echo' => '0';
?>
Notice that in the $args array, I add a comma after each link. Then in the final echo line, I remove the trailing comma.
Pretty cool, eh!
Do you know of a better way to do this?
SOURCE: I found this solution on the WordPress.org forums, but I lost the link. Sorry!
More posts from themightymo.com
New WhereAmIWearing.com, WordPress Site, is Rolling!
I am excited and proud to have contributed my WordPress skillz to the legendary Rule29 web shop with the new Where Am I Wearing? website! The site is built on the WordPress framework and features just about every cool widget that you can imagine. I was responsible for translating the design into code and had…
Notes from “Getting the Pretty Stuff In” Presentation at Flashbelt with Paul Burnett
Photoshop Take a bunch of photos of the exterior of a building 1) Select all the photos 2) Tools –> Open into Layers 3) “Auto-align” the layers 4) (with all of the layers selected) Layer –> Smart Objects –> Convert to smart object 5) Layer –> Smart objects –> Stack mode –> Median To stitch…
TheMightyMoo! Theme Updated! (Version 1.2.5)
Hello! I am pleased to let you know that I have updated TheMightyMoo! WordPress theme. Download it here. The most recent update: deletes the “wp_query” function that was accidentally left in the last release. This was causing some of your installs to totally not work. Sorry about that. Many thanks to Paulo for pointing this…