Archive for October, 2011

A great quote

I just stumbled across this quote tonight and felt it was pretty relevant to me.

It does not do to dwell on dreams, and forget to live.

Re-enforces my earlier post, that work should co-incide with life, not dictate it.

To be happy with both, you must strike a balance.

Make sure judgement doesn’t cloud the journey

Earlier today I was laying in bath (as you do, with a broken ankle) one leg dangled out the side, rather uncomfortably. Attempting to relax, I kicked back, reflecting the last few weeks of life. As an overview, they’ve both been fortunate and unfortunate in different ways. Almost as if one was meant to happen to help improve the other.

So what am I going on about? Well, a little under 5 weeks ago today, I broke my ankle, after a heavy & damn right clumsy (arguably malicious) challenge on me at football. This was both painful and inconvenient (and still continues to be so), but what it did give me was plenty of time to think, and with the wonders of technology work from my bed. The extra time, which I might have normally filled with other activities, I used to plan and re-evaluate my working life.

For those of you that don’t already know, I run an web based media company called Bytewire and have been doing so for 3 years, since we first started up. I kicked straight out of uni into this and it’s been a roller coaster ride from day one.

Anybody who regular reads my blog will remember I wrote about a bit of a predicament we we’re having after being 3 years down the line and having not really achieved our goals as a company (least not the dream). If you didn’t read it, catch it here – Why web design is something I got into »

It’s definitely worth reading first before this post.

Now, in this previous post I promised a follow up post, so here we have it.

Another few months have past and it’s been all change with my working life and company direction. After a great deal of thinking and deliberation we sat back and said, you know what.

What do WE want to be getting out of this?

Personally, professionally, and everything else that come’s with it. And it was really refreshing, like, really, really refreshing. It felt like alot of what we buried our heads in the sand with, previously, was finally being addressed.

Now I guess you’ll be wondering what sort of things we talked about and what that meant. But I want to keep this post on a strictly personal level, so i’m not going to go into all the ins and outs of our start up company Bytewire’s improvements.

As any Entrepreneur or business owner will tell you, you start out with a dream, something you think will be huge, even if it is totally unattainable in your mind right now! You’ve got to dream big. Those that do will change the world. We set out 3 years ago to build a game, then further that with follow up titles and expansions.

Truth is, we never quite made it. We received investment from a company and we blew the opportunities this very well could have opened to us. Reason we blew it, in-experience. We thought hey, you know what, we can keep all this investment money and try and make it ourselves and we would be better off. WRONG. So very WRONG. People are STRENGTH. More people equals greater STRENGTH (given you get the right people of course). Expansion was the lost KEY.

Lesson: Never consolidate in a start up, always try to expand. Of course use your head to make logical decisions. But never sit, not making the most of your resources.

What this meant for us, is, we slowly dwindled away vast amounts of our initial investment money. To the point we we’re at a couple of months ago. We recently made our final payment on our current office, leaving just 3 remaining months (probably less) before we would need to commit to more time their, find another, or leave.

After discussion, this would likely be our penultimate few months, if no improvements we’re made.

It was a stressful time.

During the few nights I spent in hospital I began to think once the last rent payment is made, it is make or break time. 3 years down the line just turned 25, i’m no longer a kid with a big dream. I’m an adult who want’s to get something out of life, like a house, a new car, perhaps even a family (shudders), fly the roost and all that etc etc.

It dawned on me that, we need to make work more about us, what we need, and what we enjoy. Work should fit around our lives, not dictate them. We needed to start taking ourselves more seriously and doing all we can to make things work, in an all out attempt to make it WORTHWHILE. And in the end be able to sit back and say you know what if this isn’t worthwhile, then maybe we should do something else.

And this is the KEY for me. I love what I do, but in reflection we did it the wrong way round. We’re now at a point, as developers, we should have been at from the very start, ideally. Which hampered our ability in the beginning. But Cest la vie, such is the card we dealt.

