I created a template on WordPress and I made an html form. It works well in HTML but doesn't work when used on WordPress. It seems that it doesn't find my contact-send.php page and it displays a 404 Error page.
My permalinks were on default and it didn't work.
Does anyone know how to fix this?
If any of my code is needed, I'll post it. I just didn't because I think it's not a code error once it doesn't find contact-send.php.
Use an absolute URL for the target of your form instead of just action="contact-send.php".
But unless you have particularly unusual requirements for your contact form, you will likely have better results using one of the many popular contact form plugins like Contact Form 7.
Using a well-maintained plugin ensures stability, and more importantly, security. Don't reinvent the wheel if you don't have to.
Your problem can be caused due to 3 reasons.
Giving wrong path in action tag. Using <?php echo get_template_directory_uri(); ?>/contact-send.php will solve this problem.
Missing contact-send.php page in the themes folder. This problem can be solve by adding the page to the themes folder.
Improper .htaccess file. This can be solved by recreating the code for your .htaccess file from Dashboard > Permalinks and paste it in the .htaccess file in the WordPress root directory.
I am giving the explanation in the assumption that your template file is directly in the themes folder.
Add <?php echo get_template_directory_uri(); ?>/contact-send.php. When you write contact-send.php only then it don't find your file which is in your theme. So use this <?php echo get_template_directory_uri(); ?>/contact-send.php in form action. This change may be helpful.
Related
I've inherited a very large Drupal site and need to edit the content in $linked_site_logo as below, but I have no idea where to find this file.
<div id="logo"><?php print $linked_site_logo; ?></div>
What is typically the file structure for a large-scale Drupal site and where should I begin looking to edit this? I haven't been able to locate the file.
There seems to be an answer on a drupal community which might help you. https://www.drupal.org/project/corolla/issues/1472416 - which suggests the code maybe in the page.tpl.php file
However, your best bet might be to use your terminal or code editor to do a search across the code base for the line of code, as there could be multiple references to the logo being included.
It's probably in your theme template files page.tpl.php or in include header file. Use theme debug mode, put this in your settings.php at the end of the file:
$conf['theme_debug'] = TRUE;
Than inspect element using your browser and see where elements come from.
I'm setting up a wordpress site and coding in the header.php file of my directory. the code for the links on the navbar are as follows:
<a class="nav-link" href="<?php bloginfo('template_directory'); ?>/page/">Page</a>
But when this is selected, instead of taking the user to the domain that i expect, which is www.mydomain.com/page (which has been the case every other time I have done this approach) it take the user to the following:
"www.mydomain.com/wp-content/themes/mytheme/page"
This is really weird, and I have not experienced it before.
I am editing the code via FTP (FileZilla) and using a custom Wordpress theme I built myself. When I ran this on a localhost it worked fine, the issue didn't occur until I started running it on the server. I am doing this because my client is using DreamHost and they do not have a cPanel or File Editor for the plan we use.
Would anyone have any starting point as to why this is occurring? I will attempt to root out more information and update this with more info as I find it.
I fixed it. I went off of Amila Priyankara's answer so I give them most of the credit here.
Instead of
<?php site_url( '/store/', 'https' );?>
Like they suggested, i used
<?php echo get_site_url('www.mydomain.com', '/store/', 'https' );?>
Thanks to the research at the link below. This is because we have to display the link using echo, and the <?php get_template_directory(); ?>was returning the full template directory, rather than just the site url.
I'm still not quite sure why this has never caused me problems before, but this is good to know that this is another way to solve it.
https://developer.wordpress.org/reference/functions/get_site_url/
<?php site_url( '/store/', 'https' );?>
Try this one.
https://developer.wordpress.org/reference/functions/get_site_url/
https://developer.wordpress.org/reference/functions/site_url/
Creating a wordpress sight for work to display some info. For convience i have included the following php code
<?php include 'wp-includes/fancyboxstart.php'; ?>
that file loads all the JS, and defines the div id for my fancybox img display. Recently i have changed the permalinks on my WordPress to get rid of the awful page=1 html links. Now i know to fix all my images simply by adding a "/" to the front on my img srcs. My problem is now that i have changed the permalinks it is no longer loading the JS page from above and my Image displayer no longer works =[
I have tried directly linking to it with
`<?php include 'http://premiumshotguns.com/wp-includes/fancyboxstart.php'; ?>`
but no luck. I know it's probably a simple fix but i am not seeing it! any help would be appreciated!
You probably need to include your theme path.
<?php include bloginfo('template_directory').'/wp-includes/fancyboxstart.php'; ?>
I'm currently developing a website where I need a widget to display the upcoming match. The site is for a football team. I've therefore created a plugin which creates a custom post type and a widget. Everything is working really well, but as I don't like to clutter my PHP code with HTML I figured I'd include the widget settings in from another file in the plugin directory. Although the include returns bool(true) nothing is showing in the widget form.
Here is the code I'm using to include the file:
public function form($instance){
require_once($this->plugin_directory.'/views/widget-form.php');
}
The variable $this->plugin directory is defined in the constructor and points to the correct path.
Here is the html code inside the included file, it's brief but just to test. No matter what I type in there it keeps returning blank.
<input type="text" name="title" value="Hello World!" />
Any ideas why this keeps happening, or doesn't WordPress support loading extra files in places like this? I could just have my html in the plugin-file, but I prefer to keep PHP clean, and not cluttered with HTML and/or CSS, JS etc.
If anyone could help me figure this out I would greatly appreciate it! :)
Thanks in advance,
Jonathan
I know you've mentioned that your $this->plugin_directory is set in the constructor as the correct path, have you tested the output of this and/or is it set as the absolute path or relative?
I've had issues in the past where plugin files couldn't read the relative path correctly and so therefore I had to switch to an absolute path instead or vice-versa.
Hi evrybody ‘im new to codeigniter and to MVC model as well,
I need help to get my project working couse i’ve got this issues:
1) i’m in the main page and i clik on the link of the “about” page, the css file does not seems to load.
and even if i include the css in the head section the images are still missing in the page.
2) in the configure file i’ve set the
$config[‘base_url’] = ‘’;
$config[‘index_page’] = ‘index.php’;
now if i’m in the about page and i clik again on the about link the link it’s missing becouse i set the link in the menu:
About
and so the index.php it’s loaded twice: localhost/mywebsite/index.php/index.php/about.
i could set the condition to cut the link if i’m in the page i need but i would like to know if there is a more polite solution
and hope that the solution it’s not to put my hands in to the mod_rewrite .
I’ll like codeigniter because seems to be easy to configure and so really portable.
and even if it’s simple i can’t figure out how to solve this issues
Thank you everybody for your time!
Even i a newbie to CodeIgniter. I was facing the css problem. I added the css files in separate folder located at the root directory. I solved the problem by adding $this->load->helper('url'); in the controller function of the page.
You need to set $config['base_url'] in config.php to http://www.yourdomain.com and provide full path when linking css to the page like this :
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>resources/css/file.css">
just add
> <?php echo base_url();?>
before or or URL link
> (example: <script src="<?php echo
> base_url();?>assets/js/jquery-1.7.1.min.js"></script>)
to load the link to all page and separate the header and footer in separate file which could help you a lot minimize the page content.