• Hi all,

    I’m using WordPress 3.0 with a self-designed theme. I have a self-built contact form that I’m using, and basically it uses the mail() function to send out an email with the information that the client has filled out.

    However, I can’t seem to refer to the mail script. For example, in the

    <form name="" action="mail.php">
    how do I refer to mail.php? I can’t use <?php bloginfo(‘template_url’); ?> for some reason. All I need to do is find a way to refer to that file which is located in the same place as all other files (like header.php, index.php, etc. etc.)

    I have another question TOTALLY unrelated to forms but still in the same sort of arena.

    I have a slideshow on the theme. The slideshow consists of <img /> elements. I made a separate file called slideshow.php with only the <img /> elements in it so that the user can simply open that file and add any images to it (meaning the page with the slideshow, in my case index.php, has a php include in it which refers to the slideshow.php file). However, again, in the slideshow.php file, I can’t refer to the images with the following:
    <?php bloginfo('template_url'); ?>/images/image1.gif
    php bloginfo doesn’t work from within another php file even though it gets implemented inside the index.php file. I’m so confused, how am I supposed to refer to correct file paths without a working php bloginfo????

    Just so I didn’t confuse u, my bloginfo(‘template_url’) DOES work (as I link reset css files, javascript files, etc etc), except it doesn’t work everywhere I want it to like in the external slideshow.php file and in the form action field.

    Any help would be greatly appreciated!

    Thanks, Amit

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    I’m not sure where your files are located in relation to your template or site root, but, the function <?php bloginfo(‘template_url’); ?> will output https://your-site.com/wp-content/themes/your-template-folder

    If you are attempting to access files in your root, like an images directory, then you can try <?php bloginfo(‘url’); ?>/images/my-image.png which is the same as https://you-site.com/images. the <?php bloginfo(‘url’); ?> outputs the URL to your blog….

    I suggest first attempting to see if you can correctly navigate to your files in question. So if your mail.php file is located in the same folder as all your other template files, then you should be able to access it by going to: https://your-site.com/wp-content/themes/your-template-folder/mail.php.

    I suggest creating a sub-folder in your templates folder called “mail” (or whatever you like) and refer to your file: <?php bloginfo(‘template_url’); ?>/mail/mail.php.

    Also, please not that these are WordPress functions so if slideshow.php is just a random php file you uploaded, then <?php bloginfo(‘template_url’); ?> etc will not work there. You’ll need to make these php files part of your theme in order for WP to recognize the WP specific code…

    Hope this helps.

    Q

    Thread Starter engineercreativity

    (@engineercreativity)

    I see.

    Well you certainly helped a little. How do I make slideshow.php part of my theme? just add a new page?

    However, my main question was the following. I have a page in wordpress that uses a form. The action in the form refers to the mail.php which is located inside the theme folder under a folder called mail.

    So, just to clarify: it is located here:

    https://your-site.com/wp-content/themes/my-template-folder/mail/mail.php.

    When I’m editing the HTML of the page that I created via wordpress, I put in the action=”” <?php bloginfo(‘template_url’); ?>/mail/mail.php. However, that does not work. My question is simple, why?!

    Thanks,
    Amit

    pseemarao

    (@pseemarao)

    where are all my files such as member home about us stored in the server I’m not able to find it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Refer to the proper file from within wordpress pages’ is closed to new replies.