Forums

Different Side Image for Each Page ~ help with PHP Code (1 post)

  1. Kriya Shakti
    Member
    Posted 8 months ago #

    Aloha,

    I designed a website with a different side image for each page.

    When creating a new page, I would like my client to be able to upload a new side image for that new page.

    My current code gets the side image from the theme's image folder. I would like my code to get the side image from the uploads folder instead. The site's media files are uploaded to wp-content/uploads with no month- and year-based folders.

    I need help with the PHP code to go to the 'site URL' instead of TEMPLATEPATH.

    Here's my code:

    <?php $page_name=$post->post_name;
    	if(is_page()) { $image='side-image-'.$page_name.'.jpg'; };
    	if(!file_exists(TEMPLATEPATH.'/images/'.$image)) { $image='side-image.jpg'; }
    	echo '<img src="'.get_bloginfo('template_url').'/images/'.$image.'" alt="" />'; ?>

    If you can help out, Thank You!!!

Reply

You must log in to post.

About this Topic