Recent Posts

The Restructuring – Codehooks In The Encroaching Future

By: Adam on in General - No Comments

When I first started CodeHooks back in 2013 I didn’t have a plan. My only goal was to generate a resource where I could share my plugins, themes, and general ideas on web development and WordPress in particular. It was a personal project that I let stagnate every now and again. However I still truly believe CodeHooks can become a wonderful value added project that can help the WordPress community.

That is why I’ve decided to begin restructuring CodeHooks. I’m going to be making more categories, combining old ones and making things simplier and easier to find and navigate. I’m also taking CodeHooks from a personal project and adapting it into a business project. This will give me more motivation to take this site to the next level.

Starting today I’m going to be restructuring the categories, and re-organizing some of the posts. I’m also still working towards an updated CodeHooks 2.0 theme and a 50 or so post on a WordPress beginner series that I think I’ll release one post each week over the course of a year or over a few months we’ll see how popular it will become. The more popularity the faster the post’s will appear.

Going forward you will begin to notice advertisements on the site. I need a way for the site to make a bit of money to support the new business venture and to provide you with as much value as I possibly can. Don’t worry though all ads are hand screened for quality and will all be highly targeted to WordPress. Basically if you see an advertisement on this site you can rest assured you won’t be getting scammed or ripped off by that offer.

I’m also going to be releasing a few e-books over the coming year as an alternate way to help support CodeHooks. Additionally I’m planning on upgrading the Social Graph Protocol plugin to a new fancy faster, cleaner version in the near future. I’m also hoping to develop more quality plugins in the coming years.

If you like the work we do at CodeHooks there are a million ways you can help support us, the biggest way is to buy one of our products. However if you don’t have any money you can support us by following us on Twitter, liking us on Facebook, leaving comments on the articles we write and/or providing us with some quality targeted links back to us. The possibilities are endless.

The future is filled with possibilities and I believe the WordPress community can benefit from the added resources such as CodeHooks. I hope to see you around in the future.

Why You Should Never Delete Your Facebook Account

By: Adam on in Marketing/Advertising - No Comments

First off I wanted to clarify how this relates to Web Development since it appears to be a generalized post. While it relates because as website owners there comes a time when we need to market and/or advertise our site in order to take it to the next level and this post is all about what not to do on the Facebook advertising platform.

Now that little disclaimer is out of the way, let me re-iterate the topic of this post that is why you should never delete your Facebook Account. The answer is because Facebook is going to turn around and ban you from advertising on there platform if you do. Yes that’s right there going to yell fraud and you’ll be banned and all of your future advertising efforts will cease to exist.

You see over the years I’ve grown extremely tired of logging onto Facebook only to see people complaining about useless things day in and day out. I wanted to literally remove all my friends (only about 130) and just use Facebook for advertising. Bottom line I no longer wanted to use Facebook as a consumer I only wanted to use them as a business. So instead of keeping my account I decided to delete it and start fresh. I deleted the account and waited the 14 days before returning.

After the 14 days were up I returned to Facebook (I actually waited more like 20 days) and I signed up using all of my legit information (nothing false) and all the information I had on my old Facebook account the only difference in this account was I promised I was not going to add any Friends because I just wanted to use the advertising platform.

On my first day back I jumped straight into the ad platform put in my information, added my payment methods and tried to start advertising, again nothing illegal or scammy or anything black-hat or gray hat, this was straight up white hat stuff. Well after about 4 hours and no ads running I get a message saying my account has been flagged for suspicious activity and please contact Facebook.

I thought oh great what is that about, so I contacted Facebook waited another 2 weeks for a response. They asked me to verify my identity by uploading pictures of my drivers license and a bill. I did all of that and they told me that my account had been flagged for fraud and they would not be re-activating it at this time.

What? Fraud? I had my old account in perfect standing for over 5 years and all I did was delete it in order to start new and your telling me that constitutes fraud in the eyes of Facebook? Well the answer is yes that apparently it does. So now my good Facebook advertising account using my legit information can no longer be used.

Now here is the flip side of things. I can’t use my perfectly legit information to advertise on Facebook anymore, however I can set up a completely fake profile, use a pre-paid credit card, and then I can advertise on Facebook. How does that make any sense I can use grey-hat/black-hat methods to advertise on Facebook but I can no longer use my perfectly legit information anymore.

That is a huge failure on the part of Facebook and I hope in the future it doesn’t happen to anyone else and that they get there fraud team to realize deleting your account and starting fresh while keeping all your information the same and proving to Facebook you are who you say you are does NOT constitute fraud and should NOT result in your advertising account being banned.

A Disturbing Trend For Premium Themes

By: Adam on in General, Themes - No Comments

Awhile back I purchased a theme from Theme Forest called the Flag Theme. The day I purchased the theme everything seemed fine, being a developer myself I was not super pleased with some aspects of the code however it was not a deal breaker.

After a few days of using this theme I noticed that I’ve been getting a lot of new user registrations, at first not thinking anything of it I thought hey maybe I’m onto some sort of popular niche and people are liking what I have to say. But then after about a week and a half I decided to have a look at some of the user registrations.

I found that every single one of them were extremely spammy so I thought great someone decided to send a bunch of automated spam bots to fill up my user database. At this point I never did suspect the theme was at fault.

Then a few months went by and I purchase another premium theme from Theme Forest called the Good News theme and the same exact trend started. I was getting hit with a bunch of completely spam filled users, literally one day after the site launched I was getting user registration spam. Only this time I was getting this type of spam when I knew for a fact, I was 100% certain no real human was actually visiting my website at that time.

This is when I started to suspect that the premium themes I had purchased were to blame. I began to think if this has ever happened to any of the themes I’ve personally built and the answer was a big fat NO. The Codehooks theme, being somewhat new at the time wasn’t even being hit by spam users. Come to think of it the only time I’ve ever been hit by spam user registrations was when I purchased a premium theme.

The only logical reason I could think of was that these theme developers attempt this type of trickery in order to make unsuspecting people think there sites are more popular than they really are. I mean think of it you buy a new theme and all of a sudden your getting new user registrations and you think people are reading what you have to say all because of the new theme.

Well I’m here to say if you employ those types of dirty tactics in your premium themes then I’m outing all of you and never buying a thing from you ever again. I wasted over a hundred bucks buying themes that are essentially designed to spam you.

I should mention that I’m not against premium themes, I’m actually building one myself that I plan on selling in order to make a few extra bucks, what I am against is people who attempt to employ spam techniques or use malicious types of code in there premium themes. I hate that with a passion because it gives all the good developers a bad name as well.

Anyway I’m curious to know if you’ve ran into this type of trend yourself? If so what free or premium theme were you using at the time and did you continue to use the theme or did you move on and decide to find a different theme? Let me know in the comments below.

Understanding How CSS Line-Height Get’s Calculated

By: Adam on in General, Programming, Tutorials - No Comments

Today I wanted to take a quick minute to show you guys something that may very well already be pretty obvious. But hopefully you’ll learn at least one thing. What I’m talking about today is understanding how the browsers calculate the CSS Line-Height property.

Let’s jump right into an example and I’ll show you why it’s so important to understand it. First thing is to know that the line-height property can have four different values, the first being the default value if no value is supplied, the second is just a simple number with no units, the third can be a length and the fourth can be a percentage.

Default Calculation

Line-height is calculated based upon the font-size of a particular element, for instance in a typical body style you might notice a line that looks like this.

font: normal 16px Arial, sans-serif;

This line specifies a default font-size of 16px, so any other element that contains text with no line-height. The line-height will default to 16px (So far very easy to understand).

A Unit-less Number

The line-height property can also have a unit-less number which may look something like this in a style-sheet.

line-height: 4;

