Charles Tips – Adding Custom Shortcodes to WordPress

I wanted to create a custom HTML code function, so made one that will generate a line feed. I tested it to neaten up the output from my favorite WordPress statistics plugin: WP-Statistics by Verona Labs.

This shortcode gives the ability to add line feeds to WordPress page, post or report outputs to improve their readability. The function can easily be modified to generate any HTML output by doing this:

      • rename “newline” in the “add_shortcode” line to whatever you’d like the shortcode to be named
      • adjust the HTML code inside the quotes in the “return” line

In this example, we’ll create the line break shortcode.

Creating the Line Break Shortcode

Adding shortcodes in WordPress is easily accomplished by simply inserting the appropriate coding for the shortcode into your child theme’s functions.php file.

Note: Child themes should always be used. Changes made directly to the parent theme’s files are usually overwritten each time the parent theme is updated.

To add the code, first back up your site and then do the following:

      • Log into the WordPress Dashboard as an administrator
      • Navigate to Appearance > Theme Editor
      • Select Theme Functions (functions.php) under Theme Files in the right column
      • Add the short function code lines below
/* -- Start of line breaks shortcode --*/
function line_break_shortcode() {
return '<br />';
}
add_shortcode( 'newline', 'line_break_shortcode' );
/* -- End of line break shortcode --*/

Adding Line Breaks

Once the code has been added to your functions.php file, all you have to do is add the
shortcode in your text to generate a line feed at that point. The beauty of doing this as a shortcode is that it can be inserted in places that do not normally allow you to add them – like in the email output of the WP-Statistics plugin.

Note: When testing your output from the WP-Statistics plugin, there is a convenient feature that allows you to send output every minute to see what you will be sending. As a rule I normally have the report set to send daily.

A Working Example

There were a couple of WP-Statistics report items that were of particular interest to me. One is the last post date. This is handy as a reminder when one should add one or more posts to a site – especially a blog – so the site content doesn’t appear stale (or as an alternative, simply do not show blog post creation dates). Even if you are not displaying the post dates on the site, it is good to know when you last posted something.

An example of the report pattern I used was this (note that in some WordPress themes the “[” and “]” characters in the example below display as repeated – there should only be one “[” opening shortcode character and one “]” closing shortcode character surrounding the shortcode itself when you use it):

WP Statistics report for https://CharlesWorks.com WordPress site:
[newline]
_______________________________________________
[newline]
[newline]
Last post date: [wpstatistics stat=lpd]
[newline]
Total Site Posts: [wpstatistics stat=postcount]
[newline]
Total Site Pages: [wpstatistics stat=pagecount]
[newline]
Total Site Users: [wpstatistics stat=usercount]
[newline]
Online Users at Report Time: [wpstatistics stat=usersonline]
[newline]
_______________________________________________
[newline]
[newline]
Today's Visitors so far: [wpstatistics stat=visitors time=today]
[newline]
Today's Visits so far: [wpstatistics stat=visits time=today]
[newline]
Yesterday's Visitors: [wpstatistics stat=visitors time=yesterday]
[newline]
Yesterday's Visits: [wpstatistics stat=visits time=yesterday]
[newline]
_______________________________________________
[newline]
[newline]
Total Visitors: [wpstatistics stat=visitors time=total]
[newline]
Total Visits: [wpstatistics stat=visits time=total]
[newline]
_______________________________________________
[newline]
[newline]
End of WP Statistics Report.
[newline]

I used the underline characters to separate various parts of the output for clarity. This report pattern generated a nicer, more readable report that even looked great when viewing it on my cell phone.

While I initially added this function as a way to neaten up the output of the WP-Statistics email report – the function should work just about anyplace in WordPress except in the PHP coding itself.

Charles Tips – Adding Akismet comment spam protection

Akismet provides a convenient and free way to protect your personal WordPress site or blog from spam.

Many times we’d like to allow comments to be left on our WordPress site. The hassle with this can be the tremendous amounts of spam that come through the forms on websites.

Akismet is a compact WordPress plugin that filters the incoming comments. It is pretty straightforward to use and pretty easy to set up as well.

Install the Akismet plugin

The first step in this process is to ensure that the Akismet plugin is installed in your WordPress website:

      • Log into your WordPress website’s dashboard as an administrator
      • Click on Plugins in the left dashboard navigation column
      • Look and see if Akismet is listed – if it is – and it is not activated you can proceed to the Akismet Setup step below – otherwise
      • Click on Add New under Plugins in the dashboard navigation column
      • If you don’t see Akismet in the plugins, then in the text box to the right of the work Keyword in the row starting with Featured type in Akismet – then click on its Install Now button. Do not activate it yet.

Akismet Setup

To set up Akismet you will need an API code from the Akismet site. The first step in that process is to navigate to:
https://akismet.com/plans

