Jump to content

Recommended Posts

Ok I have installed WordPress for those who are familiar with it. I noticed that when I use WordPress's built in "Create Page" function It doesn't allow PHP to be entered in. So I downloaded some PHP Plugins for WordPress and Here's my dilema. I'm using a script called linkman, basically it's a site links manager and it allows others to add a link to their site on my site and then checks to see if a reciprocal link is on their site. But when I enter this PHP into the wordpress page none of the links show up:

…
require ’settings.php’;

$lines = array ();
$lines=file($settings[’linkfile’]);

echo ‘

<

p class=”linkman”>’;

foreach ($lines as $thisline)
{
$thisline=trim($thisline);
if (!empty($thisline)) {
list($name,$email,$title,$url,$recurl,$description)=explode($settings[’delimiter’],$thisline);
if ($settings[’clean’] != 1) {$url=’go.php?url=’.$url;}
echo ‘‘.$title.’ - ‘.$description.”;
}
}
…

 

Obviously this isn’t all the code but it’s the part that isn’t working, I've tried to get help at the WordPress forums and the plugin creators but know one has even come close to helping me understand why it isn't working so I'm turning to you guys. Basically most of the plugins I've tried use the eval() code to check the php I've entered in and I get an error that says that there are invalid arguments for foreach(). NOTE: this script works fine when run outside of a WordPress created page but I really need it in a WP created page because I need the links displayed in my site with the theme and all. I'm thinking that it has something to do with the fact that the script requires information from another file on the server (settings.php) and (linkfile.txt) and somehow the eval() code isn't allowing it.  If someone could please offer assistance it woul be much appreciated. I've about pulled out all my hair on this one.

Link to comment
https://forums.phpfreaks.com/topic/55917-solved-php-in-wordpress-help/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.