PHPLD and WordPress - update!
After having so much trouble connecting my PHP Links Directory installation (free version available at phplinksdirectory.com in the sidebar) with my Wordpress-powered site (see PHP Links Directory and WordPress), I pretty much gave up on the connection for awhile, instead focusing on re-designing the site (again).
After switching servers a few months back, I noticed recently I hadn’t added PHPLD back to the site yet. Once I uploaded the files to the server, I figured I’d give the integration thing another try…and got it to work (sort of).
WP Header
In basically any question on using WordPress information in a different folder, the response is always the same:
include <?php require('wp-header'); ?> on the page
This I was never able to accomplish. After producing a ton of errors, I decided to fake the integration instead.
The Template
Since PHPLD uses smarty language instead of the php that WordPress uses, setting up the templates took a little figuring out.
The sidebar was simple enough - I navigated to a page on the site with the sidebar I wanted to duplicate, then did the ol’ “view source” trick to look at the HTML code, then copied the sidebar HTML into the “side” template in PHPLD.
After that, it wasn’t that difficult, once i realized the different way php is written in smarty.
Instead of
<?php ?>
use
{php} {/php}
Latest Posts
Unfortunately, I still had the problem of displaying the latest posts from the site on the phpLD directory. Since I couldn’t include the WP Header code on the page, I had to figure out another workaround for this.
Thanks to feedburner.com (you do have your WordPress feeds going through FeedBurner via their free plugin, right?), this turned out to be easy. Instead of WordPress pulling the latest posts to display, I have FeedBurner doing the job for me.
Oh, and since it was my own rss feed, I didn’t feel like adding that pesky “Feed By FeedBurner” logo at the bottom. So, I just add this to the CSS file for PHPLD:
#creditfooter { margin-left:-2000px: }
This puts the icon way off to the left of the screen, and out of viewing range.
The Header
After copying all the CSS I needed to the PHPLD CSS file, I again navigated to a page on the site, viewed source and copied the HTML for the header. Then I copied the image files to the “images” folder in PHPLD! Done.
Oh, still needed to add the “Links” hyperlink to the header. That was easy enough.
I modified the header template in WordPress and the header template in PHPLD and added
<a class="page-item" href="themindschewtoy.com/phpLD">Links</a></li>
after the other main page links, with “page-item” being the class used for all the page links.
Done!
Does It Work?
After about a week of struggling with this on the test site, I finally was able to copy the information to The Mind’s Chew Toy, and it’s now up and running!
While this isn’t the best solution (especially if you plan on changing your template and/or adding pages frequently), it does a good job of giving the illusion that your PHPLD installation and your WordPress installation are all part of the same site.
Of course, if you aren’t a coder, there are plenty of sites that offer free WordPress/PHPLD templates that you can use. But, since I want my site to look at least somewhat unique, I had to go my own route.
Let’s hope someone provides a tutorial for actually integrating the 2 programs (complete with wp-header), but until then, this workaround will work just fine.

Leave a Reply