Categories
Support WordPress

New year, new journey

If anybody here knows me (personally or virtually) then there’s no point in reminding that I’m in the customer support business. I always liked to help others and this is what drives me to do my job every day. It might sound a bit cheesy but well, this is it, there’s nothing to hide.

Also, I always liked to learn new things, whether it’s about my job (read a book about working with clients or to improve the writing skills) or about my skills. One of the last few things that I learned lately is riding a motorcycle (it’s winter season right now so no fun for now). Also, I recently read a book called The productivity habit that I would recommend. I know there’s room to improve this side (at least for me).

What else?

The most recent thing that I’m trying to learn about in my spare time is JavaScript. I worked with WordPress for around five years now and I’m pretty sure that I won’t stop working with it anytime soon. In order to stay up-to-date and make sure that I can work with WordPress in the long run, I decided that it’s time to allocate some time to learn JavaScript. As the founder of WordPress said, it’s time to “Learn JavaScript, deeply.“. Contrarily to what everybody else might think, my guess is that this won’t be mandatory only for developers. I mean yes, right now it’s not enough to know only PHP anymore in order to work with WordPress. However, even from the position of being a support person is important to identify a user’s problem as fast as possible. Well, sometimes, a simple investigation might be worth a lot in the eyes of the customer when you’ll be able to fix the problem he has just by pointing the place that’s causing the issue he has.

I know that this advice (about learning JavaScript) was launched in 2016 but I think that it’s still not too late to start. This is the time when everything changes in the WordPress ecosystem, things are moving to a new editor, a new way of doing things… basically a new WordPress (well not entirely, mostly improved).

Why all this story?

I wanted to share how did I start learning JavaScript. It all began with a mail from Codecademy about some enrollment offer. I was curious about what else I can find on their website. They had a 30-hours JavaScript course and challenged me to work at least half-an-hour a day on it (why just 30 minutes and not more? Maybe I’ll write another article about this). However, I managed to finish it in about two weeks (along with my full-time job). The next step is to go through some more courses (some ReactJS too) and read the books from the You Don’t Know JS series.

I know that right now things are pretty simple when it comes to support: a little bit of CSS, maybe a line of PHP to change the query and everything’s fine. However, things are changing, Gutenberg is here, and even understanding just the basics of how everything works will definitely be very helpful.

This is it for now. If anybody has some other resources that might be helpful for learning JavaScript, leave a message and I’ll definitely have a look. Also, I would love to hear some other stories about learning journeys.

Categories
Uncategorized

How to reinstall Local by Flywheel on MacOS

As you may know, Local by Flywheel is a very useful tool for the ones that want to create WordPress websites on their local computers (at least, this is its first purpose).

The idea for this article appeared when I got stuck with the same problem for the second time while trying to remove this program from my laptop and install it from scratch. This is the second time I had this little issue and I don’t want to be any third time. And that’s the reason why I’m writing this article and maybe it will help some other users too.

VirtualBox gets installed too when using Local by Flywheel. Basically, a virtual machine is created to host all the WordPress websites. Now, when you want to remove everything for good, there are two steps that need to be taken:

  1. open VirtualBox and remove the machine;
  2. download the VirtualBox package as you would install it and run the VirtualBox_Uninstall.tool script;
  3. move Local by Flywheel to the trash.

This second step is the one that needs to be done instead of just moving VirtualBox to the trash. If you don’t do this when trying to install back the Local by Flywheel, it will get stuck and you won’t know why is this happening. Well, it seems that if that script isn’t used, VirtualBox is not actually removed. I won’t go into more details.

Long story short, this is the right way to uninstall Local by Flywheel and make sure that you’ll be able to install it back at some point.

Categories
Uncategorized

How to use a different logo for each language with Polylang

Every now and then I have some period of times when I feel an urge of giving back to the community and keep an eye on the public forums of wordpress.org. The good part is that this synchronizes with the moments when I’m not that busy with my day-to-day job.

This time I found a pretty interesting question related to the Polylang plugin. I usually recommend using the WPML plugin since it’s a pretty great tool (even if it is not easy to be used by a new WordPress user) but this time the question was about a different multi-language plugin. Don’t get me wrong: I like that Polylang is a free plugin that can be used for simple websites.

