I have a php file in my server (say www.example.com/up/up.php). If i access that file through the url, my site says no page found. but i want to call that php file using url parameter. I want to call that file to a download file using url access( say www.example.com/up/up.php?f=207). can someone help me how to do this. as usual i searched fr few days for my problem and came here when i totally cornered. my up.php contains the following code
)" data-controller="se-share-sheet" data-se-share-sheet-title="Share a link to this question" data-se-share-sheet-subtitle="" data-se-share-sheet-post-type="question" data-se-share-sheet-social="facebook twitter " data-se-share-sheet-location="1" data-se-share-sheet-license-url="https%3a%2f%2fcreativecommons.org%2flicenses%2fby-sa%2f3.0%2f" data-se-share-sheet-license-name="CC BY-SA 3.0" data-s-popover-placement="bottom-start">Share
You should be able to do it, just provide the full path to the file when you call it.
– Jared
Jan 22, 2012 at 18:05
@Jared I gave the full url but it ends up with no page found error. should i add any codes to function.php about this external file??
– Felix
Jan 22, 2012 at 18:23
Well where are you placing the file, in your active theme's folder?
– Jared
Jan 22, 2012 at 18:25
@Jared I placed it in my serever. www.mysite.com/up/up.php
– Felix
Jan 22, 2012 at 18:27
1
Well I think it would work the same way even if you had the .php extension. I think it may be a conflict with your rewrite rules possibly, because I've never had a problem accessing a PHP file inside WP with the path to the file.
– Jared
Jan 22, 2012 at 20:34
|Show 5 more comments
3 Answers 3
Reset to default
5
What you can do is this:
Put up.php in your active theme's folder, and put this line at the top of your up.php file:
I have a HTML form that user can interact with and insert the data to a database. ( One HTML form and about 3 pages .php ) I need to implement this form to a word press page. I created a page in wordpress and it gives me a blank area to write my content but i don't know where i put my files. so appreciate your support to help me , thanks .
"and about 3 pages .php" this implies you plan to interact directly with the db which is not recommended, you should use the wpdb object or just use a plugin such as this
Thanks Andrew , yes you are right , i will interact directly with the data base , before i decide to do that , i already checked all plugin like contact form 7 , ninja form , etc , all of them doesn't fit my needs . why it is not recommended to interact with db direct ??
2 Answers 2
Where you place your files depends greatly on the structure of your wordpress template. If you want to make a page that can be accessed via a url like "www.yourdomain.com/form", then you can make a "Page" in WordPress (via the "Page" panel via the dashboard), and name it "Form" and then, in your form's HTML (or PHP) file, set your HTML up as a template using this syntax:
Put this at the very top of your PHP page that contains your form's HTML/PHP:
The code comment above is something wordpress will look for exclusively, and tells the wordpress engine that this page (your form HTML) is now a template named 'My Form Page'. So now, in the WordPress Page editor for your "Form" page, you can attach your new template to your newly-created "Form" page by selecting "My Form Page" from the Template Dropdown in the Page editor.
Here is a screenshot of what the "Template Dropdown" looks like (per the WordPress documentation):
After you follow these steps, navigating to this page will reveal your form's HTML, instead of a blank page.
You should refer to the WordPress documentation on Page Templates for more information:
WordPress is one of the best blogging platforms and Phppot also running on this. I am planning to write a lot more on WordPress and this tutorial is the first from that series.
This is the scenario, we have a custom PHP page that we want to integrate with the WordPress blog. Our PHP file which we are going to integrate may not use any of the WordPress APIs.
Step 1: Create WordPress Template Page
We can start with a sample file and copy page.php, rename it on your choice and put it inside the theme folder ../wp-content/themes/mytheme/
This new file should start with the following content and then be followed by the custom PHP content. This is the WordPress template.
Remember to upload this to the theme folder. Now the WordPress template is ready.
Step 2: Create WordPress Page
Click the “Pages” link from the WordPress Dashboard. The template we created can be used to create this new page. We can give the Page name and choose the “Template” from the drop-down from the “Page Attributes” section.
There the PHP page we uploaded will come with the “ MyTemplate ” listed in the drop down.
Now publish. Here we go, we have created a WordPress PHP page using our custom code. Whenever this page is linked, our custom PHP code will get executed. We can create any number of WordPress pages using this template.
A real-time scenario is we can construct a sitemap page using this WordPress template option.
Popular Articles
PHP
jQuery
JavaScript
WordPress
WordPress Multilingual
WordPress Tutorials
WordPress Installation
How to Create a Minimal WordPress Theme
WordPress Child Theme Template
How to Create a Child Page in WordPress
How to Add Image in WordPress Sidebar
How to Create WordPress Custom Page Template
How to Create WordPress Widget
How to Create Shortcode in WordPress
How to Create Custom Taxonomy in WordPress
How to Backup WordPress Database
The Right Way to Include JavaScript and CSS in WordPress
How to Create and Enable WordPress MultiSite Network
Set Featured Image for WordPress Post or Page
How to Setup Google Analytics on WordPress Website
Creating Custom Post Status in WordPress
How to Redirect Your WordPress Blog Readers to a Random Post
How to Force Logout All Users from WordPress Site
How to Limit Login Attempts in WordPress
How to Add WordPress Two-Factor Authentication (2FA) using Google Authenticator Plugin
Disabling WordPress Search Feature without Plugin
How to Create an Image Gallery in WordPress
How to Disable WordPress RSS Feeds
How to Limit the Archive Menu List in WordPress
How to Display the Last Updated Date of Post in WordPress
Add PHP page in WordPress
How to Get WordPress Categories
How to Rename Uncategorized from WordPress Category
Displaying WordPress Recent Posts of a Specified Category
WordPress Custom Walker
How to Add Avatar Defaults in WordPress
WordPress Featured Image
Adding Custom Field to WordPress Post
WordPress XML-RPC Update Services to Ping
Insert Ads (Content) in WordPress Post
Error Establishing a Database Connection WordPress Fix
How to Move HTTP to HTTPS on WordPress
How to Display All the WordPress Posts on One Page
How to Embed Video from Facebook in WordPress
Show Related Posts in WordPress using YARPP Plugin
I’m currently available for freelance work.
Simple PHP Shopping Cart
Stripe Payment Gateway Integration using PHP
User Registration in PHP with Login: Form with MySQL and Code Download
PHP Contact Form
How to Create Dynamic Stacked Bar, Doughnut and Pie charts in PHP with Chart.js
“ Vincy is talented. I am very impressed by her work and diligence. I highly recommend Vincy, and I am eager to work with her in my next project . ”
Но блин, какая длинная ссылка получилась, это ведь не удобно! Давайте сократим ссылку и создадим человекоподобный URL (ЧПУ). Например, чтобы страница открывалась по короткому урл:
4. Находим в корневой папке WordPress файл «.htaccess», при помощи которого можно задавать различные настройки сервера apache и открываем его редактором.
5. Добавляем директиву «RewriteRule» после «RewriteBase»:
6. Переходим в браузере по заданному URL и видим, что страница отображается и функция отображения часовой зоны работает.
Готово! И никакие плагины не нужны! Естественно существует огромное множество плагинов, чтобы это реализовать, но в них еще нужно разобраться, а можно за несколько шагов, описанных в статье, сделать самому.