vendredi 27 février 2015

Wordpress and .htaccess – pretty permalinks and undefined function

I read several similar topics on stack, but none of answers did the job, so:


I started using Wordpress and created my first theme. I have placed WP in localhost/first-wp/ and in localhost/first-wp/wp-content/themes/first-theme/ I have several files, like index.php, login.php or register.php.


Now, I want to access this files through pretty permalink, for example localhost/first-wp/login or localhost/first-wp/register.


I created .htaccess file in localhost/first-wp/ and placed there this content:



<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /first-wp/
RewriteRule ^index\.php$ - [L]
RewriteRule ^login? /first-wp/wp-content/themes/first-theme/login.php [QSA,L]
RewriteRule ^register? /first-wp/wp-content/themes/first-theme/register.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /first-wp/index.php [L]
</IfModule>


But the problem is, when I enter for example localhost/first-wp/login I'm getting error: Call undefined function 'my_simple_func()' in /Applications/XAMPP/xamppfiles/htdocs/first-wp/wp-content/themes/first-theme/login.php. This function is placed, of course, in functions.php in my theme directory.


How do I solve this problem, to enter pretty permalinks and not getting this error? Thanks for all advices.


Aucun commentaire:

Enregistrer un commentaire