Let’s get to the point: the question raised by a user on the public forums was about how to have a different logo for each language. I checked a couple articles and topics but I couldn’t find an article to present a solution. I always look for new challenged and that’s why I started working on a custom code to do the job. And here’s the solution that came out.

The code

Here’s the code that need to be added to your website for using different logos when having the English and French languages:

function custom_polylang_multilang_logo( $value ) {
	if ( function_exists( 'pll_current_language' ) ) {
		$logos = array(
			'en' => wp_get_attachment_image('1555', 'full'),
			'fr' => wp_get_attachment_image('1556', 'full'),
		);
		$default_logo = $logos['en'];
		$current_lang = pll_current_language();
		if ( isset( $logos[ $current_lang ] ) )
			$value = $logos[ $current_lang ];
		else
			$value = $default_logo;
	}
	$html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
            esc_url( home_url( '/' ) ),
            $value
        );
	return $html;
}
add_filter( 'get_custom_logo', 'custom_polylang_multilang_logo' );

The logos

Now we have the code, but it cannot know what images to use from the media gallery. Once you uploaded the logos, simply get the ID for each one and replace the 1555 and 1556 in the code above with your values.

How to get the image ID? When opening a logo image in the media library, the link looks something like this:

https://www.example.com/wp-admin/upload.php?item=205

The 205 value is the one that’s needed here. 

Where to add the code?

There are two ways to add the code to the website:

  1. Copy the code that resulted (with the two IDs changed) to the functions.php file of the current theme;
  2. Use a plugin like My Custom Functions. This way, the code will stay there even when changing the theme.

Adding one more logo

If there are more than two languages used, the change is pretty simple. Just simply copy this line of code:

'en' => wp_get_attachment_image('1555', 'full'),

, replace the en part with a new locales (the full list of locales can be found here), and add it right after this line:

'fr' => wp_get_attachment_image('1556', 'full'),

Don’t forget about the logo ID and that’s all. This part of code should look like this:

'en' => wp_get_attachment_image('1555', 'full'),
'fr' => wp_get_attachment_image('1556', 'full'),
'ro' => wp_get_attachment_image('1557', 'full'),

I guess that this solution is needed when a website has some sort of text inside the logo, and it needs to be different in each language. I cannot imagine another situation when someone would have a different logo for different countries 😅

Let me know in the comments area if this did the trick for you or you need a little help with it.

Categories
Uncategorized

What did I learn about WordPress Starter Content?

I spend the last two days playing with Starter Content option that was introduced in WordPress 4.7. I’ve heard about this a long time ago but I never took the time to step back and give it a try. Since I’m working on a new theme for WordPress.org, I was thinking that it’s time to see how this feature can help me.

Why do you need this starter content and, most important, why a new article when there are already some very helpful resources out there?

Well, first of all, I think that I learned a lot of things in these two days. And, second of all, I really have to share this. Other users that might wanna use this on their theme really need to know a few things. Are you ready?

There’s an article that can be used as a starting point

There’s this article that you can use to learn some basic things like when was this option added to WordPress or how should the config look like. However, there are just some small pieces of code that you can copy and hope for the best. I’m saying this because some parts are not actually working but we’ll talk about that a bit later.

There are already a few elements included by default

Here’s the default config that’s merged with the one that you’re adding to the theme (or to a plugin if going this way): https://github.com/WordPress/WordPress/blob/master/wp-includes/theme.php#L2002

Basically, you have a few widgets, menus, and pages that you can already use without being needed to create them from scratch. Basically, you’ll be able to set the homepage and the posts page very easily with just a few lines of code. However, there’s no post included in this core content which looked a bit odd to me. I mean, WordPress main element is… the post. Why are only pages the only type of posts included by default? Well, the answer to this question leads me to the next point of my post.

The posts cannot be used with starter content

This is the main part that almost made me give up and delete everything I’ve done. However, I tend to at least understand why is a thing happening and that’s what I was gonna do this time too. So, after a couple hours, I made the connection that the posts created by starter content were saved with the status of auto-draft and that’s why nothing was showing on the blog archive. Basically, what I was looking to add some posts (11 to be more precise) and show all of them on a page through some custom widgets. Everything worked fine but the posts part was a dead-end. However, the solution that I used, even though it’s not a fancy one, was this code:

