Abspath?
-
Having successfully written my first plug-in (I like it and it works), I thought I would move on to something a little more ambitious, that will hopefully increase my knowledge of WP and how it works. I am writing a simple gallery plug-in. I know there are a lot about, but none seem to do what I really want and using someone else’s (no matter how good) defeats the object of me learning how to write plug-ins.
Anyway I have created 2 folders, one that contains medium images and the other contains the thumbnail images. Naturally I want to be able to display the thumbnail as a link to the medium image and am using the code
define('TJIMAGE_PATH', ABSPATH . 'images/tj-gallery');
to define the path to the gallery and
$query = "SELECT photo_name FROM wp_tjgallery_photo WHERE cat_id = $c_id";
$result = @mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_NUM)){
echo'<tr><td><a href="' . TJIMAGE_PATH . '/medium/' . $row[0] . '">. TJIMAGE_PATH . '/thumb/thumb_' . $row[0] . '"</td></tr>';
}
to create the link. However this shows the full path to my gallery and clicking the link gives a 404 error.
I think the problem lies in my use of ABSPATH, but I cannot seem to find any documentation for this and have just picked up what I can from deconstructing other plug-ins. Can anyone see where I’m going wrong? An example can be found here
- The topic ‘Abspath?’ is closed to new replies.