Home » Experts Only » WordPress Experts: Getting Slug by Single_Cat_Title

WordPress Experts: Getting Slug by Single_Cat_Title

An interesting problem that I came across in a recent project. The client needed a custom post taxonomy set to a gallery of choices on a featured section of their website. First we needed to add custom post types and category images plugins. Iterating through the taxonomy was a cinch but at one point I noticed that a few categories were not linking correctly. This is because we weren’t using the taxonomy’s slug but rather the name. After some searching we found this great little workaround to nail down the proper link. Slugs to the rescue!


 $cat = get_term_by('name', single_cat_title('',false), 'category');

 echo $cat->slug; 

 

http://codex.wordpress.org/Function_Reference/get_term_by

Perfect. Custom post types is a powerful tool but we’ve found a lot of weakness in terms of developing relationships between custom posts. Primarily when using CRUD – developing robust database relationships with WordPress is kind of a pain, not really there yet to replace the other options out there. I think this is because too many plugins and toolsets are gearing toward the idea of “no programming needed”  being a good selling point. Personally, it seems that just making programming easier would be the better option, rather than making a comprehensive alternative to programming. If you don’t know how to program, should you be programming at all?

More Web Design Blog Content

What is Lorem Ipsum?

Lorem ipsum is simply Latin text. Gobbledygook, essentially. Well, not really; It does have its roots in latin text from just before the BC to BCE line, so that puts it around 2000 years old. Past that, it’s gibberish.  Sometimes web developers need filler text to create web

Come On Folks, It’s All About Site Structure, Still!

I like what Jeff Bezos said about your margin being his opportunity. In the same way, for other SEO companies out there, your inattention to site structure is our opportunity. We just wish your clients didn’t have to suffer through it before they come to us to get

Digital Worlds

Just finished up a long term project with Digital Worlds at the University of Florida in Gainesville. This web design project intends to reach young audiences with compelling content. It is a place for them to upload videos, share, collaborate and get insights into problems and issues that

Not All Backlinks Are Created Equal

Improving SEO Results with Link Building. Still trying to get higher SERP (Search Engine Results Page) placement? After months of trying is your company no higher on Google or Bing than before you concentrated on SEO keywords? The lack of results from your efforts may leave you confused

Best Seagate Barracuda Internal Hard Drive 4TB SATA

An Internal Hard Drive With Endless Storage and Impressive Speed. If you require vast data storage while not sacrificing speed, look no further than the Seagate’s Barracuda Internal Hard Drive Model ST4000DM004! With 4 terabytes of reliable storage you can store business documents, videos, pictures, games and movies