function post_status_customizer_change( $query ) {
	if ( ( 1 == get_option( 'fresh_site' ) ) && is_customize_preview() )
      $query->set('post_status', 'auto-draft');
}

add_action('pre_get_posts','post_status_customizer_change');

Using this code I was able to include the posts in the main loop and get them displayed as needed.

All in all, these were the main things that I learned from playing with the starter content. It’s a nice feature so big shout-out for everybody that worked implementing it. Since the WordPress.org system is still relying on the same default preview content for all the themes, I think that starter content is a breath of fresh air for everybody who wants to stand-out and show what his theme can do.

P.S. This is an article that I wrote at the end of the day, right after I closed PhpStorm. If you see any bad grammar or something wrong, please have mercy. I’m doing my best and still learning 😁

Categories
WordPress

Is WordCamp an important thing?

Let me start this article by making crystal clear the fact that these thoughts have nothing to do with my job as a customer support at Pixelgrade. They're my humble opinion about WordCamp events in general.

I feel the need to share that WordCamp is the place where I always find great people that inspire me by their perspective on WordPress. They're also folks that are money driven, which is fine as long as I can have a relevant chat about common topics. However, most of the people are looking to share their knowledge, make you feel better, ask you witty questions or even congratulate for doing a great job. How cool is that?

The moral of the story: attend a WordCamp, I can assure that you won’t regret it. I had the chance to talk with Zac Gordon, a great teacher from JS for WP, find out about a new product that would compete with WPML and, the best part, start working for the community in reviewing themes from wp.org. Yaaay!

I’m a support guy that gives his best to help everybody during the day, but after 6 PM I’m trying to learn new things, and I believe that by reviewing themes and following different courses I improve my skill set. I have a feeling that I can't quit any of these two areas since both recharge my batteries and improve my energy level on a daily basis. I always loved teaching other people things that I know, and by following this path of being a customer support and learning new things, I can keep my dream alive and kicking.

As you might notice, I switched the topic a bit, but the whole point is that the WordCamps events are the ones which made me aware of the importance of never giving up and surrounding myself with people who share the same mindset.

In just a few words, the moral of the story would be this one: attend a WordCamp (or at least a local meetup), I can assure that you won’t regret it. In fact, you will thank me later.

Categories
Uncategorized

There’s a new Hackathon in town

Pixelgrade’s first Hackathon was quite a strike from many points of view. I’m happy I had this experience with the team I’m working next on a daily basis. In this article, I want to share with you my thoughts on how things worked out from my perspective.


The place

Which could be the best and most productive place to play with ideas and make them happen? Not an office, that’s for sure. We went to our favorite cabin in the mountains, a very beautiful and cozy place where we feel welcomed every single time. In the end, we wanted some time for ourselves for running this event, but also for socializing and sharing stories.

We kicked-off the day with a relaxed pitching session where each of us tried to convince at least one-two other folks to work for particular ideas (we were nine, so not too many options). After a round-up of presenting ideas, debating which one makes more sense to invest in, and coming to a conclusion (thanks to Răzvan, the coordinator of this entire experience), we started working. We had 36 hours to play around and make things come true.

The projects

It’s funny that, in the end, all of us pushed the boundaries a little bit and got out of the comfort zone. Some of us needed more brainstorming sessions while others were quite confident about the technology they will use to make their idea happen. However, the nicest thing was that each of us learned something new in different areas: some extended their technical skills while others boosted their soft abilities.

Let me briefly introduce you each project, and hopefully, I will come back with updates once we have them.

#1—Mirroring

Mirroring

A web app that gives you the chance to use your smartphone to something else, other than scrolling the news feed on Facebook. It should be a game for at least two players, and the rules are pretty straightforward: each player is the host at some point, and the other ones are simply competitors. The hosting puts his phone in a certain position, and the opponents need to simulate it. The player that has the most accurate reply wins the game.

After 36 hours of hard work (from research to coding) this team achieved at least two small wins: they finished almost the entire look-and-feel regarding design and founded the algorithm to create an animation depending on the moves of the phone. I must confess I was really worried about the complexity and difficulty of this project, but I was impressed with the huge progress they did.


#2—Tonus