This (as of the time of this writing) brings you to a page that should look similar to the screenshot below.

Akismet offering pricing page
Akismet offering pricing page

To get the free version of Akismet comment spam protection, you will need to click on the Get Personal button on the above page.

Once you’ve done that, you should see a page similar to the one below. Before attempting to fill out anything on this page, we need to set that $36 / YEAR to $0 / YEAR. Click on the $36 / YEAR box and drag it to the left.

Akismet Default $36 per year page
Akismet Default $36 per year page

Dragging that $36 / YEAR box to the left should change the page to display something like the one below showing 0$ / YEAR. You can also see that the information to fill in has changed.

Akismet $0 per year page
Akismet $0 per year page

Now fill in the information completely. Note that you need to be able to check all three checkboxes indicating the following:

      • you don’t have ads on your site
      • you don’t sell products/services on your site
      • you don’t promote a business on your site

If these are the case, then you will qualify for a free, personal plan.

All you have to do once you have gotten this far is follow the directions on the page below.

Akismet signup complete page
Akismet signup complete page

Finally, it is suggested that while on that settings page in Akismet, you can choose to show the number of approved comments beside each comment author and choose whether to show a privacy notice or not. Then just click the Save Changes button and you are on your way!

Charles Tips – Checking Your Site

Something many folks overlook is occasionally checking their website’s functionality. I recommend doing this every couple weeks, but at minimum once a month.

Most websites and the servers they are on are subjected to ongoing software updates. Unless you are paying an additional fee for maintenance checks, it’s normal for things to occasionally break due to updates.

Most website owners are not paying additional fees for such maintenance. This means you really need to take the time to check:

– that the site appears to work properly
– that your hours of operation are correct
– that any website forms are working
– that email addresses are correct

The site operation and forms are most susceptible to software updates. If you have a good web developer, the fixes will happen quickly and it will not cost you too much.

Website maintenance should be thought of like automotive maintenance. We get oil changes. We get inspections. We even make modifications and do repairs to keep our vehicle operating the way we want. And our older vehicles can cost more to upkeep – just like older websites. As websites age, more work needs to be done to keep them secure and working as originally intended.

So check your site every now and then to keep things working and have the correct information out there!

Charles Tips – Engagement

Engagement, in military terms, is described as a fight or battle between armed forces. In web terms, engagement could be thought of as the process of getting an idea across to accomplish a goal.

There are a couple major goals with websites, as I see it. One is to simply share information. Another is to sell products. Make no mistake about it – whether you are selling widgets or ice-cream or trying to increase your congregation – the goal is the essentially the same – getting people engaged.

The first, sharing information, definitely is a precursor to the second. I’d like to focus on the second here.

Websites that are more engaging with their visitors will encourage more sales. With that in mind, it follows that engagement is a result of information and aesthetics.

Aesthetics costs for a website can vary greatly. Graphic design can be time consuming. This equates to higher labor costs. Information in written form, however, is usually the least expensive part of website development. Text can usually be pasted into web pages. This is not usually as labor intensive. Having more information in text format on a website usually equates to more exposure to the public. This is because website visitors can arrive using search engines. And the search engines find your site based upon pertinent content – mostly text.

In a nutshell, if you want an engaging website – which will increase your probability of success on the web – make sure there is plenty of information in text form on it. Search engines will help get folks there and your aesthetics can do the rest.

Charles Tips – Blogging

A popular website sales pitch over the past ten or so years has been about blogging. Many web developers believe that blogging is an absolute must to get found on the web. However, believing doesn’t necessarily make it a fact.

Whether blogging will be a benefit your particular web presence is complicated. There are a number of factors to consider.

A major factor is that blogging requires time to be effective. The time has to be spent by someone entering blog material pertinent to your business or topic into your website. Otherwise you have to pay someone to keep up with it.

Keeping blogs interesting to keep site visitors engaged is another ongoing endeavor. Site visitors won’t return if the material doesn’t hold their interests.

The real power of blogging lies with search engine placement. Search engines rank websites on how pertinent they are to a particular topic or search terms. Search terms are generally words or phrases people type into search engines when they are looking for something. The more pertinent – the higher the ranking. Having more pertinent material on a site increases ranking.

So when considering whether a blog is right for your web presence or not, bear in mind that a blog must be an ongoing, continuing effort. It may be just as effective to simply have a lot of static material on your site explaining details about all your offerings.

Charles Tips – Persistent Scammers

I’ve written several articles about specific scams that are occurring on a regular basis on the Internet. They seem to subside for a short time – a very short time – and then a wave of them happens again.

One of the worst – as far as I am concerned – are the ones where the email recipient is being told they must verify their email. These have some common traits with most Internet scams:

1) A sense of urgency – they want you to take care of this immediately

2) A time limit – they give you within 24 hours to act

