简体   繁体   English

无法从本地MAMP服务器访问我的Wordpress

[英]Can't access my wordpress from local MAMP server

I've been working through a wordpress tutorial using MAMP and everything was working fine for a couple days, till I tried to work on it today. 我一直在使用MAMP处理wordpress教程,并且在过去几天中一切正常,直到我今天尝试进行此工作为止。

When I go to localhost:8888/mywebsite.com, it shows my web page, but at the top where the wordpress dash would be it shows: 当我转到localhost:8888 / mywebsite.com时,它显示了我的网页,但在顶部的wordpress破折号显示为:

function register_my_menu() { register_nav_menu('header-menu',__( 'Header Menu' )); } add_action( 'init', 'register_my_menu' );

And when I go to localhost:8888/mywebsite.com/wp-admin, it shows the same code again. 当我转到localhost:8888 / mywebsite.com / wp-admin时,它再次显示相同的代码。

I'm fairly new to this, so I assume I'm just being stupid and not seeing something. 我对此很陌生,所以我认为我只是愚蠢而看不到任何东西。 I'm guessing theres something going on with my functions.php? 我猜我的functions.php发生了什么事? Just not sure as I haven't changed anything. 只是不确定,因为我没有做任何更改。

Any help is much appreciated. 任何帮助深表感谢。 Thanks! 谢谢!

Many of my students also forget to add opening php tag when working with functions.php 我的许多学生还忘记了在使用functions.php时添加开头的php标签。

So, make sure that your functions.php file begins with this: 因此,请确保您的functions.php文件以此开头:

<?php

function register_my_menu() {
    register_nav_menu('header-menu',__( 'Header Menu' ));
} 
add_action( 'init', 'register_my_menu' );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM