JSON Viewers

As I am working on a web application using WordPress and Pods.io, I had the need to find something specific on a very big array.  This took me to a few searches as to how to best output this array for my troubleshooting.

I ended up finding some good JSON Viewers that pretty much helped me solve my (array) challenge.

I think most of them are great, I even installed the Chrome extension which lets me see view local JSON files.

Here’s the list for someone out there looking for JSON viewers … or even for my own reference:

How To Structure a WordPress Plugin

There are different ways to organize the structure. And as other say in this Stack Overflow post, it depends on the plugin and what it does.

It is good to test what works best in terms of having things organized in order to find easier and maintain code.

As it happens with coding, sometimes you start with just a few lines of code and end up with hundreds and a few files to include and then there’s the classes and the styles, and, and, and.

This reminds me how it goes with any type of project when the scope becomes not so clear.  And this may be in part because of the many parts involved not understanding the technical parts and what it really takes to make structural or functional changes.

Remove HTML tags using jQuery

I will need this simple jQuery code in order to remove some HTML tags as opposed to doing it with CSS.  Because there is a web application I am working on that runs on WordPress, I am making a requirement to have JavaScript enabled in the browser, otherwise the user will be redirected to a static HTML page that suggests to enable JavaScript.

Having said that. Here is the code I am planning to use with which I will be able to remove certain elements that are not necessary.  Even based on the roles and permissions of the user.

See the Pen jQuery Remove by armandoduran (@armandoduran) on CodePen.light

Getting Relationship Fields

This title may get confused someone not familiar with coding in WordPress for a moment!

I am leaving some code here for my own reference as I think I will need to have this handy for a number of times or even share it with others that may need it as I continue to work on creating a Web Application using WordPress and Pods and a number of other cool plugins.

This I found from a very good post from SaltnPixels called Playing With Pods.

That said, here is the first peace of code that I will need to adapt on my own logic for traversing the different tables associated with relationship fields in Pods.

Basically the field() function will return an array of pod items from the relating post type. You can then go through these pod items and do what you want with them.

Here I am getting the zoos that are connected to this animal. Then I am going through each of them and echoing out each zoo’s name. I find the most important piece of info is the related ID’s. With those you can do everything.


Getting Related ID’s Easier

I don’t usually need all the stuff that comes with the related posts. An array of ID’s is usually simpler to work with for me. Here is a little trick to get the related ID’s as opposed to all of the stuff.

Above I have changed the field function to field('related_zoos.ID') which gets the ID’s only. Now when I make a for each loop, I’m looping through simply ID’s and nothing else. Pretty nifty. You can fine tune the field function to get a list of anything in those posts!

In fact the field() function can take a string that traverses through the tables and gets anything! I can do field('related_zoos.zoo_location') to get a list of zoo locations from each zoo related to this animal!

Sass vs. LESS

I have come to the point of really wondering what per-processor for CSS would be best to use.  Since I’ve been following CSS-Tricks for a few years now, I think I’ll trust the following statement about Sass vs. LESS:

Really short answer: Sass

Slightly longer answer: Sass is better on a whole bunch of different fronts, but if you are already happy in LESS, that’s cool, at least you are doing yourself a favor by preprocessing.

Before & After the_content

This is a very good code example for putting info before and after the_content:

Code was taken from here.

An Alternative to @import in WordPress Child Themes

I happened to find this by accident as I was creating a child theme to be able to help someone at the WordPress.org forums.

Basically, instead of doing this on the style.css of the child theme:

Add the following on the functions.php of the child theme:

This alternative makes sense and it does work!

The functions.php Dilema

Over the years I have found lots of different solutions and additions to a WordPress website’s functionality using functions.php.  The reality is that I think there has to be a clear definition of when to put code in the functions.php file of a WordPress theme and when to simply create a plugin.

So on that note, here are some interesting posts I have found on the subject and some of the things that I found interesting and worth noting:


Stop adding code to your WordPress theme’s functions.php file

by WP Ninjas

  • If you are comfortable modifying your functions,php file you are fully capable of creating a simple plugin
  • It’s extremely easy
  • It can mostly be copy and pasted each time you want to make a new one
  • Any code you’ve already pasted in your functions.php can most likely be used in a plugin

Read original post

Why You Shouldn’t Use functions.php (And What You Should Do Instead)


At the core of WordPress lies a simple principle: design and functionality should (whenever possible) be clearly separated.

That is why we have themes and plugins; ostensibly, themes are solely responsible for design and plugins are solely responsible for functionality. One should be able to switch themes without affecting functionality, and one should be able to deactivate plugins without affecting design.

Read original post

WordPress Functionality Plugins

by CSS-Tricks

What is a Functionality Plugin?

A functionality plugin is just a plugin like any other plugin you’d find in the WordPress Plugin Repository. The main difference is that it wouldn’t be publicly distributed, because it’s specific to your site. It’s one custom plugin that encompasses all your site’s custom functionality.

Modular Design

If you’re like me and like to keep things neat and tidy, this is a great time to use a modular approach to the code you place in your plugin.

One approach to keep things simple is to organize your functionality into similar groups and give each of them their own file. Then, include those files into the main file of the plugin using PHP includes. Make sure you notate your functions so when you return to them at a later date you know what’s going on.

Read original post