Quick WordPress Tip – Building your own shortcode

Wordpress Logo

Wordpress LogoThis is a bit of a break from my normal blogging, but I felt like sharing a quick self-hosted wordpress tip that others might find useful.

In my regular Foto Friday posts, I have a section of content that I copy and paste into each post that points readers to other areas to find my photograph on the web as well as ways to help me with my addiction habit of photography.

The text is:

See more photos in my flickr photostream and/or my 500px portfolio. If you like my photography, feel free to support my addiction habit by visiting Adorama (affiliate link) to purchase new or used photographic gear. Or, if you are interested in renting gear before buying, try out my favorite camera, lens and gear rental site –  Borrowlenses.com (affiliate link) – the folks at Borrowlenses are awesome.  All proceeds from clicking the above affiliate links go to more photographs. 

For each Foto Friday post, I would go back to the previous post and copy the text and then paste it into the new post. While not difficult, this was getting to be a chore for me….and I started wondering how to make it more automated.

I’ve built themes and custom functions for WordPress before so I knew about shortcodes….but hadn’t really used a shortcode for just adding text before…but I figured it would work just fine….and it did.

This is a fairly easy thing to do for those of you who are technically inclined.  All you need to be able to do this yourself is a self-hosted version of WordPress and access to your theme’s “functions.php” file – and some basic HTML (and perhaps PHP) knowledge.

Building a Custom Shortcode

I found my theme’s functions.php file a pulled it off my server to edit it.  Using Notepad++ (create free editor for Windows), I added the following lines:

[sourcecode language=”html”]
/* Add shortcode */
add_shortcode(‘phototext’, ‘addPhotoText’);
[/sourcecode]
The above is the definition of the shortcode text to use. In the add_shortcode function, the first field ‘phototext’ is my actual shortcode text that I want to use in each post. The second field ‘addPhotoText’ is the name of the function that should be run whenever the shortcode ‘phototext’ is found. Pretty simple so far, no?

Now…the code below is the actual ‘addPhotoText’ function. The only thing I want this function to do is insert the HTML code listed below into a post whenever the ‘phototext’ shortcode is found.

[sourcecode language=”html”]
/* Function for added shortcode */
function addPhotoText() {
return ‘
See more photos in <a href="http://www.flickr.com/photos/ericbrown">my flickr photostream</a> and/or my <a href="http://500px.com/ericbrown">500px portfolio</a>. If you like my <a href="https://ericbrown.com/photography">photography</a>, feel free to support my <del>addiction</del> habit by visiting <a href="http://www.adorama.com?kbid=65146">Adorama</a> (affiliate link) to purchase new or used photographic gear. Or, if you are interested in renting gear before buying, try out my favorite camera, lens and gear rental site – <a href="http://www.borrowlenses.com/?blpid=photographyminute">Borrowlenses.com</a> (affiliate link) – the folks at Borrowlenses are awesome. All proceeds from clicking the above affiliate links go to more photographs.
‘;
}
[/sourcecode]

Once the above shortcode and function have been added to the functions.php file, I uploaded the file to my test server to make sure i didn’t fat-finger something. Once the new shortcode was confirmed to work, I moved it over here to my blog.

So now…anytime i type my shortcode phototext wrapped in brackets (a shortcode is wrapped in brakcets – e.g., [shortcode]), I’ll get the following added to any post/page:

See more photos in my 500px portfolio. If you like my photography, feel free to support my addiction habit by purchasing a copy for your wall and/or visiting Amazon (affiliate link) to purchase new or used photographic gear.

Shortcodes make life much easier for WordPress users. If you have some content that you like to re-use (author bio, etc), take a look at using shortcodes…they may save you time.

BTW – If you have any questions about WordPress, shortcodes or anything else, drop me a line and I’ll see what I can do to help.

It’s a blog-birthday!

Birthday Cake By Will Clayton on flickrJuly marks the 5th year of existance of this blog.

On July 14 2006 I pushed ‘publish’ on my first post.  That post – titled The Strategic Use of Human Resources – was an excerpt from a paper I wrote for one my MBA classes.

The blog has come a long way since that first post.   I’ve published 761 posts on all sorts of topics…but some of the ones I’m most proud of have fallen into the “New CIO” category that I started in 2009.  Seems like more folks are really starting to talk about the new role of the CIO and the IT group.

A few examples from this category:

Funny that 3 out of the above 4 posts are posts that use stories to get an idea across to the reader…maybe I need more of those.

Thanks for reading….It’s been a fun five years…looking forward to seeing you around here for many more years go come.

Image Credit: Birthday Cake By Will Clayton on flickr

Taking things for granted

As I write this, I’m sitting on my couch at the house trying to watch a rerun of The Office and trying to relax a bit….but my attempt at a quiet relaxing time on the couch is interrupted by the sound of a mower outside.  Thursday is when our lawn service comes to tend to the yard…and they’ve picked this particular time to come to the house.

There’s some extremely loud sounds out there. A Mower.  An Edger. A Blower.

Why can’t these guys hush it….I’m trying to relax dangit. All I really wanna do is spend some time with some  relative piece and quiet.

I get pretty upset….why can’t these guys do this earlier in the day?  Why choose now?  As I try to filter out all the noise I consider sending a fairly scathing email to the owner of the lawn company.

Then…I realize how wrong this is.

Here I am….sitting on my couch in a nice air conditioned home.  While I sit, there’s some underpaid, extremely under-appreciated guys outside mowing my yard for me….while I sit on my butt being angry at a little interruption and noise.

Geez…talk about taking things for granted.

I pay a relatively small fee to have these guys do this work for me….their effort saves me from having to do the work – and I’m extremely thankful for that during the 100 degree weather during the Texas summers.

