Placing PHP Directly Into Your WordPress Posts

(Note: PHPExec2 is no longer being updated – see this post for details).

Sometimes, adding PHP directly to your blog entries can be a cleaner and simpler solution than other alternatives. Although you can edit the WordPress template directly to display, it can get messy, especially when all you want to do is create a single page with a little extra ‘smarts’ in it.

In reviewing the different solutions out there, I soon settled on PHPexec as it was very easy to set up. Just place the single phpexec.php file in the plugins directory, activate it, and include the special tags around the PHP code you want to execute. The only setting (Under Admin’s Options;PHPExec tabs) is to set the security level – by default it’s at 9, so anyone posting with a user level of 8 or less cannot enter PHP code – simple security for blogs with multiple posters (if you’re the only poster, you needn’t touch this setting).

However, one problem I noticed is that the plugin only works in WP version 1.5 – in version 2 the code doesn’t display properly. So I dug into the code, fixed it, and notified the author about the changes.

Unfortunately, there’s been no response, so I’m posting the fixed code on my site at ActiveBlogging.com. This code will work the same in WP 1.5 and 2 so upgrading won’t be a chore if you have an older blog you’ve been ‘holding out on’ because of this plugin’s bug.

Once set up and running, adding code to pages and posts is very simple – just enter your PHP in the post or page with surrounding tags like this:

<phpcode>
<?php echo date("F j, Y, g:i a"); ?>
</phpcode>

with these tags, the code will be executed rather than displayed – in this case, you’ll see the current date and time displayed (for the server of course, which will likely differ from your local time).

One warning about the version 2 modification – you CANNOT edit the code in the graphical HTML editor . So to enter and edit code, you’ll need to turn off the graphical editor and go back to ‘classic’ mode.

In Admin, go to Users;Profiles; then ‘Personal Options’ at the bottom, and uncheck the ‘Use the visual rich editor when writing’ option, and update the page. Following that, you’ll be able to edit the code properly (you can always turn it back on once you’ve finished).

The PHP plugin stands on its own as a useful WordPress plugin tool, and can be used for anything. Anywhere you want PHP code executed in a WordPress post or page, this can be a real time saver!

