Page 1 of 2

WordPress – Copy & Paste with link back to your website

WordPress – Copy & Paste with link back to your website
0

For those of you writing articles or blog posts, you’ll find that it takes a lot of work to write a good article. Even a tiny post can take up a lot of time.

And what is the most annoying part? Folks just bluntly copying your work, without even asking or giving credit (there are a very few exceptions). It seems that the majority on the Internet is replicated that way. Copy, and Paste.

For WordPress users (and if you only take out the JavaScript part, this might work for others as well) can, with a little trick, automatically add a “source” link below what has been copied. Not only will this be a reminder for the “copier”, but (if left intact) a good way to boost SEO for your website.

WordPress – Quick and Easy Ad Widget (sidebar)

WordPress – Quick and Easy Ad Widget (sidebar)
0

Wouldn’t it be nice to have a widget to place an advertisement, for example from Google Adsense, into the sidebar of your WordPress website?

After all; the layout of your sidebar(s) could be managed from the WordPress admin pages, and allows you to place ads in the sidebar where and as many times as you see fit.

There are probably plenty plugins for this, but I dislike plugins.
So here the simple code for the “functions.php” that creates your own WordPress Ad Widget.

WordPress – Inject Ads into your Posts

WordPress – Inject Ads into your Posts
0

Unfortunately, when running a website, some kind of income is needed to cover the hosting expenses. Often this is done by placing ads.
Like most other websites, even Tweaking4All has to resort to placing ads, although I’d rather have zero adds, but donations alone isn’t covering the costs.

The downside of ads, besides being annoying at times, is that they only generate revenue when placed strategically, so folks will click on them (hint!).

Now, I will not claim to be the right person to ask where you should place ads, but in my opinion there are 3 reasonably “good” locations.
At the beginning and end of an article, and … in the smack middle of an article.

In this article, I’ll show you how you can automatically have an ad placed in your content, on the fly. With this code you can place an ad just before the nth <H2> tag. We will not use a plugin, and the code is simply added to the “functions.php” file of your theme.

WordPress – Preserve Backslash in Posts

WordPress – Preserve Backslash in Posts
0

Preserve backslashes in WordPress brings us to one of the annoying features of WordPress: it strips backslashes.
It has it’s place an reason of course, but it can be a PITA when you’re trying to post code examples.

In this very short article, I’ll show you how to preserve your backslashes with a very small function which replaces each backslash with an HTML entity, which should make it safe to work with in your database and not loose the backslash. Even my code highlighter does not seem to be bothered by it and displays the code correctly (ie. not showing the HTML entity, but rather show the desired backslash).

Note that manually entering the HTML entity in the HTML code of your article (Text view) works only once! When loaded again in the tinyMCE editor, the HTML entity will be converted to a backslash again and posting an update would remove that backslash again. This function prevents the loss of the backslash by doing it’s work each time you save your work.

Retrieve Google and AWIS Alexa Page Rank for WordPress

Retrieve Google and AWIS Alexa Page Rank for WordPress
1

For whatever reason you can think of, for the fun of it, or to show off how well your website is doing; displaying the Google pagerank and/or the Alexa ranking of your website is kind-a nice to have. This article is an updated version of a previous article I wrote, but since the Alexa link no longer works, the official (free up to 1,000 queries a month) Amazon AWIS API needs to be used and we won’t be exceeding the 1,000 free queries per month with this method.

I have seen several useful PHP scripts that can help with that, but they all kind-a rely on the fact that a page is being loaded, and while loading the Google Rank and Alexa Rank are begin retrieved, over an over again. This is not only causing an unneeded load on the Google and Alexa servers, but it’s also slowing down the loading of your website (even though it might not be noticeable by the end-user).

Both Google Rank and Alexa do not refresh multiple times per day, so a once a day refresh would be good enough.
In this article I’ll show you how I have implemented this in WordPress.

P.s. for those who’d like to see this as a video training, Webucator was kind enough to make this article available as a video as well, you can find it at the end of this article.

WordPress – Mod_security problems with posts and comments fixed

WordPress – Mod_security problems with posts and comments fixed
5

In the world of WordPress, this situation does not seem uncommon;

A user posts a comment, and instead of actually posting the comment, gets redirected to the main page of your website. Not just annoying for webmasters, but a very unpleasant experience for visitors that like to actively contribute.

Quite often, with WordPress, this is caused by a false-positive being triggered by mod_security.

In this short article, I’ll show you what might be causing this issue, how to identify it, and how we can fix it.

WordPress – Auto Chapter Anchors and Overview

WordPress – Auto Chapter Anchors and Overview
2

This is one of those funny little things you run into when writing a longer post or article.
You’d like to present an overview in the beginning of that particular WordPress post, so users have the ability to see at a glance what to expect and, if needed, quickly jump to the location where they’d like to be.

Things get even crazier when you have a topic, say a course of some sorts, that covers multiple posts, where you would still like to show the user where to find what in a content overview of the entire “course” or group of articles. I’ve grouped them in this case in a dedicated category …

