Set custom sizes (beyond the $size argument) to WordPress Feature Image/thumbnail

get_the_post_thumbnail() is a very useful WordPress function, but I tried to cheat and set up an image of a X size to then resize it to half the size so that it would look good on Retina displays.

Shame get_the-post_thumbnail() returns the full <img> tag rather than just a URI, so I tried to pass some arguments, like class but also width and height, likeso

$args = array(	'class'	=> "desktopOnly", 'width => '240', 'height' => '444', alt'	=> trim( strip_tags( $concert["post_title"] ) ));
								
$photo =  get_the_post_thumbnail($concert["ID"], "concert-listing", $args ) ;

Shame that my height and width attributes were ignored, so I thought I could do with some preg_match action!

if(has_post_thumbnail( $concert["ID"] )):
	$args = array(	'class'	=> "desktopOnly", 'alt'	=> trim( strip_tags( $concert["post_title"] ) ));
	$photo =  get_the_post_thumbnail($concert["ID"], "concert-listing", $args ) ;

	$replace = array('width' => '240', 'height'=> '444');

	foreach($replace as $item => $size):
		//resize img with regex :S
		$matches = array();
		$pattern = '/('.$item.'=")((\d+))"/';
		preg_match ($pattern, $photo, $matches);

		if(!empty($matches[2])):
			//now replace it
			$photo = str_replace($item.'="'.$matches[2].'"', $item.'="'.$size.'"', $photo);
		endif;
	endforeach;

	echo $photo;
endif;

Enjoy :)

PsicologiaLondra.com, WordPress website

A multi language WordPress e-commerce website displaying a public registry of customers on the site (customers actually purchase a space on the website to list their business) http://psicologialondra.com/find-a-therapist/.

It also features the usual Blog, Events, Contacts and Team and it uses a customised version of WooCommerce to allow for extra registration fields.

Open Eyes, WordPress website

This site has been my biggest WordPress build with lots of features and challenges. This is so far my peak in my WordPress career, with the following plugins built

 

  • Front End registration for visitors;
  • JIRA integration to allow visitors to log an issue or request an enhancement for the product the site advertises and also to display issues they have logged;
  • A Parallax Homepage.
  • Several dynamic templates for News, Events, Press Release, Case Studies, FAQs and Contact pages.
  • A section of the administration panel where the admin can create JavaScript files and assign them to posts in order to display JavaScript demos on the website;

Keep on dreaming: I finally wrote my first Node.js app!

It is almost 1am, it’s Saturday night and I have not been clubbing or partying with my friends tonight. I have worked on my latest freelance project writing a Policy about Cookies.

What a bore you would think. Instead I went to bed feeling contented with myself, no, that’s not enough, I felt bloody good.

All of this just because today I wrote my first Node.js app. I lied in bed thinking “WOW, I did that”. I actually understood every bit of code me and my friend Davide wrote (following his guidance).

“So, we all wrote Node.js apps at least once in our life, what’s the big deal?” You would say. Well I thought I never would. Not at this stage in my  “JS career”.

So while I tried to fall asleep and looked back at the day that has just been what seemed like a small epiphany this afternoon is now a full sober realisation: writing code is easy.

Why have I been so scared of learning in a new/different language? What kept me stuck in PHP  world and only made me feel worse about myself as a coder for writing such horrible, cheap and unsafe code?  What made so difficult for me to think of being able to write a RESTful-similar application? What convinced me that I would never be able to learn anything new?

I don’t know but whatever that voice was, it was wrong. Because it only took us 4  hours to write a simple app in Node.js. and it already included a Foursquare integration.

So what happened to my 14 year old self, that feared nothing and tried to mess about with any possible software she could install ?

That hopeful and playful girl got overwhelmed by how fast our industry changes every day, by the big boys demoing very fancy Node.js projects and thought “no way I can get there before I truly understand and master JavaScript”. So I told myself, like you tell yourself about many dreams “One day. One day”.

When Davide suggested we got together and hacked something, that he would rather do it in JS than in PHP, I simply sat there and nodded thinking “I will never understand and really own the code we’ll write together”.

But after a few very clean explanations I was already understanding how everything holds together and how very little JS has to do with writing an app in Node.js.

I did it. I wrote an app in Node.js . But what really matters to me is that I can now be that dreamy fearless girl again and I can go and hack things. Next on my hit list should probably be Backbone.js and I am not scared!

Keep on dreaming.

 

Snodada, our app in on github for now https://github.com/morena/snodata It’s a foundation app to handle logins with services such as Foursquare and Facebook. We aim to use this app as a starting point for Node.js apps where we will be using multiple APIs and will allow user registration/login using social media services APIs such as Facebook and Foursquare

In Italian snodata means “dexterous”, “flexible”, It’s a pure coincidence that our app is also built with Node.js :)

Rossella Vanon Photography

I’ve been so looking forward to working with Rossella. Not only her pictures are stunning, but I am hoping to work more and more with Retail and Fashion.