So what actual height would that value boil down to? Well if your using the unit pixels in your body declaration (which in this example we are) than the browsers will calculate the value of 4 into a pixel based unit but the answer is not 4px.

How the browser does this is multiples the unit-less line-height number by the default font-size specified in the body tag. So this 4 would get multiplied by 16px and we would wind up with a total line-height of 64px (16px x 4).

Lets take things a step farther and lets say that in our fictional style we also specify a font-size along with our line-height but this time we specify the font-size in em units and not px. Our style might look something like this.

line-height: 4;
font-size: 2em;

Now our body tag specifies the default font-size to be 16px but in our new style our font-size is 2em. Now 2em basically says take the default font size of 16px and double it so that it now becomes 32px. If our font-size was 3em the conversion would be 16px (default font-size set in body tag) trippled resulting in an overall font-size of 48px.

So how does this effect our line-height conversion. Well if our font-size is 2em that also means 32px, our line-height value in pixels will now be 32px (2em) x 4 (line-height) = 128px. That is how line-height gets calculated down into a pixel value by the browser.

Another quick helpful tip is that you can also calculate the unit-less value of line-height if your only given it in pixels. For instance when we set our font-size to 2em what if we were trying to find the unit-less value for the line-height instead of the pixel value we were provided.

Another words if our line-height was 128px what is the unit-less number that equals 128px. In this case we would simply divide 128px (line-height) by 32px (2em or double our default font-size set in the body tag) = 4.

Finally if our line-height was some random number like 67px and we didn’t have the font-size 2em style. Our calculation would be 67px / 16px = 4.1875. The 67px set in our line-height and the 16px set as our default font-size.


I hope I didn’t confuse you too much with those examples of how line-height is calculated but just in case I did, you can jump over to the Mozilla Development Network that gives you a cleaner write up that may make things become a little bit more clear.

The reason why this is so important is because it makes vertically centering text based content a billion times easier than trying to work with absolute positioning or vertical-align attributes. By generating a height value with line-height the text becomes vertically centered without any additional hassles.

How To Perfectly Center A Variable Width Element Using Pure CSS

By: Adam on in General, Tutorials - No Comments

I’m sure at some point or another we’ve all ran into an issue where we were able to perfectly center an element only to have it completely fall apart when the width of the element changed on us. Well those days are over and this is a little CSS alignment tip will hopefully save you some heart-ache in the future.

First off an example, that was taken from a prospective header I’m currently working on for the new Codehooks website. In the first image below you can see everything is aligned perfectly.

Codehooks Header

The css code that was used to get this type of look is displayed below.