If you’ve ran into something like this before, then you’ll know the cumbersome experience of keeping everything correct and nicely ordered.

Since this seems a good task for a computer to solve, I figured; why not write some code that does this for me (yes, I know there re plugins that do something similar, but not quite to my licking). Before I knew it, this got quite out of hand and I created some code for using a WordPress shortcode in my posts for just this purpose.

Retrieve Google and Alexa Page Rank for WordPress

Retrieve Google and Alexa Page Rank for WordPress
9

For whatever reason you can think of, for the fun of it, or to show off how well your website is doing; displaying the Google pagerank and/or the Alexa ranking of your website is kind-a nice to have.

I have seen several useful PHP scripts that can help with that, but they all kind-a rely on the fact that a page is being loaded, and while loading the Google Rank and Alexa Rank are begin retrieved, over an over again. This is not only causing an unneeded load on the Google and Alexa servers, but it’s also slowing down the loading of your website (even though it might not be noticeable by the end-user).

Both Google Rank and Alexa do not refresh multiple times per day, so a once a day refresh would be good enough.
In this article I’ll show you how I have implemented this in WordPress.

WordPress – Increase Maximum Upload Size for Media Library File

WordPress – Increase Maximum Upload Size for Media Library File
0

My latest issue with WordPress has been the limited maximum Media Library Upload Size when I tried uploading a few videos for an Arduino article.

In this article I’ll show you several methods to increase the Maximum Upload Size for the WordPress Media Library, either by modifying php.ini, functions.php or the .htaccess file. WordPress MU/Multisite/MS use will be addressed as well.

WordPress – Open links in comments in a new Window or Tab

WordPress – Open links in comments in a new Window or Tab
0

WordPress is a great Content Management System, not just for bloggers …

One of the downsides I have run into is that links in comments automatically get reformatted and the HTML “target=_blank” gets stripped away so a link in a comment will always open in the same window as you website. Personally I prefer such a link to open in a new window …

So in this article a simple piece of code to make links in WordPress comments automatically open in a new window or a new tab by automatically adding “target=_blank” to links in comments.

WordPress – Upload banned File Types to Media Library

WordPress – Upload banned File Types to Media Library
11

WordPress handles media files through it’s Media Library and in it’s default installation only certain file types, or better said: MIME-types, are allowed to be uploaded.

The current selection of allowed file types (ie.the file types that are not banned) can be rather limiting specially when you’re using bbPress as a forum wiht your WordPress setup. I’m not sure about the need for additional formats for all bbPress forums, but in the Tweaking4All forum I most certainly would like to be able to upload RAR, 7z, GZIP, XML and CSV files (amongst others).

Unfortunately WordPress does not offer a straight forward interface in the Admin Pages to modify the allowed Files Types.
In this article a short piece of code to allow you to add other file types or so called mime-types.

WordPress – Adding Custom Columns in the Posts Admin page

WordPress – Adding Custom Columns in the Posts Admin page
3

Not every WordPress admin uses them, but as some of you might know: you can add custom fields to your posts (amongst others). Here at Tweaking4All we use if to enter a shorter title, a shorter description and for example to indicate the difficulty level for the individual posts.

The problem I found however is that sometimes I forget to enter those custom fields for my new post and it would be helpful to see those values in the overview of all posts in the admin pages, so I can see right away if I forgot one or not.

It appears that adding and removing columns is actually really not all that difficult, so I’ll explain what I did to get it to work.

How to speed up your website

How to speed up your website
8

While revamping Weethet.nl and Tweaking4All I mostly focused on looks and functionality – obviously great points for the user experience. But even more important is the speed of your website. Not just because it gives a better user experience, but also because it has an impact on your search engine ranking.

Since I had to do some optimizing myself, for Tweaking4All, here an article with my first hand experience in how to make your website faster …

WordPress – How to create a sitemap Page …

WordPress – How to create a sitemap Page …
0

In this short article, I’ll show you how I made my sitemap (not to be confused with sitemap.xml) of my website.

For Tweaking4All I just wanted a list of all pages, and all categories with the posts listed underneath it. The reason why I wrote my own code is pretty simple: Everything I could find out there on the Internet only showed first level posts and categories, or made a flat list out of it, or skipped duplicates. This list however maintains the actual hierarchy, and if a post occurs in multiple categories then this will reflect this as such.

With a simple tiny bit of code and your own customized CSS, things can be pretty easy.

WordPress – Enable Link Manager without Plugin

WordPress – Enable Link Manager without Plugin
2

WordPress, as awesome as it may be, has it’s funny streaks – with all due respect to the developers who have done some very respectable work. As of version 3.5, the “Link Manager” no longer appears on new installs, and that of course just after I decided to use “Link Manager” for my Links Page.

It can be brought back with a plugin, but why install yet another plugin when the code appears to still exist in the WordPress distribution?

A simple one-liner fixes this problem …

1 2