Be Thankful For Hard Days In Life and In Code

We have all heard the term be thankful for what you ask for, and with that said I have recently been not so happy with lack of coding challenges I have had with my daily work. What I mean is doing the same mundane thing can get boring but sometimes you want to have that challenge.

The Task

I have been wanting to re-build the basic blog layout for my work and they had some caveats. Did not want blog posts but wanted the blog like effect with timed posts, like the idea of auto posting but did not want individual posts to be indexed, and last was they did not want a pinterest style grid but instead wanted a basic three row with a hard break in between.

Now this is not how to build it but to work with what you have. I had to take the theme they built the site on and dismantle it in terms of the blog section. Removed what did not need to be there and then came the fun.

Challenges

I noticed that getting all the CSS in place was the easiest part but the PHP was my biggest challenge. First I needed the posts to repeat which normally comes in the basic theme #done, and then I wanted to have them just simply use the built-in bootstrap grid…..I know about flexbox and css grid but this was already there. I could not get the rows to repeat, so I reached out to a wonderful person who has assisted me when I get into a pinch and she directed me to this:

First off the simple comments in the code made it for me, and my take away was that I first need to practice PHP more đŸ™‚ and also see the beauty of the counter and how it allowed me to get exactly what I was looking for. Another fun learning part of this was simply adding a class using PHP. I really never realized how easy it is. My problem was I needed to add a class to only the first post on the page:

And Boom there we go!

I walked away from this understanding how to successfully implement code to give me the 3 rows I needed and also how to add a class to PHP. Funny thing is I have been racking my brain to learn JS and all the freaking new libraries but sometimes a problem will pop out that is not even on your radar. This was not to show off my coding skills but instead to just highlight that it is important to be happy as a developer when you run into challenging things, and appreciate your network for assistance and learn from the guidance around you.

Thanks LIZ!

Tags: ,
%d bloggers like this: