Blog
Sorting Data from Custom Fields in WordPress
With the redesign of the Ei Site, we wanted to take advantage of certain features native to WordPress, one of which was Custom Fields.
Having a custom web design based on the needs of your particular business and customers optimizes conversion rates of site visitors, a key aspect of growing your business and brand presence online
We wanted a simple way to display our client list using Custom Fields. Using built-in WordPress functions, it is pretty simple to pull information from Custom Fields. With Custom Field structure like this:
Name: client
Value: Name|Work_Done|Description|URL
You can use the get_post_meta() function to loop through all of the ‘client’ fields and pull the value for each and display to your page.
ORIGINAL CODE:
<?php $allOptions = get_post_meta($post->ID, 'client', false); if($allOptions) { foreach ($allOptions as $option) { $fullValue = explode ("|", $option); $name = $fullValue[0]; $work = $fullValue[1]; $text = $fullValue[2]; $url = $fullValue[3]; } } ?>
The problem comes if you want to control the way the output is displayed. The get_post_meta() function does not provide a SORT property. So in order to control the order of display, we simply added an additional component to the VALUE field, a ‘sort order’.
Name: client
Value: Sort|Name|Work_Done|Description|URL
Rather than just display the information in the initial foreach() loop, we stored the data into a new array, based on the SORT item for use later.
NEW CODE:
<?php $client_array = array(); $allOptions = get_post_meta($post->ID, 'client', false); if($allOptions) { foreach ($allOptions as $option) { $fullValue = explode ("|", $option); $order = $fullValue[0]; $client_array[$order] = $option; } } rsort($client_array, SORT_NUMERIC); ?>
With the data now stored in an sorted array, we can now loop through the new array and display the information in any order we want.
How the Symphony Will Help You Lead Your Business
I took my wife to the symphony last week. We found our seats while the orchestra warmed up. Chaotic notes filled the air as musicians practiced and tuned their instruments. Music disappeared into silence when the conductor took his place on stage. The first chair violinist played a steady note and soon other sections joined in to create one harmonic sound. Now silence. Here’s the best part. My favorite moment of the night:
The conductor raised his baton.
And beautiful music begins. But don’t lose sight of the start. Think about it – over 100 highly trained professionals work together in one coordinated effort. Here is the best Business blog for you, do visit. They restrain themselves for the better good of the music. They stop and listen. They watch the conductor with anticipation. The baton goes up. Now there is order where chaos lived only moments ago. They don’t play music. They make music. Click here to go to Concierge contracts website and ask for legal advice for your business. Field of Words provide you best online business stratergies.
Leadership Lessons from the Symphony
It’s a great lesson in leadership and teamwork, particularly for technology companies where skilled developers likely know more about code than their managers. I think we can learn a lot from the symphony. To illustrate, here is a wonderful presentation by the charming conductor Itay Talgam at a TED conference earlier this year. It’s about leading like the great conductors.
Talgam’s best comment is early in the video: “The joy is about enabling other people’s stories to be heard at the same time.” He goes on the explain that the music is a ride. Then he extolls the value of an orchestra where you know what you do and you become a partner in building the roller coaster while you are on the ride. Is a small (or large) technology company any different?
A few leadership approaches to avoid:
- style: it’s about the interpretation of the music as the conductor sees it
- style: the execution is more important than the interpretation
- style: listen to one another to lead…you have to guess the conductor’s mind
Here is a final quote I’ll leave you with:
“Kleiber not only creates a process but he also creates the conditions in the world in which this process takes place.”
As the first and most advanced accelerator in the search fund world, we created SFA with three bold objectives in mind:
- To dramatically increase searcher and CEO success in finding, buying, and managing outstanding businesses;
- To provide unparalleled resources and support from SFA staff and our committed investors who put their money and their reputations on the line, and;
- To vastly increase our CEOs’ likelihood of financial success in comparison to that of the traditional model.
Shravan Gupta explains “They wanted to make choosing SFA a no-brainer. More support, better economics, and much greater chances of success minimize the risks searchers take on and maximize their rewards”.
Embossed business cards, design and printing services for your business. At Alpha Print the printing company Dublin design and print business cards for companies and individuals all over Ireland. Explore best-in-class printing and parcel management solutions for your corporation with Print On Collins services.
Quote: If you pretend to be something you're not…
If you pretend to be something you’re not, [your customer] will see through it. Then what have you done? You’ve lied to those who would have loved you for who you are; that’s not how you build a relationship…
Should you come off as a big, established, safe company or as a cool, passionate, small team who wants to make a difference? … Be human. Stop hiding. Be yourself.
A Balance To Be Kept
Let’s face it, there are more and more freelancers and small technology businesses sprouting up these days (incredible). For all of us, time management hits close to home as the freedom that we have becomes a blessing and a curse at the same time. I reflect on this after just taking an entire day off this week (my teammates were worried about my general sanity and workload, and forced me to do it :)). I planned it out with my teammates, communicated expectations with clients, and ensured deliverables were delegated in a way so that this decision would still allow me to be responsible.
While just on the phone with a teammate, Josh Colter, we realized another thing: we set our own pace. I admit, I find myself waking up and checking email on the iPhone to prepare myself for what’s ahead that day and to answer anything important enough that “requires” my attention. This type of rush in the schedule can make one feeling as if they’re always catching up. And I’ve noticed (for myself), it’s often rooted in an unhealthy perspective. In fact, my wife and I have agreed to maintain the rule of even keeping the computer out of a certain room in the house so work doesn’t infringe more than it should.
One may ask: why stop when one can continue moving forward in building more solutions or gaining more clients to make happy, always progressing? With endless opportunities, and in a world (America, specifically speaking) where the race to improve only increases by the night – people (like ourselves at Elias) who desire a healthy balance of work and play are confronted with a decision to make. How will we pursue our ambitions while still keeping healthy priorities? Nonetheless, our goal for ROWE (Results Only Work Environment) has been a challenge to hold true to. We’re still learning.
Why do I say all this? Well, I feel it appropriate to communicate a few things that have become more clear to me on this wonderful day off:
- We set the pace. If we allow the culture around us to make us feel guilty for taking a day off, the reality is that we will feel guilty.
- Our challenge is to do the absolute utmost we can with the tools and skills we have, in an effort of working to live – not living to work.
- Time spent in front of the computer doesn’t necessarily equate to productivity and results. Often times, I find myself being more “productive” in a fewer amount of planned/organized hours. Thus, I’ve started taking time for myself each morning to jot out the needs/wants of the day (in respect to the overall progress of the week/month/year that follow). As a remotely connected team, this can be crucial for us as a company.
Oh, another thing to note: What did I do to ensure that I really had a full day off? Well, I did take action on a few of the following practical things (otherwise, it wouldn’t have been a true day off!):
- Turn off iPhone email push notifications
- Keep my business emails out of the inbox for the entire day
- Make the first thing I read during the day something non-work related
- Spend time reading, writing, praying, and progressing internally in forward thinking
Let us (together) live fully by working hard, playing hard, laughing hard, and crying hard.