Did you miss WordCamp NYC 2015?

Test
Reading Time: 4 mins

WordCamp NYC came to town this past weekend on Halloween! There was candy, costumes, cupcakes, and of course – awesome speakers! It was a great way to gather a new list of influential people to follow on Twitter and a new reason to hoard all the free swag. If there’s anything I learned from last year’s WCNYC, it’s that WordCamp is only getting better. I’ve learned a lot and a lot has changed since the last time I attended a WordCamp. I’d like to share that experience along with a late Halloween treat for those who may have missed the event.

Obvious, not so obvious hint – speaker slides list! Grab your leftover candy and let’s get to it.

Continue reading Did you miss WordCamp NYC 2015?

How to get WooCommerce Category Info with an ID

Tutorial Difficulty Level: Advanced

featWooCommerceCatByIdTWO
Reading Time: 8 mins

The universe has been telling me to write this post for a very long time. The first time was a year-ish ago, when I googled how to get WooCommerce category data with an ID and couldn’t find a clear answer. “Hey, this is a pain to find an answer for – this should be a blog post!” The second time was after I had posted a question on the WordPress Stack Exchange to find an answer, and then I answered it myself. “Whoa – I figured this out! I should tell people about this!”

Then that question eventually ended up earning me a “most popular question” badge. “Damn it, Rachel, people want to know about this – write a damn blog post!”

Okay, so I didn’t do it. Time passed and it was exactly yesterday ( when I began writing this post ), I was working in WooCommerce again, in the zone, went to google, and this happened:

Yep, that’s right everyone. I ended up googling the same problem I had already once resolved and ended up at the same Stack Exchange question I both asked and answered. All right, universe. You win this round.

To make sure I never ever forget I know how to do this again, I’m going to write it down! How to get the WooCommerce product category name, link, image, all the things with PHP so long as you have an ID to use, step by step, in tutorial form.

Before We Get Started:

  1. This assumes you’re familiar with PHP loops, objects and variables.
  2. This is a WooCommerce tutorial yay!
  3. I am using Advanced Custom Fields for this walkthrough, but you can use other methods like a regular Custom Field and re-work this solution to your purposes.
  4. I am getting category information on a page other than the category archive. If you’re on a category archive, check this WooCommerce documentation first for a head start. I found that the method there and the method I’m writing here are a little different depending on the template you’re working in.
  5. This solution is meant to work inside the loop.

Continue reading How to get WooCommerce Category Info with an ID

10 Ways to Learn WordPress Hooks

FeatTenHookResources
Reading Time: 9 mins

WordPress Hooks are hard. We always hear the word “hooks” being thrown around and it’s one of those things that make sense, but then it doesn’t.

I’m sure that there may even people reading this right now, and not entirely sure what I mean by hooks. That’s okay. Before I go on with this post, they look like this. These are two examples I pulled from the Twenty Fifteen Theme in functions.php.

Line 142 of functions.php in Twenty Fifteen.

Line 142 of functions.php in Twenty Fifteen, it’s an action hook.

Line 310 of functions.php in Twenty Fifteen.

Line 310 of functions.php in Twenty Fifteen, it’s a filter hook.

 

Still confused? No worries, it took me a while too. In fact, I can’t say that I completely know all there is to know about WordPress hooks even now, even after writing, “The WordPress Hooks Firing Sequence“. WordPress is the kind of thing that the goal isn’t to learn it all, but to learn it in levels for your purposes. It’s such a deep system, deeper than most people imagine, and I’ve found that once I’ve obtained an understanding of one concept, there is always more to learn. Each concept I learn serves as a foundation for what I learn next.

Hooks didn’t click for me until about a year ago. I too, was copying and pasting various solutions offered by the all knowing Google or Stack Overflow into my WordPress theme. I hadn’t truly understood what was happening when I dropped these snippets of PHP in and the world that would open once that understanding happened.

As much as I’d like to sit here and try to explain what hooks are, if there’s one thing I can say from experience, is that understanding comes in layers. In other words, there is no one mind blowing resource that is suddenly going to make it click. Or maybe it will, depends on the person I guess. For me, however, it took several readings, videos, and diving into WordPress code before the ah hah moment hit.

Knowing that it took a combination of resources and methods for me to learn WordPress hooks, I’d like to pass them onto you. These resources will hopefully bring that fuzzy definition of hooks into focus, even if it’s in layers. In addition to these 10 resources, I’d like to share 2 methods that worked for me. Everyone learns differently and at their own pace, but perhaps sharing my experience will help someone along.

Continue reading 10 Ways to Learn WordPress Hooks

The Adventures of Dream Seeking

5492971031_5655380b8c_z
Reading Time: 11 mins

I originally titled this as, “The adventures of job seeking”, but ended up replacing the word “job” with “dream” instead. I’m dream seeking. Not too long ago, I wrote this on Twitter:

You see, about 3 weeks ago I found myself confronted with a new challenge. What challenge is this? Being unemployed. There. I said it.

Now, “unemployed” is a scary word. I felt it was about time I share some thoughts about the topic. Why? Because I’m sure that I’m not the first or the last developer that will find themselves in this position in their lives. For those that have been fortunate enough to not be in this position before, if I can share some tips to help someone out before they’re ever in my place, then I want to do that. I’ve run into some obstacles and discoveries along the way, and here are some of the lessons I’ve learned so far.

Continue reading The Adventures of Dream Seeking

The WordPress Hooks Firing Sequence!

hooksFeatList
Reading Time: 25 mins

All right, so big questions for WordPress hooks. What hooks exist for use? And what is the WordPress hooks firing sequence?

As in, what order do WordPress hooks fire within their actual context?

There are two resources, the WP Hook Database by Adam Brown and WordPress’ Code Reference to search for hooks. These two are great, but for someone still testing the waters in learning these concepts, it’s pretty overwhelming. Just imagine someone trying to learn the English language and you hand them the English dictionary.

What is all this? There’s just so much here, how do I know what words to use? How much of this do I need? Where do I even begin? And of course, alphabetical order isn’t going to help unless you converse in alphabetical order, right?

The same can be said for the above mentioned resources for hooks. They’re handy if you’re already familiar with hooks and/or if you have a true understanding of how WordPress builds itself in the background.

And so I thought to myself, maybe if I knew what hooks happen all the time in WordPress’ routine processing, and in what order, that might be a good starting point. A piece of the dictionary versus the whole doggone thing. Turns out I’m not the only person thinking this way. There doesn’t seem to be a unified and updated resource to the hook sequence, their definitions, and which ones happen depending on their environment.

So, I figured, if I had this resource, then I can start learning the language effectively – as in, the language of WordPress hooks. If said resource doesn’t exist – maybe it’s time I make one.

Continue reading The WordPress Hooks Firing Sequence!