WordPress.org

Ready to get started?Download WordPress

Forums

Permalinks and absolute paths to images (1 post)

  1. room58
    Member
    Posted 8 years ago #

    I am using WordPress as a CMS system for a new site. I have a section where I show a list of clients and their logos (which is rendered from a get_pages() call) and I have the company logo as a custom field, stored with the name of the image (ie. yourcompany.gif)

    I am using Permalinks on my site, which I think is causing a problem when I come to output the HTML for the clients page. In my code I am doing the following to get the absolute path to the image:


    $pages = &get_pages("child_of=".$post->ID);
    $logo = 0;
    //Build an array of ID's, content and images

    foreach($pages as $page) {
    $image = get_post_meta($page->ID, "company_logo");
    $text = preg_replace("/rn/", " ", $page->post_content);
    $text = substr($text,3,strpos($text, "<!--more-->")-3);
    echo "<img src='" .get_bloginfo('url'). "/images/" . $image[0] . "' alt='" .wp_title(). "' height='75' width='140' />";
    $logo ++;
    }

    My issue is that I believe my Permalinks is preventing me from accessing the image in this way. Is that correct? How do I get around it?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags