Home arrow PHP arrow Page 4 - Standards-compliant Link Targets with Wordpress

Putting it all together - PHP

Wordpress is an extremely popular site blogging software written in PHP. It does a great job of creating standards-compliant web sites. Plus itís a good idea to continue with that effort when adding modifications.

TABLE OF CONTENTS:
  1. Standards-compliant Link Targets with Wordpress
  2. Dynamically adding rel=íno followí
  3. JavaScript link targets
  4. Putting it all together
By: Nilpo
Rating: starstarstarstarstar / 4
December 19, 2007

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

The Wordpress plugin we created will work as soon as it is enabled in the Wordpress administration area.  The JavaScript, however, needs to be enabled.  In order to do this, we need to add a reference to it in our web site template.

Either edit your site template manually or through the Wordpress admin area.  Open the header.php file associated with your current template, if there is one.  If not, apply this to the default header.php file found in the /plugins/default folder.

<script type="text/javascript" src="outboundtarget.js"> </script>

Add the line above anywhere between the <head> and </head> tags so that the external JavaScript is loaded with your pages.

The src needs to be either relative to the current page or absolute to the JavaScript file you uploaded previously.  Be very careful when using relative URLs.  In Wordpress, this is not relative to the header.php file, itís relative to the index.php file in your web root!

With both scripts in place and the script reference added to your site template, youíre all set.  Everything should be working.  You can test it out by visiting your site and clicking any external link.  If it opens in a new window, everything went well.

Using the code found in this article should help increase your pageís rank and search engine placement as well as allow pages with targeted links to validate under the new strict XHTML standards.



 
 
>>> More PHP Articles          >>> More By Nilpo
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: