Hey guys I'm Kevin and this is my first time trying to write something with more than 20 characters, so let's give it a shot. I think the title describes exactly what this post is all about but I'd like to give you a little bit of context on why I'm writing this. Either some of you are going to feel right in my shoes or you are just going to completely disagree and that's ok. We don't have a comment section on here so I'll never know.

I'm a fullstack web developer. I've been working with PHP for almost 5 years and for most of those years I've been using Laravel. If you know anything about Laravel (If you're a PHP developer and you don't know about it, I don't know what are you doing with your life) it's that it is a very powerful framework. It's been getting more popular with each release. Now, if you work with Laravel (or any other PHP framework) the last thing you want to hear about is Wordpress. You might have the same reaction the hyenas on The Lion King have whenever they hear "Mufasa". So when I started my first Wordpress project at my current job, I wasn't very thrilled. I'll tell you why.

The first time I used WP (I'm just going to shorten it from now on) I was still in college doing my internship. I was able to get into the CERT(Community Emergency Response Team) department . My task was to develop the website for the department. Basically the only thing they told me was to use WP. The problem was that I had never used it before. I had heard about it but I had no idea what to do, so I started by looking at the documentation (keep in mind there were no other developers in this department so I was on my own). Now the first problem with WP is that there are a LOT of resources, and you may think "Kevin! That's a good thing you dumbass! Are you even a good developer? Do you even know how to read?" to which I would tell you to shut up! I have read more than 3 books in my life. Of course a lot of resources are a good thing, but not so much when you have no idea what WP is or where to start.

The first time I installed WP I thought the only way to do things was on the actual UI. I had no idea where the actual files that I could go into, and write code on, were. Usually all of the tutorials assume you're a dumbass who can't code for s**t, so they only show you how to install templates and plugins. That was my experience, and I can bet some of you had a similar one, so I can understand your hatred for WP. After I left that department I got another job where I started using Laravel and I never looked back.

Fast forward to my current job. Maniak is focused on web development: Laravel, React and, you guessed it, (fu**ing) Wordpress, so I knew that moment was coming. I was going to use WP again; but to my surprise, it was very different from the way I experienced it the first time. I want to tell you why it was different this time and what you can do to improve your WP experience and make it much more enjoyable.

Plugins

I think the biggest thing on WP are plugins, and there are a L O T of plugins, for almost anything you may need. If you don't now s**t about programming then that's good news for you, but we aren't amateurs. We like to get our hands dirty and learn how to do things, so the less I can use plugins the better. It helps you to learn new things and not depend on external code. What programmers sometimes forget is that WP is still PHP, and you can still do a lot of things that you are used to doing on non-WP projects.

There are some plugins that are really helpful and will make your WP experience much better. Here's some of my favorites:

Bladerunner

This is a great plugin specially for someone coming from Laravel, like me. This plugins allows you to use blade templates on you WP project. If you have never used blade or heard about it before, let me show you how simple it is and how it's going to make your code look much more organized and clean.

<?php if($test == 'foo'): ?>
    <div> 
    	Bar
    </div>
<?php endif; ?>

This is just a very simple example of how you would write PHP on your HTML pages. It may not seem so bad, but once you have more than 4 lines of code it gets pretty awful. This is probably the thing that I hate the most about vanilla PHP.

@if($test == 'foo')
    <div>
    	Bar
    </div>
@endif

This is what it looks like when you use blade. See the difference? You don't have to open and close php tags. Believe me, on the long run, you're going to love not seeing PHP tags on your HTML.

<div class="color-module {{ $classes ?? ''  }} {{ $color ?? '' }}">
    @if($link)
        <a class="link" href="{{ $link['link'] }}">
            <div class="heading h2 white-text">
                {{ $link['label'] }}
            </div>
            <div class="arrow-link">
                @include('partials.icons', [
                    'icon'       => 'single-arrow',
                    'arrowClass' => 'shape-blue'
                ])
                @include('partials.icons', [
                    'icon' => 'cta-arrow',
                    'circleClass' => 'shape-white',
                    'arrowClass'  => 'shape-blue'
                ])

            </div>
        </a>
    @endif

    @if($shapes)
       @foreach($shapes as $shape)
            @include('partials.shapes', [
                 'icon'       => 'single-arrow',
                 'arrowClass' => 'shape-blue'
             ])
       @endforeach
    @endif
</div>

Here's another example. This is a from a project I'm working on. As you can see, there is a lot going on, but it doesn't feel cramped because we aren't opening PHP tags all over the place. I'll explain really quick and simple what is going on.

The curly brackets represent an echo, so this:

<?php echo $test ?>

is the same as this

{{ $test }}

See how much space you're saving? Plus, it looks way cooler.

The @include basically inserts HTML from another component, so you can separate your code into components and then into more components or partials or however you want to structure your code. This is great because then you don't have to have files with all of the code in it and you can reutilize it whenever you need to.

I added an if and a foreach and look how much better it looks.

This is a very powerful tool that will make your code look better, it's going to save you time, and it's going to make your job much easier. Here is the documentation so you can familiarize yourself with it.

Advance Custom Fields

This is my second favorite plugin and probably a necessity for every developer and user alike. The reason why we use a CMS is because users need to be able to upload their own content, so this is a tool that  allows to customize the experience for the user on how to upload that content. Let me copy the plugin description from their own website.

Advanced Custom Fields is a WordPress plugin which allows you to add extra content fields to your WordPress edit screens. These extra content fields are more commonly referred to as Custom Fields and can allow you to build website’s faster and educate your client’s quicker.

What does this mean for you as a developer? I like to think of this as a way of making WP adapt to you and not the other way around. It helps you create very customizable pages. Let me show you an example.

This is a container where you can add sections, layouts, components, whatever you want to call them. In this instance the user can create a page putting all of this different sections together. You can see it's great for the user because they can put together the page however they want it. You are just giving them the tools to do it.

So now let me show you what is inside of a section

I added all of those inputs for the user to fill. Some are required, some are not. The user has complete control on how to style the section whichever way they want. As a developer, I can take control of what inputs I want to give to the user to fill. You give options to the user and you don't have to limit yourself as a developer with the default WP options.

Now your job of course is to program the backend to get all the information from those fields and integrate it with your frontend; and that's basically what we are paid to do, so don't be afraid of give the user control. You can customize how much control the user has.

I highly recommend this plugin because not only will you increase the quality of the user experience, it will make your job easier as a developer. You'll be able to set pages the way that you want it and since the fields work with templates, custom post types, etc. you have a lot of flexibility to make great things.

Templates

As with the plugins, there are a ton of templates that you can use to make your site. Some are free, most aren't. But we aren't here to just use a template and modify it as we need it. Why? Because we aren't amateurs! We want to do the dirty work, that's what coding is all about.

The main reason why you don't want to use a template is because it's not your code. You may have options to customize it, but you don't have total control of it. So if you don't want to hate WP because it "limits" you then go ahead and start a template from zero. There are a lot of tools and frameworks you can use to help you get started. This what no one told me the first time. This is why I hated WP. Little did I know, I just needed the right team to guide me and show me how what tools to utilize to make my experience much better.

NPM

The first thing you want to do when you start your project is to install NPM. Having this tool opens up a whole new world of options for your project. Now you can use almost any package that you need. This is probably the tool I use the most; not only to download packages but to compile my code.

Composer

Composer is a fantastic tool, if you've never used it before, I like to think about it as NPM but for PHP. Installing this on your project opens up a ton of new options. I'll leave a link where you can read all the advantages of using Composer on WP and how it's going to help you.

Webpack

Same as with NPM, I had no idea that I was able to use webpack in WP. Some of you may not be familiar with this, but it's a great tool to bundle your assets (javascript, css). Here is a great resource to show more if you've never use this before.

CSS

Guys, you can use ANY FRAMEWORK THAT YOU WANT for your CSS. You're don't have to use old and boring CSS. For me, I like to use SCSS, because I love nesting things. You can try SASS if you want to impress the ladies. Now, combine this with a powerful framework, and you have a recipe for success. I've personally been using  Foundation for a while now so I really like it, but you can use Bootstrap, Trailwind, Bulma, etc.

Since you'll be spending a lot of time with the front-end of your WP project, make sure to do some research and see what works best for you.

Javascript

If there's one thing I know about javascript is that people love to make frameworks out of it. By the end of this sentence there will probably be a new one (or several). But anyways, you have the option to use you favorite framework or if you're old-school you can go vanilla. WordPress doesn't limit you or put a gun to your head to make you use something you don't like. There are a lot of people out there making packages so your new favorite framework can work with WP, just do some research and you'll find a lot of resources.

So this is just my experience on working with WP. At first I was stressed because this is a whole new world, but it's not hard to learn; specially if you go in with the right mindset. Even if you still don't like it and want to argue with me and tell that I'm a dumbass for using WP, truth is, companies still want people with experience in WP. It will only help your career to at least know the basics. Learning new things never killed nobody (unless they're poisonous) so don't be afraid to learn new skills, find new issues to solve and improve your communication with your clients, designers and teammates.

Whenever you start with your project, learn how to make it your own. If you're used to certain tools, do your research and I can bet there will be a way to implement them on your WP project. But most importantly, stop thinking WP sucks because, maybe, you do!