3) A threat – they tell you your email will be locked.

The first thing you have to understand is that nearly everyone gets these on occasion. I have received them myself in which they are made to look like they are from CharlesWorks. So when our clients get these they tend to become very worried very quickly.

I can’t stress enough that most legitimate companies will not send out messages like these. To fall prey to these can be a real nightmare. With access to one’s email these days the bad guys can wreak havoc in one’s life. The worst cases are called identity theft!

Don’t be the unfortunate one who falls prey to these scammers. If you have been “notified” of something serious – call your provider up and speak with a representative. Just like at my company – it’s a lot easier for us to allay your fears than to have to try to clean up the mess that can happen with compromised accounts.

Charles Tips – Trademark and Copyright Familiarity

In the web world, copyrights and trademarks can get business owners in hot water. Many experienced web developers have an awareness of when legal assistance may be required to resolve such issues.

While I am not an attorney, I can say with a fair degree of certainty what items are safe to use on one’s website.

First and foremost are graphics that you create yourself or have created for you by someone you hire to produce them. However, an exception to that is if the graphic created is similar enough to a copyrighted work to create confusion to the viewer.

Next are photographs. Usually using your own photographs is pretty safe. Photos not taken by you is always risky unless you have permission to do so.

There are various sources on the Internet for pictures and graphics that allow unlicensed or licensed use – otherwise “free to use” graphics or photos. Pixabay.com is one example. It has many items that can be used covering many topics, classifications and so forth.

I recommend you use an experienced, seasoned web developer. A general familiarity with trademark and copyright issues is more apt to be found by using a seasoned website developer. When in doubt, as a business owner you should consult a trademark or copyright attorney.

Charles Tips – The big SEO Scam

I’ve mentioned SEO (Search Engine Optimization) throughout many articles. While it is important – I believe it’s the most abused area of website development.

SEO scammers are great liars
SEO scammers are great liars

It’s important for your business website to be found in the search engines. That is best and most inexpensively done by having pertinent material in your website so the search engines see your website as pertinent or closely related to a topic.

There are many unscrupulous individuals and companies out there selling just plain bogus SEO. It’s often impossible to discern the truth. There are no regulations or meaningful certifications in this field.

As an example – let’s say you receive a dozen Viagra spam messages in a month. Does that mean you need it? Certainly just because a number of spam messages are saying you need something doesn’t turn it into a fact.

Why would you believe the same about SEO regarding your search placements on the Internet? Our web clients are bombarded with spam and with phone calls saying they need this and that for their websites. Some fall prey to these sales pitches and some even go out of business as a result of spending hundreds of dollars each month on scams.

Your web developer should care about you as a client – should want you to be as successful as possible and not up-selling you right out of business.

The worst part of the SEO scams is they can oftentimes hurt your placement with the search engines.

Don’t fall prey to the scamsters selling these bogus “services”. Check with your web developer FIRST about such offers to find out if they are for real or whether you actually need them.

Charles Tips – No Domain or Hosting Contracts

Two components of a website are the domain and hosting. Websites are accessed easiest with these.

Domain names are labels typed into web browsers that point to a particular website. Usually they’re a word or words pertinent to the website. Each domain is unique. There can only one of each in the world.

Hosting is a server space for a website. It’s available 24-7 for anyone anytime it is accessed. Websites usually contain coding that shows what the site visitor would view as a website.

Finally, the website coding can reside in the hosted web space. That’s what makes the site appear. Or the coding may just jump off (redirect) to go to a different address.

My favorite analogy is to a house. There’s an address (domain name). It’s rented each month (hosting) so one can show off its furniture (web coding). It doesn’t matter whether there’s a little or lots of furniture – they pay rent (hosting).

No Written Hosting or Domain Contracts Required
No Written Hosting or Domain Contracts Required at CharlesWorks

Does your web company require hosting or domain contracts? Reputable ones won’t. They’re willing to ALWAYS provide the best service to you instead of just before contract renewals.

Contact your hoster to determine whether they’ve locked you in or you’re free to move where you can get the best service.

Charles Tips – Nightly Website Backups

Your website is an important investment. Whether you made it yourself or paid to have a professional develop it for you – you wouldn’t want to lose it. We have taken on clients who were with the largest company in the world who lost their website because of having no backup. The terms for doing business with that company even state they are not responsible for the loss of the website.

Nightly Backup Server

I couldn’t imagine not backing sites up. Nowadays the technology is ever present to back everything up. In the not too distant past, hard drives were much more expensive than they are now. Hard drive space is extremely inexpensive nowadays – so there’s no excuse for a company to not make backups.

One third of today’s sites are on a platform called WordPress. Security updates happen often and changes can be readily made to WordPress sites – so they need backups at least every day. Whether there’s a server catastrophe or simply one of your employees blowing up your site while making changes – it can be recovered.

