Wordpress:wp-content 文件夹与其他文件夹分开 [英] Wordpress: wp-content folder separated from the rest

查看:36
本文介绍了Wordpress:wp-content 文件夹与其他文件夹分开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将 wp-content 文件夹移动到另一个文件夹中.

I need to move my wp-content folder in another folder.

例如,这是 wordpress 文件夹:

For example, this is the wordpress folder:

  • wp-admin"文件夹
  • public"文件夹(里面有 wp-content)
  • wp-include"文件夹
  • (其他文件)

我已经遵循了指南,所以我有:

I already followed a guide, so I have:

define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/public/wp-content' );
define('WP_CONTENT_URL', 'http://www.example.com/public/wp-content' );

在我的 wp-config.php 中

in my wp-config.php

没错,是吗?但这似乎不起作用.

that is right, yes? but that doesn't seem to work.

显示了我网站的内容(但在没有那些代码行时也显示了),但主题效果不佳.

The contents of my site are shown (but they were being showed when there weren't those code lines, too) but the themes don't work well.

我需要添加其他东西吗?

Do I have to add something else?

推荐答案

如果显示内容,则表示您添加到 wp-config.php 的定义工作正常.

If the content is shown, that implies that the definitions you have added to wp-config.php are working properly.

不正确的样式意味着您的主题文件中有一个硬编码的路径.例如,主题创建者使用:

Incorrect styling implies that there is a hard-coded path within your theme files. For example, the theme creator used:

// Incorrect 
echo '/wp-content/themes/themename/css/stylesheet.css';

代替...

// Correct 
echo get_stylesheet_directory_uri() . '/css/stylesheet.css';

甚至是对 content_url 的错误调用.

Or even an incorrect call to content_url.

您需要找到这些硬编码的网址/路径,并将它们更新为正确的格式.

You'll need to find these hard-coded URLs/paths, and update them to the correct format.

这篇关于Wordpress:wp-content 文件夹与其他文件夹分开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