.site-title {
    position: absolute;
    left: calc( 50% - 115.5px );

As you can see I’m using an absolute position because the header in question is fixed (it will come with us as we scroll down the page). Then as you would expect I’m moving it to the left 50% and then I’m moving it back 115.5px that is half the width of the text (I used Photoshop to measure the full width).

This solution works perfectly fine if you never ever have to change your title, however if you do change it down the road, look what happens to your perfect alignment.

Codehooks Broken Header

Everything is tossed out of wack and it’s back to the drawing board. Well to fix this what we do is to first make sure our text or image has a parent (any parent will work) such as an H1 tag, if your using WordPress chances are your HTML will look something like this.

<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>

That is a pretty standard item to find in your header.php file. The proper CSS to use with this HTML is the following.

.site-title {
  position: absolute;
  left: 50%;

.site-title a {
  position: relative;
  right: 50%;

As you can see what I’ve done is changed the first CSS style to have a left justification of 50%, however to align it perfectly I have to move it in the reverse direction (half of the items width). I achieve this by jumping into the child node and setting its right justification to 50%. The result is the following.

Perfectly Aligned Title

This works perfectly, now the title can be changed to anything we want and it will always be centered. This works because of the way HTML handles the parent/child width. The parent width will default to the width of it’s children. Meaning if you use a right justification of 50% on the child that’s the exact same thing as saying move me to the right by half of my width.

If your completely lost head over to CodePen where I’ve added a live example of how all this works together. Change the HTML where it says “Short Title” to something longer and you’ll notice the text is always perfectly aligned. Now remove the CSS attribute right: 50%; and try again and you’ll notice it’s no longer perfectly centered.

If you have any questions about this example please let me know in the comments below and I’ll do my best to help explain how this works in greater detail I’ve actually left something out about how text is aligned on the page but most people will already know what that is.

Again don’t be shy if you need more information I’m here to help.

Creating a Popout/Slideout Style Search Box Using Pure CSS & HTML

By: Adam on in General, Tutorials - No Comments

While creating the new theme for Codehooks I’ve decided to use a Popout/Slideout style search box for the design. This search box is great from a responsive design stand point and also holds up quite well from a usability or UX standpoint. To really show you what I’m talking about check out the little demo I’ve created on Codepen.

Click Here For The Demo On Codepen

Disclaimer: The demo on Codepen has only been tested on Chrome V.43 and IE 11 and may not work as intended in other browsers.

I’ve taken the time to comment the CSS as best as possible so I’m not going to talk about it in detail, additionally the HTML portion (shown below) is what you’ll see when using the WordPress function get_search_form(). The only difference is that I’ve removed the label, submit button and changed the placeholder text for this demo, oh and removed that default DIV tag as well.

<form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
	<input type="text" class="field" name="s" id="s" placeholder="Type a word or phrase and press enter" />

As stated above I’ve documented the CSS quite well so I’m not going to discuss it in this blog post. However if you are having trouble understanding something with the code or are wondering how to migrate it into your theme, feel free to ask me a questing in the comments and I’ll do my best to help you out.

/* This Styles the FORM tag, nothing special just some WIDTH, HEIGHT, PADDING, & a BORDER to make the search icon look pretty */
#searchform {
  height: 32px;
  padding: 20px;
  width: 32px;
  border: 1px solid #e2e2e2;
  cursor: pointer;

This displays a search icon but it doesn't work on CodePen (It defaults to a small black square shape. To learn more about using Genericons visit
#searchform:before {
  content: '\f400';
  font: normal 32px/1 'Genericons';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

/* These next two tags are used to generate the effect seen in this demo */
#searchform input {
  /* On page load hide the input box and change its width to zero */
  visibility: hidden;
  width: 0px;

  /* Align the input box so that it matches up with the search icon */
  position: absolute;
  top: 8px;
  left: 81px;
  height: 72px;

  /* give the input box the same height as the search icon */
  /* Clean up the input box making it look visually cleaner (not required for the effect) */
  font-size: 18px;
  padding: 0 10px;
  border: 1px solid #e2e2e2;
  color: #5c5c5c;

/* This is where all the real magic happens */
#searchform:hover input {

  /* When we hover over the search icon make the input box visible and set it's final width value */
  visibility: visible;
  width: 500px;

  /* This controls the animation, it transitions the width from 0px (set previously) to 500px (set in this style) over a period of 1 full second */
  transition: width 1.0s;

/* Disable the browser outline when the input field is active (just used to make it look visually cleaner) */
#searchform input:focus {
  outline: none;

Tip: This code and the comments in it are a billion times easier to read on CodePen. Also I’ll say it again if you have any questions please feel free to ask me in the comments below and I hope you enjoyed this little demo.

Preparing For WordPress 4.3

By: Adam on in General - No Comments

Well Today I took a bit of time to test the Social Graph Protocol plugin against WordPress 4.3 and everything seemed to be stable enough so I updated the plugin to reflect which version of WordPress it’s compatible with. However if anyone notices or has any issues with it once 4.3 officially drops let me know and I’ll look into it.

I’ve been trying to re-design Codehooks for quite some time now and it’s only been this past week where I’ve actually started making some progress but then I got into WordPress 4.3 and well that whole thing set me back a little bit, not much just took my attention off my development efforts is all.

In my opinion nothing really special about 4.3 for the average person, a few cool little Plugin things there changing up as well as some visual code editor changes are coming our way. One thing topped my interested was there getting ready for PHP 7 they said in one of the posts and I thought hold on I’m using PHP 5 and were getting ready for PHP 7. What the fuck happened to PHP 6 did I just arrogantly ignore an entire iteration of my programming language?.

Anyway hoping to get some time to change up Codehooks and get back to writing more meaningful content instead of these stupid little updates every now and again. If there is anything you’d like me to talk about or help you with in the meantime just let me know in the comments below.

Facebook’s Advertising Review Teams Are CRAZY

By: Adam on in General - No Comments

Sunday nights and Thursday afternoons is when the Facebook advertising review team goes from a normal group to being straight up crazy, take a look at the image of the beautiful Hilary Duff below.

Hilary Duff Sexy

Now as it turns out on Sunday nights and Thursday afternoon’s this image is considered to show too much skin and is suggestively naughty enough to be denied access in a Facebook advertisement while any other day of the week it’s perfectly acceptable.

This goes for your Ad copy as well, go ahead give it a try use the words “Dating” in your title/copy even if you don’t have any promotional material on the other end that would suggest that your promoting anything dating related you may still wind up being denied.

I’m just here to rant about wasting my time on some campaigns I’ve been running recently but I will share a helpful tip for you, if your advertisement gets denied and it’s not blatantly breaking the ad-policy guidelines. Just wait 30 minutes, change up one minor targeting option and re-submit your ad.

Do this three or four times if you have too because you’ll eventually get someone level-headed and they’ll approve your advert like nothing was ever wrong with it in the first place. The reason is because apparently some people working on the ad approval team seem to take the guidelines WAY too seriously while others realize there only guidelines not set in stone rules to follow.

Social Graph Protocol Plugin Version 2.0.6

By: Adam on in General, Plugins - No Comments

In the coming hours you should start to see updates inside of your WordPress installations for the Social Graph Protocol plugin. I was just playing around with it and realized that for some odd reason a few months back when I pushed the 2.0.5 update something wen’t VERY VERY wrong and the files were corrupted and half of them were deleted so it caused some issues for sure.

Anyway I decided to get off my ass and rectify that situation and after getting into a fist fight with SVN I came out victorious and managed to update the plugin to version 2.0.6, unfortunately it does not contain any new features at this point, just a fix to the 2.0.5 upload disaster.

Quick Plugin and Site Updates

By: Adam on in General - 2 Comments

After not posting on CodeHooks for about a year I decided not to let the domain and the social graph protocol plugin die, instead I intend to resurrect both of them and as of today I pushed an update for the social graph protocol plugin and wanted to say that I do intend on updating all of the code, it will be getting one massive overhaul in the coming months but for the immediate future the update I pushed was simply to avoid having the plugin deleted from the WordPress repository so no changes were actually made (Yet).

On another note I’m spending today and probably the next few weeks re-designing the CodeHooks website from the ground up I originally intended the site to be a place where I can help other WordPress users with there troubles, share my code with the world and to get my name out into the world. That is still the true intention of CodeHooks, however this time around there will be a twist, I’m attempting to turn my programming and web development skills into a full time career, be my own boss type of stuff.

With that said you will see advertisements on the site in the future, sometime after the re-design it won’t be anytime soon and when I do it I promise any ad you ever see on this site will be extremely high quality I won’t allow people to advertise on my site if I haven’t tested there products and made damn sure it’s worth every penny. Along with ad’s I’m going to continue creating free but also paid WordPress plugins, I have a great idea for a paid one coming in the future but I won’t get too much into that as well.

As for publishing content on the site my intention is to create at least one post per week starting sometime in the new year. That is all for now, just a quick little update as to where things are headed with CodeHooks. I’m making some BIG changes and going to be giving my readers/fans some good products and services in the coming year so keep an eye out in the future.