Definitely protect your website investment by hosting with a company that provides daily backups of your WordPress website every night for at least a month. That will avoid having to restart your website from scratch.

Charles Tips – Forming Reciprocal Relationships

It’s always great to get referrals from others. That’s why it’s important to deal with a web company that understands your community and reciprocates by referring business to you.

Businesses built upon reciprocity help each other with success
Businesses built upon reciprocity help each other with success.

As a point of curiosity I usually ask when the last time was that a company received referrals from their web hoster or web developer. Usually the answer is never. I am amazed to usually find out at that point that even their local folks they give their web business to don’t bother to refer others back to their own clients.

You need a web developer that does that as a rule rather than as a request. You need a developer that one or more of its staff are in high powered networking chapters and experienced at referring business back to their own clients.

That’s what reciprocity is all about. You need a web company that practices that at every opportunity.

One way that can be done is if the web development company has a directory they can be part of. That helps clients get found on the web and increase their web traffic by keeping information about them on thousands of sites on the Internet.

If you have been feeling that your relationship with your web company is rather one sided, it’s time to deal with one that cares about you!

Charles Tips – An Email Contact is Essential

This week is a closely related follow up to last week’s article. As I mentioned then about a lack of a phone number, it seems like it would go without saying that a website trying to sell something should have an email contact someplace on it.

Last week I was referring to a web developer’s website with no telephone number or email address on it. Some developers put forms on their sites to try to get out of displaying an email address. The main issue with forms – besides the fact that form output is more often than not considered spam by many mail servers – is that people generally don’t want to fill them out. It’s much easier these days to click on an email link and send off an email saying exactly what you want to say. Of course you can speak it even more clearly but email may be the next best thing.

If you can’t find an email address to contact someone, my advice is to just move along to the next prospective web developer on your list. You want to deal with a web development company that makes it easy to be reached.

Charles Tips – Carrying Liability Insurance

Carrying liability insurance is yet another important part of maintaining a legitimate, caring, responsible business. I’ve come to realize that in the web business many businesses operate without insurance. When something goes wrong, they just change the business name and open as another name.

Businesses operating in this fashion create problems for their potential clients. First and foremost is that should something happen that triggers the need for insurance, the client is stuck totally. The client in such a case may have no recourse or might not even be able to recover damages.

Folks who operate their “businesses” this way are fundamentally dishonest fly-by-nights. It’s easy enough to ask a web developer who handles their insurance needs and a quick check with their agent can verify that.

Avoiding dealing with a dishonest vendor can save you a ton of headaches in the long run.

On the other hand, good, honest businesses are always thinking in terms of the long run. They are thinking in terms of developing healthy business relationships with their clients. Part of that is staying in business so they can continue to provide services to their clients.

Finally, looking at all the items on the checklist we’ve provided in our Web Developer’s Checklist post will ensure you have the best possible shot at a positive experience having your website developed.

Charles Tips – Carries Workers’ Compensation on employees?

The potential for people being injured exists everywhere. If someone gets hurt due to their job, Workers’ Compensation provides coverage. Costs of medical care, rehabilitation treatments and lost wages are covered by this insurance if the injury is due to employment.

People do not understand the ramifications of dealing with a company that does NOT carry Workers’ Compensation on its employees. For example, web developers in business “under the table” would NOT be insured. In most states an “uninsured contractor” or “subcontractor” gets treated as YOUR employee if injured while doing work for you. Think about when they show up at your business for planning, discussing, photographing or whatever for the web project. Should anything happen to them, YOU may be on the hook for way more than you bargained for.

In addition to helping and protecting employees, Workers’ Compensation for our employees offers special protection to our business. It helps protect us and ensures we stay in business to continue to serve our clients over the long haul. Without it, a single mishap could put small web companies out of business.

Workers’ Compensation is yet another piece of being a legitimate, honestly run business protecting its clients as well as its employees and itself.

Charles Tips – Are they a Registered business?

Our exposure to thousands of web clients has shown us many folks who’ve been exposed to scam artists, fly by nights, and outright crooks over the years. We’ve had clients that had paid money down to previous developers with no work done whatsoever.

Luckily, most legitimate reliable web development businesses have ethics. Part of building confidence in one’s client base is doing what is necessary to be a legitimate business. Fly-by-nights don’t bother with registering their business or any of the other numerous details of doing business that being a legitimate business entails.

It’s very simple to check to see if a business is legitimate – i.e., registered. Here are links to websites where one can check out businesses in several states in and around New England: NH MA ME VT

Doing a little research like this can save you a ton of headaches later. Dealing with a business that is willing to do the initial work of operating legitimately greatly increases the odds they are going to be reliable and honest in their dealings with you.

While there’s never a total guarantee, coupling this with other items in our checklist helps narrow the field to give you the best odds of developing a good business relationship.