And of course….I immediately started thinking about all those other people that I’ve taken for granted. Of course…there are plenty of people that I’m sure I’ve taken for granted in my life…parents, family, friends, colleagues- the list goes on and on.

We all take people for granted, don’t we? I think its part of being a human…we all forget how important others are and how grateful we should be for those people.

Now…before I go off the deep end into a land of mushy-ness, let me take a step back into the world of business.

Who do you take for granted in your organization?

Is it the janitor?  The security guard and/or team?

What about your sales team or your customer service organization?

What about your IT staff / team? Do you take them for granted?

Would your organization run without them?  Would you be able to ‘keep the lights on’ without your IT operations team?  Would you be able to sell the next ‘widget’ without the web/server team?

I know many organizations that have taken their IT group for granted. Many in the organization talk about the IT staff as though they are somehow less important than other folks. Many make fun of the IT professionals…and normally, the IT staff gives just as good as they get.

Often times, those same IT pro’s take many other teams/groups for granted as well. They look at requests for new technology or services with disdain because ‘those’ people don’t understand technology.   Stop thinking about ‘those’ people…you all work for the same company, right?

Whether at home or at work, let’s stop taking people for granted.

Start looking at your colleagues as the people they are rather than the position they hold…you may be amazed at how much less you take their work for granted.

Valuable Content Awards Winners Announced for May

Valuable Content AwardEarlier this month I saw an announcement from one of my favorite blogs – Trust Matters, written by Trusted Advisor Associates – about being selected as a “Valuable Content Award Winner” for the month of April.   I love seeing good content and good people rewarded for their efforts.

Prior to that post, I hadn’t heard of this award so I decided to check them out.  Great program and great idea – especially since content is so important today.

Well…turns out they had an option for bloggers to submit their own blogs for consideration – and i did just that. And….thankfully, I was included in the just announced May Valuable Content Award Winners.

According to the award page, to win an award your website must:

… be packed with helpful, authentic content, written with passion, presented with the user in mind. We only verify sites that we believe are genuinely useful to web users.

The winners for May were just announced. They are:

  • David Baker of Recourses – rewarding his long held belief in giving away great content to help marketing firms, and particularly for his excellent podcasts and 65 ‘Position Papers’ – www.recourses.com
  • Swimtrek – for their generous monthly newsletter. The perfect balance of tips, photography, news and holiday details – everything us wild swimmers need to keep Swimtrek front of mind – www.swimtrek.com
  • Lee Duncan, the ‘Double Your Business’ coach for the two useful free downloads on his website. These have got him leads, clients and even a book deal! Look out for his book in 2012. www.leeduncan.com
  • Sims Wyeth, for his articles and resources on presentation skills, giving away some of his knowledge to help people become accomplished speakers. We’re learning. – www.simswyeth.com
  • Eric Brown – a technology consultant, for his clearly designed, well written blog. We can see why it helps turn potential clients into real ones (thats me…woot!)

I’m thankful to be included.  See the list of winners for May as well as previous winners here.

Jump over and learn more about the other May winners as well as previous month’s winners.  Hopefully I can keep the valuable content coming!

My predicitions for 2011 – more of the same

2011 By uniquefrequency on flickr

2011 By uniquefrequency on flickr

A few weeks ago, I was asked by the folks over at InfoBOOM to provide my predictions for 2011 for technology, business and IT.

After receiving that request, but not because of it, I decided to leave the ‘expert’ program at infoBOOM.  I’ve just got too much going on right now to be able to give the infoBOOM site/community the focus it needs.

That said, I wanted to share my predictions for 2011 for the technology, marketing and IT space.

The predictions are:

  1. Things will change.
  2. Most IT professionals want to change, but are stuck in an unchanging process driven world.
  3. Most CIO’s and IT leaders want to do what’s best for the organization but are so busy trying to just ‘keep the lights on’, that they aren’t able to help innovate.
  4. The year will end with people complaining about IT’s inability to deliver value and things will change more.

Sound’s like every other year, doesn’t it?

I’d love for these predictions to be untrue but, in most organizations, they’ll be as true in 2011 as they were in 2010.

CIO’s, IT leaders and professionals – surprise me in 2011. I’d love to be wrong.

Three words for 2011

2011 By smemon87 on flickr

2011 By smemon87 on flickr

As I’ve done for the past two years (see my 3 words for 2009 and 3 words for 2010), its time to share my three words for 2011.  I got the idea for this from Chris Brogan a few years ago…not sure if he started it but I liked it and have been using it since.

My three words for 2010 were: Create, Build and Engage.

2010 saw some fairly major changes for me. I left the Boy Scouts of America in March and have no regrets about that decision.  Much of my 2010 words were built around my role at the BSA…but I continued with the ideas behind those words for the remainder of the year.

How’d I do for the year?  So-so…I’ve created some things, built some things and engaged a bit.  I’m not happy with some of the progress I’ve made but I’ll take it.

So, for 2011, my words are:

  • Create – I’ve brought this one back, for the third year.  I believe so strongly in creating something new that I plan to focus on creating again for 2011.    For 2011, I’m going to be creating in all areas of my life. Creating new ideas, new knowledge, new business and new opportunities.
  • Completion – 2011 will be the year I complete the greatest portion of my dissertation. I’m not sure I’ll finish the dissertation completely due to the overwhelming amount of work to be done, but I’m going to get the research complete during 2011.  I will be striving to complete the dissertation fully this year but won’t be disappointed if it flows into 2012, which is the scheduled completion date according to my plan of study.
  • Foundation – 2011 will be the foundation year for the future.  With the completion of my doctorate in 2011, I’ll be looking to the future. I know exactly where I want to be in 3 years and 2011 will be the year that I set the foundation in place to start moving toward that ultimate 2013 goal.  More on that goal in the future 🙂