I helped her with implementing her re-design, putting together a simple and fresh looking website.

My trip to Thailand, Laos and Vietnam

People say it’s the trip of a life time, that it changes you completely,but I feel like it’s just the beginning. I spent a month in East Asia for my honeymoon and I just want more.

We visited Thailand, Laos and Vietnam and missed out on Cambodia. So what to expect? What went wrong? Why do I want more?

A lot happened in a month and I was so caught up with it, I did not even realise. So no, back in London, with the cold seasons slowly creeping back, I have finally some time to look back and digest my experience.

What to expect?

It’s hot. Like nothing you’ve ever experienced before, unless, of course, you have already visited a country this hot. So no matter how excited you are, take some time off, spend couple of days slowly adjusting to the weather and to the hours when you arrive at your first destination, by doing as little and as late as possible during the day and turning the air conditioning to as hot as you can bear.A very dangerous cocktail of jet lag and extreme temperature made sure I was vomiting at the side of a temple in the Grand Palace Complex in Bangkok. Not cool.

Big cities are big. The traffic is mind blowing. The amount of people, too, especially as they speak another language. The writing is crazy too in Thailand, all of this made me feel quite spaced out at first.

Night trains in Thailand are the coolest way of transport ever. Ok, maybe not as cool as private luxury jets, but they are cheap (a 12 hour ride from Bangkok to Chiang Mai is maybe around £30); they are clean (compared to anything else in Thailand really), really very safe (everyone is just interested in getting to the destination and there are lots of staff members walking up and down all the time cleaning) and comfortable. I actually had one of the best night ever.

Temples are everywhere. But don’t be banal and say you got bored after visiting the first few temples. And not, they are not all the same. One of my favourite moments was in the big Temple inside the Grand Palace in Bangkok. I was feeling sick (this is about 30 minutes before I vomited, so still some energy left in me), it was boiling hot and there were masses of shouty tourists all around me. I thought I was going to go mad, but when I got to the top of the 3 steps to the temple, nothing else mattered: the wind was blowing lots of little bells; it cooled me down and silenced all those voices. The peace that transpired from the inside of the temple while I was kneeling down (don’t point your feet towards the Buddha!) in front of the Buddha made sure I could resist another 30 minutes before vomiting and it was just me and this magical moment I will never forget.
When we got to Chiang Mai temples architecture had already changed and by the time we got to Vietnam we really missed the Thai temples and their minimalistic but yet majestic beauty: Vietnamese ones were so similar to Chinese ones, it felt like Vietnam’s Buddhist identity got lost somewhere there…which is exactly the reality right now.

What went wrong.

Book in advance. Ok we did it the fun way and only had the first 3 nights booked in a month. Then it all went wrong: we stopped in a place in Thailand that only deserved 30 minutes (Lopburi, the monkey town, to be precise. Don’t do our mistake: if you really want to see the monkeys get off the train wander around for a bit then get back on the train to Chiang Mai) and had to stay there 3 days because there were no places on the night train and we booked too late.
In Vietnam we could not find ANY night trains in the whole of almost two weeks and had to fly everywhere. Unless you have plenty of time, you’ll waste a day travelling each time and the tickets get quite pricey (up to £130 per person one way!) from 3 days to the departure date. So we had to skip Cambodia, but Ayutthaya in Thailand is a mini version of Angor Wat, so if you can’t get to Cambodia, make sure you stop at Ayutthaya.
Trains are awesome, they are really the best way to get around (I’ve heard such horrible stories about buses organised to steal people’s belongings while they’re asleep and dump them at the side of the road, etc) so do your best to book in advance. You won’t regret it.

Too many malaria tablets. I am still not sure if it was the malaria tablets (I was taking Malarone), but on my third week I started to feel very nauseous. This put me off any food. We realised we really should have taken them when visiting rural areas ONLY. Cities were fine really.

Read up as much as you can on your baggage allowance. We didn’t so we wasted £50 an a slow boat shipping, for stuff that may or may not arrive, when we had 2 x 23kg each in our allowance, because we flew business class (again, no normal tickets available) from Saigon to Bangkok and the same on our Premium Economy Qantas flight back.

Vietnam is dirty, dirty, dirty. We landed in Hanoi, the capital of Vietnam, literally in the middle of the Old Quarter. Crazier than Soho, it was all about street drinking on tiny stools on the pavement while snacking on street food that was cooked “at the back of the ground floor room”. Washing up happened on the floor, rinsing crockery happened on the floor, communal meals (cool but yuk) also happened on the floor. I am surprised I did not see people having sex on the floor. 3 weeks in my stay in Asia, I finally got my culture shock and could not for the next week touch any Vietnamese food. In fact this is where my food poisoning slowly escalated day by day. I am so not going back to Vietnam. Oh wait, I have not yet mentioned Hoi An…

Why do I want more?