As all start up founders will know the people that have to make the greatest sacrifice are ME & YOU, the owners. When you start out, you have to accept, long unsociable hours, little financial rewards, and generally difficult times. And we most certainly have done this, for 3 years now. It’s gone past it’s honey moon period, when enthusiasm was rife. It’s gone into, this seriously needs to be working, or we cannot simply carry on blindly doing it. Life needs a shake up every now and again.

What we did was to both go away and identify things we would like to happen, a few things cropped up. One obvious thing was financially things had to improve, best job on the planet or not, if someone working in a Supermarket pulls more than our average wage a month, then something is wrong (of course absolutely no offense meant by this, i’m just using it as a benchmark, people can relate to). Learning new things, and tools to do our jobs better we’re amongst other mentioned things.

What I suggested we did was treat the next 3 months as if it we’re really a game. Stop all this long term thinking, like if we do that we won’t have any money left in 3 months. I mean who the f*ck cares if there’s no money left if what your doing does not financially support you right now! And you’ve already given it the time you feel it was due to flourish. Right?

Or planning for events like making no more money. If you don’t make any money in 3 months there’s a real business problem, right here, right now. Solve it, or it’s never going to be worth it.

Do not mistake what I am saying here for the fact we do it just for the money. It’s really not true. But as mentioned earlier it’s a key factor in life, moving out, and growing up. It cannot be forgotten.

Which leads me excellently to the title of this post. Judgement might tell you that, paying yourself more or rewarding yourself more often, can’t be done unless you’ve hit ridiculous milestones in your bank account. But you shouldn’t be thinking about that. Do not waste your time planning for the long term until you have something worth planning / protecting for! Focus on the short term, make yourself happy (don’t be greedy), focus on the reasons you work for yourself, and more importantly the benefits.

In business you must strike a balance between risk and safety. Without risk there can be little gains. Risks are everywhere you’ll take them all the time, but when it comes to money, some people, are just less comfortable with taking risk than others.

As people we’ve all got a bit of stick or twist in us, how you answer, with personal money in your hand should be different to business money.

With business you must leave your personal money management at home.

Don’t get me wrong there is a big difference between reckless and calculated. And only you can decide where the line may lie. But with everything in life, you do need to be able to draw lines under things and have the integrity enough to hold your head high no matter what the outcome. And also the knowledge enough to walk away from things which are not working, but still having gained valuable and useful experience.

It’s all about the experience and the journey. If a ship opens its sails, it’ll most likely go somewhere. If you sit ashore, unsure of where the open water might take you, you’ll sure as hell go nowhere.

When you get somewhere, a long way down the road, then you plan for the future.

Right now, just live for the moment.

Correct way to add CSS to WordPress Plugin Backend

Many of us have dabbled with making our own WordPress plugins, but what alot of people forget is we need to make sure we’re as compatible with WordPress going forward as can be.

Over the last 3-5 months I’ve really started to discover the hidden power of WordPress and today i’m blogging about another find.

It’s quite a simple topic really. Many of you will want to include your own custom stylesheets with your plugins, but what’s important is keeping the integrity of your WordPress plugin intact.

So whats the correct way to Enqueue your css stylesheet?

There is a couple of ways in which you could achieve it, but being prudent is best.
Include the stylesheet only in the admin pages that you absolutely need to, in the case of the backend, only on the submenu pages you need to.

I am of course assuming here that your pretty familiar with the plugin backend and that you know how to create sub menu pages for your WordPress plugin.

$page = add_submenu_page(
    'edit.php',
    __( 'My Plugin', 'myPlugin' ),
    __( 'My Plugin', 'myPlugin' ),
    'administrator',
    __FILE__,
    'my_plugin_manage_menu' );
    /* Using registered $page handle to hook stylesheet loading */
   add_action( 'admin_print_styles-' . $page, 'your_plugin_styles' );

This would of course normally be wrapped in a function or class, whichever your coding style prefers.

We are telling WordPress in the above example to add an action to call our custom function ‘your_plugin_styles’ on printing styles for the page WordPress object reference now contained within $page.

// Hook somethings up in our plugins init function
add_action( 'admin_init', 'your_plugin_admin_init' );