(download from here: http://activeblogging.com/misc/phpexec.zip)

What is Blog Pinging?

What is Pinging?

The word ‘ping’ has a long history both off and on the Internet. In 1983, Mike Muus wrote a tool to check if other sites were up and accessible (http://ftp.arl.mil/~mike/ping.html)

Somewhat like a sonar ping in the submarine movies, a single packet was used to see if there was anything out there, so it’s very appropriate that he named it after the sonar ping.

This small information packet is used to see if a site is up and running – but it can be used for more. WordPress uses it to tell a site that it has something of interest – a brief advertising message, as it were.

This mini ad doesn’t do much more than say ‘come visit me’, but for blogging, it’s quite effective – many sites list the blogs that ping them, and search engines visit THOSE sites.

In other words, for the effort of a single ping, you could get a listing on a high-ranking website!

Some have abused this system by artificially pinging, or pinging too often. This means that the listings are temporary, since with hundreds or thousands pinging every hour, yours will soon scroll by.

But right now, pinging is positive, it does work, and for now, it’s a great way to advertise your site without effort.

And the good news – WordPress includes it at no cost!

In the Admin section panels “Options; Writing; Update Services” you have a list you can edit to enter a list of ping sites. The original entry, for pingomatic, is from the fellows that developed WordPress, and should be included in everyone’s ping list. It takes care of the majority of advertising, but you may wish to include more.

A listing of ping sites that are commonly used can be found at http://activeblogging.com/info/wordpress-ping-list/ – whether you use them all is up to you, since each ping slows down you system when posting, and some sites are redundant (eg, pingomatic calls others for you).

So if you wish a quick way to get noticed, and don’t feel like submitting your site to search engines, remember WordPress, and use it for your site – with a full ping list!

Do You Want a Better WordPress Blog?

I opened an email from a major marketer today – and went to his promotion blog to see what was up…

…and couldn’t believe my eyes!

Despite offering my ‘Top 10 Tricks To Conquer Your Niche With WordPress‘ report (revised every year) since 2005, many major marketers are still doing the ‘out of the box’ WordPress blog – and paying for it in search engine rankings!

Simple tweaks, like making sure your titles are <H1> or <H2> tags, and setting up your permalinks properly, can make a huge difference.

So I realize it’s time to do something (again) – and I launched a special offer in my favorite marketing forum, the Warrior Forum:

http://www.warriorforum.com/forum/topic.asp?TOPIC_ID=141557

While it lasts (a maximum of about 3 weeks) you can get a SEO blog – or a discount on my report ‘Top 10 Tricks To Conquer Your Niche With WordPress‘ – so check it out!

Top 10 Tricks to Conquer Your Niche With WordPress – 2007 Edition!

The latest report is ready – and while the report hasn’t changed too much from 2006, the addons are incredible!

As you may know, I offered a few WordPress makeovers not too long ago – it was a chance to see how others used their blogs, and provided me with a ‘wish list’ of what everyone wants AND needs for their blogs.

The result – the ABTheme for WordPress, which now accompanies the new ‘Top 10 Tricks To Conquer Your Niche With WordPress‘ Guide.

If you’ve heard of the Semiologic theme, then you know what a good WordPress design can do for you and your business – but if you haven’t, here’s a taste of the features in the ABTheme:

  • The ‘Top 10 Tricks’ report’s techniques are included – including new features for 2007, like enhanced metatags (default tags so you don’t have to enter them for every posting), on/off titles (so you CAN display your blog title if you wish!) and built in AutoPosting – so you don’t need to modify WordPress anymore!
  • The theme includes a brand new technique – movable blocks. The article list, search box, category list, calendar and many other WordPress components are all movable – rearrange their order, split them across columns (2 AND 3 columns supported), and place the article text in ANY column without a SEO penalty. Once you see this in action, you won’t want to use another WordPress theme – ever!
  • Not only rearrange components, but add your own – easily paste in HTML (OR PHP!) and position it where you want in any column – perfect for ‘do it yourself’ email forms!
  • I’ve fixed the ‘navigation bar problem’ – how to display just the pages you want on the top navigation bar (or the footer one) without editing PHP. Display links to the pages you want (and ONLY the ones you want) – in the order you want!
  • Easy copy and paste – no more mind numbing settings. Now just get a design you like, and transfer it to a new blog with a single copy and paste!
  • Easier to use Adsense (or any other ad) display code, making it easy to embed ads right alongside your articles (and make sure you don’t violate Google’s rules by having too many displayed!)
  • And of course, my usual ‘use it on all your blogs’ license!

The goal is a theme that anyone can use – and you don’t have to hire a programmer to edit. I know you’ll find it a great way to manage your sites – flexible and powerful, yet Search Engine Friendly!

So check out Top 10 Tricks To Conquer Your Niche With WordPress today!

WordPress Revisions Galore!

January spelled not one, but three revisions for WordPress – 2.06 on the 5th, followed by 2.07 on the 15th. And of course, 2.1 on the 22nd.

Although you can read more about it on their site, the releases actually are two-part – 2.07 for most of us, and 2.1 for bleeding edge. The difference is simple: 2.07 represents a collection of security and bug fixes in the current code, whereas 2.1 is a move to significant new code.

As usual, the 2.07 is a ‘must have’ fix to avoid security problems in the past. I’d recommend using it as soon as possible for new blogs (although considering it comes a week after 2.06 I’m a little leery of recommending overhauling older sites).

And 2.1? I’ve heard of people complaining already, proof that new and different is often buggy – so you might want to wait awhile. Eventually, though it will be the way to go…

An important note about all new/future WP revisions – with the release of the ‘Top 10 Tricks To Conquer Your Niche With WordPress (2007)‘ Report, I’ve stopped revising the WordPress files for new releases, so there will be no more additions to the plugins update page.