The clothes in Hoi An & Bangkok. I was never so desperate to board a plane (I hate flying) as I was in Hanoi. The airport was MAYHEM, I am even surprised we made it to the flight. But our stay in Hoi An was much more pleasant – finally, the beach! – if it was not for the fact that in Hoi An beeping is like breathing. We spent 3 days here going back and forward to the tailors, because this is where the quickest ones are (can’t say best ones but if we compare quality, cost and delivery time then…). I spent £250 and got a suit with a skirt and 2 trousers, 3 shirts, an evening dress and a summer dress which is an exact copy of a dress I already have (that was magic!). Don’t go to a shoe maker though, they have not quite mastered FASHIONABLE shoes yet :S

The Siam night market in Bangkok, instead is so trendy, I bought so many clothes there I never found anywhere else.

Thongbay Guesthouse, Luang Prabang, Laos. I should just say Luang Prabang, but I should stress it’s in Thongbay guesthouse that I spent the best moments I have of my holiday: the ones on the balcony over the Mekong river of our bungalow. We relaxed and lived in peace in Luang Prabagan. No hard selling, no rush to drive like crazy, just genuine happy people. This is how Asia should be. With our money and our fuss we have spoilt Asia, I am sure. And I am worried I will going back to Laos one day and find it as fake and as dirty as Vietnam. Laos is one of the poorest country in the area, and even remote tiny village families live in cleanness (hence my cultural shock when I arrived in Hanoi). Luang Prabang is just there, a peninsula stretched with no effort, in a mystic yoga pose, to just let you enjoy yourself in your own time. No beeping, no shouting, no rushing and French Colonial architecture is a key player I think for the relaxed atmosphere. And do go and teach English at the local library on Saturday (might even be every day) afternoon 1pm to 3pm. I went there and my student was a Novice Monk. One afternoon I will never forget.

Wait, did I really ride an elephant? Indeed. And I can use the commands to mount one and make it walk (and a few more). Well, at least if the elephant is Korean. That was scary (I am scared of everything) but riding an elephant holding on a very loose rope is definitely one of the highlights of this trip and of my life. To the point when it felt natural: my elephant was enjoying the walk himself, he put his trunk on the back of his mate who was walking ahead of him and so we strode in peace and at one with nature. Until I had to cross a river ON TOP of the elephant (I can’t swim!) while hugging a very small but smelly Korean Elephant trainer. I survived and will definitely do it again (well, not the river bit maybe).

So what would be my revised itinerary be?

If staying just for a week I’d go straight to Hoi An, arranged for some more clothes to be made, then go back to Luang Parabang for couple days or maybe visit Ventiane and then visit the beaches we have missed in Nha Trang (Doclet for example), while stay a few days at Mia, the amazing 5 star resort (paradise I call it).

If I could stay another 2-3 weeks, I would also add Chiang Mai in the mix, maybe Sapa, then I would definitely visit Angor Wat and some beaches in Thailand.

Mu ultimate advice: book in advance and try and do at least couple connecting flights on one day (that’s another reason why we lost time, by only doing a flight a day then wait at least another day in between).

Addison

I joined the famous Annual Report busy, busy Season at Addison (now Addison Group), part of the WPP.

I worked on the Front End of BG Group’s Annual Report, using latest technologies but keeping the focus on cross browser compatibility and accessibility (thank you Shims!).

The process from paper (where the Annual Reports have always been produced on) to screen is such fascinating domain and I embraced it with its limitations, challenges and incredible solutions and results.

A Browser Basics talk, what concepts would you cover?

I am so pleased to announce that London Web Standards is organising State of the Browser (a conference on the Browsers and their new features) for the third year.

Last year was an amazing experience. For the first time I had given 100% not only to preparing a conference but also to run it during the day. I missed all of the sessions, except a couple, but I definitely enjoyed being there, it felt like being part of the future :)

One thing I noticed was that, while we put had together a very Browser-focused conference (by inviting Browser Representatives to talk about the new and upcoming features) a few designers were there and I hope that they were able follow the main talks. I am not implying designers might not be knowledgeable about browser/HTML/CSS but that I am the first one that is working with them on a daily basis but feels like she don’t really know what’s “under the hood” and that knowing this might actually help her improve her understanding of HTML, CSS, HTML5, CSS3 and JavaScript.

So the other day I thought we could prepare whoever wants to come to the next State of the Browser to what’s ahead of them by putting together a “preparation event” the month before, at one of the monthly London Web Standards nights.

Since then, I’ve been trying to think what would a “browser newbie” need to know before she can attend State of the Browser. I wanted to watch all the past videos, but I also wanted to hear the opinion of our past speakers and of anybody who could help putting together what I think could be a very interesting and useful talk for anybody willing to learn more about how the browser and the technologies used in it work.

This is what I’ve got so far (taken from what seemed to me a very useful page http://taligarsiel.com/Projects/howbrowserswork1.htm

Then I also thought of

  • Local Storage
  • Offline Cache
  • Web Sockets?
  • Geolocation
  • Web Workers
  • Security
  • JavaScript on the Client side?

I would like to know your opinion – is there anything you would not cover, or anything else you would add? I would really appreciate your help :)