Wordpress Custom Menues
I am currently working on a wordpress multisite project. I have set up a working environment in localhost. In the main menu there is a links to home, so is in subdirectory sites.
Now my problem is everything works find in testing server environments as the main site URL is
myhost/xx/wordpress_site
and sub directory sites are like
myhost/xx/wordpress_site/sub_dir
. In wordpress Appearance->menu you can only give a static url in the link URL field.
What I am looking for is to give a method like
site_url().”/sub_dir”
in that field so I don’t have to manually alter all the site home URLs when I upload the site to it’s destination domain. Which can be any form?
Any simple solution regarding this problem its greatly appreciated.
Thanks a lot.
Solutions
I would not recommend to change anything on wordpress code or site url configuration. because when you will go to production you will have to change it back again. It will be the best if you will setup the same site configuration on your localhost, you can use the following configuration for your apache server and host file so you will be able to access your local site by your actual domain. This way your settings will remain the same and all site links will be the same. (rename mysite to your site url)
how to change host file: http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/
how to add virtual host apache: http://httpd.apache.org/docs/current/vhosts/examples.html
Apache configuration:
<VirtualHost mysite.com:80>
ServerName mysite.com
DocumentRoot /var/www/mysite
<Directory /var/www/mysite>
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
host file configuration:
127.0.0.1 mysite.com
restart apache and you will be able to work on localhost like it is the productin server. * Remove the following when you want to access the real server.