Next, I have added an action to be fired on ‘admin_init’ to call ‘your_plugin_admin_init’.

And what i’ll do inside this is call a custom_forms.css file that I need to use for some styling on the backend of this plugin. I’ve also housed it in a css/ folder within my plugin directory for convenience.

function your_plugin_admin_init(){
    wp_register_style( 'yourCustomFormCss', plugins_url('css/custom_forms.css', __FILE__) );
}

And finally we enqueue our script using wp_enqueue_style

function your_plugin_styles(){
    wp_enqueue_style( 'yourCustomFormCss');
}

And this is our working procedure.

Bringing it altogether.

We first fire our plugins init function called ‘your_plugin_admin_init’ inside this we register our css style with WordPress. Ready to be called later. Then whilst registering our menus, we tell WordPress on this admin page ONLY, to fire our custom css calling function ‘your_plugin_styles’ and from within that we enqueue our previously registered script ‘yourCustomFormCss’ using ‘wp_enqueue_style’.

Some useful links

Link color transitioning with css 3

One of my new favourite tools is css3. I love how for the tech savvy I can add a level of detail and luxury to a web page with no fallback problems for lesser browsers.

One of my current favourites is color transitioning in css3 for such things as links.

If you give it a go i’m sure you’ll agree with me, that it rules.

It’s also really incredibly simple!

First of all we start with a regular href tag and a :hover state declaration.

a{
   color:#000;
}
a:hover{color:#f00;}

Then we add our css3 transition, first of all just for webkit browsers.

a{
   color:#000;
   -webkit-transition:color 1s ease-in;
}
a:hover{color:#f00;}

Now we improve it by adding more extensive browser support.

a {
   color:#000;
   -webkit-transition:color 1s ease-in;
   -moz-transition:color 1s ease-in;
   -o-transition:color 1s ease-in;
   transition:color 1s ease-in;
}

And then you have it a simple transition from your main color to your hover state color. With no JS, jQuery or any other javascript libraries help.

Wicked, eh?

How to get the content of a WordPress post page as well as the loop

Earlier today I was talking about how I haven’t blogged in a little while, I feel ashamed at the truth of it. So as I was problem solving with a colleague tonight I spotted the opportunity for a nice helpful quick and dirty little WordPress post.

Some times the case may arise when you have set a static page as your blog page and wish to add a small blurb above your post loop, or even some custom meta to control a few images in your layout theme? Now it’s a piece of cake just to add them into your theme. But, point is, the client’s not going to dive into that file, nor do we want them too. So what we want to be able to do is, spew out some content, and then spew out the loop of blogs.

For those of you seeking the answer, or an answer I should say. You will most likely have been frustrated for a little while that $posts->ID refers to the post loop and by default wordpress has it’s wp_query instance set to your post loop settings.

It’s easy enough to manually enter the id and grab the page however, we want to do it dynamically. so after a little digging, I came up with this solution.

<?php
$page_id = $wp_query->get_queried_object_id();
?>

This pretty much gives you all the control you could ever need, but just incase your worried, here’s the std Object output from an example.

stdClass Object ( [ID] => 15 [post_author] => 1 [post_date] => 2011-08-10 09:22:40 [post_date_gmt] => 2011-08-10 09:22:40 [post_content] => Just going to be testing whether this is working or not. [post_title] => Blog [post_excerpt] => [post_status] => publish [comment_status] => open [ping_status] => open [post_password] => [post_name] => blog [to_ping] => [pinged] => [post_modified] => 2011-10-20 21:39:14 [post_modified_gmt] => 2011-10-20 21:39:14 [post_content_filtered] => [post_parent] => 0 [guid] => http://localhost:8888/bytewire/?page_id=15 [menu_order] => 0 [post_type] => page [post_mime_type] => [comment_count] => 0 [ancestors] => Array ( ) [filter] => raw )

Even without this, we can grab such things as meta data.

<?=get_post_meta($page_id, 'sliderheading', true);?>

I’m still looking for a solution that solves category, archive and deeper browsing though mind you.