WordPress.org

Ready to get started?Download WordPress

Forums

Modifying nav-menu from localhost (26 posts)

  1. adminadminadmin
    Member
    Posted 9 months ago #

    Hi

    I have set a XAMPP server to modify my website in the localhost. The main page is displayed perfectly, but links are generally bad configured. I have been looking for the file from my wp-content which I should modify in order to set the new local href for menu correctly, but I didn't find where they are codified. Could somebody tell me where I could modify the href of the navigation menu items?

    Thank you

  2. esmi
    Forum Moderator
    Posted 9 months ago #

    links are generally bad configured

    In what way? You really need to provide a lot more detail before we can possibly help.

  3. adminadminadmin
    Member
    Posted 9 months ago #

    I would like to set new hrefs for the menu options that appear in my site, but do not find the code where it is define. Where could I find it?

  4. esmi
    Forum Moderator
    Posted 9 months ago #

    We need details!
    Is this a custom menu?
    What theme are you using?
    What is wrong with the current urls?

  5. adminadminadmin
    Member
    Posted 9 months ago #

    Right now, when I click on a link in the main page which loads z.php, the error I get is:

    Fatal error: Call to undefined function get_header() in C:\x\xampp\htdocs\web\wp-content\themes\y\z.php on line 7

    z.php loads the header at the beginning of the code, with the following line:
    <?php get_header(); ?>

    I have a header.php file in \x\xampp\htdocs\web\wp-content\themes\y\, but I guess it is not found. What is the reason of this fact?

    Thank you

  6. adminadminadmin
    Member
    Posted 9 months ago #

    I have been looking around the forum in order to find a solution. This fatal error is quite common and i found the same problem in the following post:
    http://wordpress.org/support/topic/call-to-undefined-function-get_header-7

    In my case, the main file loads perfectly, but this one loads a sidebar file, which contains the code:

    <a href="/product-guide"><img src="<?php bloginfo('template_directory'); ?>/images/sidebar-cat.jpg"></a>
    
    		<div class="txt">
    			<h4>Visit our product guide</h4>
    			<a href="wp-content/themes/i/guide.php">View guide</a>
    		</div>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    The image is not found and the link to guide.php displays the fatal error mentioned above. The file guide.php has the code:
    <?php get_header(); ?>
    And here is where it goes wrong.

    My mistake, which i deduce from the other forum topic, is that the href to View guide is not correct, but how can I fix it????

    All files (guide, index, header, sidebar, footer...) are located in the template folder.

  7. Vitaliy K
    Member
    Posted 9 months ago #

    Hi there
    Try replace
    <a href="wp-content/themes/i/guide.php">View guide</a>
    with
    <a href="<?php bloginfo('template_directory'); ?>/i/guide.php">View guide</a>
    let me know if this helps, or I need more detailed description to help you.

  8. adminadminadmin
    Member
    Posted 9 months ago #

    i changed it, but it did not work. In this case, the fatal error is gone, but i got a Not located object. In the whole page, most of the links are not working, but as I said before, the menu items brought me to Not located object page also. Is it possible that the problem is in the absolute URL, or something like this?

  9. Vitaliy K
    Member
    Posted 9 months ago #

    can i see guide.php code? is this a template? it's assigned for any page?
    if not you can define this page as template by adding to the top of guide.php this

    /*
     * Template Name: Guide Page
     */

    After this you will be able to create page from admin and assign this template to this page. And you will be able to use absolute URL to this page. make sense?

  10. adminadminadmin
    Member
    Posted 9 months ago #

    This is the beginning of the guide.php code:

    <?php
    /*
    Template Name: Guide
    */
    ?>
    
    <?php get_header(); ?>
    
    <div class="bg-page">

    The code following just displays a pdf embedded. And yes, it is assigned for the page "Product guide" in the menu items from wordpress, defined in the backend.

  11. Vitaliy K
    Member
    Posted 9 months ago #

    what you see if you click "view" page (page with template Guide) from admin section?

  12. adminadminadmin
    Member
    Posted 9 months ago #

    what do you mean from admin section?

  13. Vitaliy K
    Member
    Posted 9 months ago #

    Yes, while you inside page in admin section you have the link "View page" under title.

    also can you turn on wordpress debuger before, just in case it shows more detailed error.

    You can do this by opening wp-config.php file and change this line
    define('WP_DEBUG', false);
    to
    define('WP_DEBUG', true);

    and after this try to view page and post here your results

  14. adminadminadmin
    Member
    Posted 9 months ago #

    I do not have any line in the wp-config.php file saying anything similar to DEBUG...

    From the admin section, in the Guide page, if I view page, I see the page i should see, with the navigation bar, and the information of the page (which mainly contains a pdf embedded).

  15. adminadminadmin
    Member
    Posted 9 months ago #

    I did nothing in the .htaccess file, from the root folder. Is it necessary to set any change?

  16. adminadminadmin
    Member
    Posted 9 months ago #

    I was still checking, and with the following code I got a redirection to localhost/xampp:

    <div class="txt">
    			<h4>Visit our product guide</h4>
    			<a href="<?php bloginfo('template_directory'); ?>/guide" class="boton">View guide</a>
    		</div>

    Hovering over the button, i can see the right location of the files (including guide.php). If I add ".php" following "/guide" I get again the Fatal error:
    Call to undefined function get_header() in C:\xampp\htdocs\..\guide.php on line 7.

    Any new idea?

  17. adminadminadmin
    Member
    Posted 9 months ago #


  18. Vitaliy K
    Member
    Posted 9 months ago #

    I don't understand why you need URL with .php at the end? You already have a template and can see it by /guide URL, right? What else you need?

    Can you clarify again please I am confused a bit here

  19. adminadminadmin
    Member
    Posted 9 months ago #

    No! I cannot see it with /guide URL!!! here the problem. I cant get any link working if the link needs to be shown in localhost.

  20. Vitaliy K
    Member
    Posted 9 months ago #

    Now seems I understand

    You need to change your permalinks settings

    Please read this
    http://codex.wordpress.org/Using_Permalinks

  21. adminadminadmin
    Member
    Posted 9 months ago #

    mod_write is enabled in my .htacces.
    I followed some of the steps there, but still not working. They say if I can't still get it working, write here...
    I inserted this to .httpd.conf:

    <Directory />
        Options FollowSymLinks
        AllowOverride All
     </Directory>

    instead of the one I had with none allowoverride.
    I also added:

    <Directory /var/www/html>
        # ... other directives...
        AllowOverride All
     </Directory>

    In wp-includes/vars.php file, I did this:

    //$is_apache = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false);
    $is_apache = 1;

    (Actually, I have a different code than the one it says Im supposed to have...)
    Finally, I added this to the .htaccess file:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    The only change is that now, when i click on guide link, I get localhost/xampp page, my xampp panel.

    Any idea?

  22. Vitaliy K
    Member
    Posted 9 months ago #

    1) Have you tried restart apache after changes in config file?
    2) looks like its XAMMP related issue, maybe something with your virtual hosts setup
    here is some results I've googled for you
    http://sixrevisions.com/tutorials/web-development-tutorials/using-xampp-for-local-wordpress-theme-development/
    http://www.wikihow.com/Install-Wordpress-on-XAMPP

  23. adminadminadmin
    Member
    Posted 9 months ago #

    Yep, apache was restarted. And about the links u offer, they are just explaining how to install xampp, which I already followed...
    What I dont know is if maybe it would be worth to install Xampp again, and try to insert a new WordPress version in it, setting everything again, and then inserting my wp-content folder, to see if this solve the problem... Maybe this could fix it?

  24. Vitaliy K
    Member
    Posted 9 months ago #

    Yea probably you should try, and use instruction, maybe you have miss some step. Because right now I am not sure how else I can help, sorry

  25. adminadminadmin
    Member
    Posted 9 months ago #

    Finally I was able to solve my problem. Permalinks were the problem, and I had to edit the file httpd.conf from xampp/appache in order to fix it. The line which was causing problems was #221, where I had to write:
    <Directory />
    AllowOverride All
    Require all denied
    </Directory>

    Then, I restarted xampp and everything was solved. Anyway, thank you all for your help.

  26. Vitaliy K
    Member
    Posted 9 months ago #

    Great!

    So you see this is not because wordpress, its all because of XAMPP setings.

    Glad you have solve this and share solution

Reply

You must log in to post.

About this Topic