We already know that music makes everything easier (and better). Since sharing is caring and good music can drive a positive impact, why not sharing what you’re listening to the folks next to you? Here’s where Tonus (yes, they already have a name, beat this) shows up and saves the day. Things are simple: use your phone and the geolocation service and get a sneak peek inside the playlists of those traveling with you in tram, metro or bus.

Ilinca, my teammate, spend quite a lot of time on her way to the office, so no wonder why she struggled to make Tonus up and kicking. They still have a lot of tweaks to handle, but all in all, they have some early adopters ready to try it out and provide feedback.

Tonus

#3—Scores

Scores

We have some huge Fifa fans inside our team, and we too often debate who won which game. On top of that, we also have other sports lovers around us (especially tennis), so my team and I created a simple app that helps you note down the score. At this particular moment, you can create a new account, add the score for a match between two players, gain XP, win badges and check some leaderboards. I have to be honest and tell you that there are a few things that are still not working well, but we are proud of our work.


#4—Apply. Now.

We’re always looking for meeting interesting people from the local community, both for socializing, but also for recruitment purposes. The main idea of this project was tailored to our unique needs regarding bringing new people aboard. My teammates managed to create some short video stories which highlight the huge gap between the corporate approach and our vision about how things should work out. The results were… really game-changer.

Even it wasn’t an app like the other projects, the level of finding practical solutions was a bit higher. Long-story-short: the sky’s the limit. One thing’s for sure: you shouldn’t miss the opportunity to join our crew. So Apply. Now.

Final thoughts

There were 36 hours with a lot of laptop chargers connected to the wall, coffee, fruits and some tasty traditional food. Do we have any financial benefit out of this? Not really. Is there any accomplishment for the fact that we took some days off to run this internal Hackathon? You can be damn sure. Not only that we collaborated in different ways and pushed our boundaries, but we had the chance to invest our know-how, energy, and time in something else than business as usual. This is the break that we all need to take from time to time to see what’s behind the walls.

My main takeaway is related to the fact that we can do so much more if we truly are in this together. There are almost no limits.

Categories
3D printing

A 3D printer: both a blessing and a curse

The simple thought of writing this article reminds me of a story regarding why time worths money. Let me shed some light on this one.

I’m working with WordPress on a daily basis. In fact, I’m a proud support folk @Pixelgrade. One day, I found an article written by another WordPress theme creator. The topic was crystal clear: is a cheaper theme a good idea?

The whole point was that you can choose a product between $15 and $225. If you end up using the first one, there are many chances that you will need a couple hours to get your head around and scratch the surface. This amount of time is highly valuable since you can use it in a bunch of different ways: earning extra money, spending it with some great friends, watching a movie. On the other hand, using a premium WordPress theme that solves a real problem can save you from a lot of headaches. Once again, time is money.

Now back to the main point of this story. Few days ago I ordered an Anet A8 (don’t worry, there’s no ad or affiliate link) 3D printer from gearbest.com. There were a couple of problems until I got my hands on it (the filament was out of stock and nobody announced me about this but this is another story). As you may (or may not) know, you only get a small box filled with all kinds of pieces. At the end of the day, you need to transform something like this:

into a functional and easy-to-use tool. Well, it will take you around 7 or 8 hours. At least, this was my particular case. Yet, I still have a bag full of screws.

You’ll say: well, it’s not a really big problem. But wait, there’s more: it takes you another hour (or two, maybe) to calibrate the printer, fix the bed, find out how to change the filament and a couple of other tweaks. I would have definitely skipped this part for, let’s say, another $100. In other words, I would blindly pay the higher price for a WordPress theme as well.

Once you start using it, calibrating comes back at you over and over again. Each printing needs its own setup. Yes, the printer works very well, at least I like to believe so. However, did anyone paid any thought about the guy like me who wanted to have fun with a 3D printer (for a lower price)? Not really, to be honest.

All in all, it’s my first rodeo with a 3D printer and I have to say that I learned a lot by assembling and using this particular printer. For those who are looking for a cheap toy to start with, I think that this is a great choice.

The first piece that I printed is a demo called “box-1” but I really think that looks more like a soap holder. Some other pieces are on the way, so stay tuned!

P.S. Thingiverse is a pretty good website to get free 3D templates. Is there any other place with a 3D free collection?