我正在本地计算机上使用 AMPPS 作为本地主机进行WordPress设置。使用 Delta 主题,我创建了一个子主题 (delta2-child)。初始设置效果很好。但是,我需要更改包含文件夹中名为 home-slider.php 的文件。
原始文件位置:
c:\Program Files (x86)\Ampps\www\armstrong\wp-content\themes\delta\includes\home-slider.php
Run Code Online (Sandbox Code Playgroud)
子主题文件的位置:
c:\Program Files (x86)\Ampps\www\armstrong\wp-content\themes\delta2-child\includes\home-slider.php
Run Code Online (Sandbox Code Playgroud)
如果我将 home-slider 文件移至子主题文件夹 [ delta2-child\includes\home-slider.php ],主题仍使用父主题 home-slider 文件。
如果我将以下内容添加到 CT 的functions.php 文件中:
require_once( get_stylesheet_directory_uri() . "/includes/home-slider.php" ); */
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Warning: require_once(C:\Program Files (x86)\Ampps\www\armstrong/wp-content/themes/delta/includes/home-slider.php) [function.require-once]: failed to open stream: No such file or directory in C:\Program Files (x86)\Ampps\www\armstrong\wp-content\themes\delta2-child\header.php on line 87
Fatal error: require_once() [function.require]: Failed opening required 'C:\Program Files (x86)\Ampps\www\armstrong/wp-content/themes/delta/includes/home-slider.php' (include_path='.;C:\php\pear') in C:\Program Files (x86)\Ampps\www\armstrong\wp-content\themes\delta2-child\header.php on line 87
Run Code Online (Sandbox Code Playgroud)
任何有知识的人都可以告诉我如何引用 home-slider 文件而不产生上述错误。
我正在构建一个包含页面、帖子和活动的 WordPress 网站(您可以登录多个日期)。我是 WordPress 新手,所以我一直在寻找适合此事件的理想解决方案。
我相信最好的解决方案是创建名为“事件”的自定义帖子类型,然后单独处理它。
但我不确定如何为每个事件添加多个日期。我一直在阅读有关自定义分类法和帖子元数据的内容,但我经历的每个示例都像是创建自定义类别、标签或向帖子添加单个值。
对于将多个日期(提前不知道多少个)添加到自定义帖子类型,您有何建议?是分类法还是帖子元数据?是否有带有内置日期输入验证或日期选择器的日期类型元数据?
谢谢你!
如何添加与产品类别段相关的主体类?
谢谢你!
问题是...当我单击编辑帖子/编辑页面时,它尝试打开http://localhost/site/wp-admin/post-108.php?post=286&action=edit并最终出现 404 页面。保存新帖子/页面时,它还会显示 404 页面。
我不记得我到底做了什么,但它一定是在我的 IDE 在重命名模板文件时重构代码后开始的。
wp-admin文件夹或我的主题文件夹内没有post-108.php,但有 post.php。我不知道为什么它试图打开不存在的 post-108.php 。
注意:这是我使用 wordpress 4.7.4 自己构建的自定义主题
谢谢你们。
wordpress wordpress-theming custom-wordpress-pages wordpress-thesis-theme
注意:我 15 岁了,还在学习编码,所以如果你回答我,请彻底回答我......
大家好,我正在用 WordPress 制作自己的网站,我也在制作自己的自定义主题,并且仍在开发中,该网站已经上线,但尚未完成,我想尽快完成,因为当学校到了我就没有时间再编码了。
我网站的主要功能之一是我希望它是一个多语言网站,至少是阿拉伯语和英语,所以我安装了 Polylang WordPress 插件,一切都很好,除了页脚中的一些文本是硬编码的,在 footer.php 文件中自行编写,因此 Polylang 根本无法触及它。我想使用 Polylang 字符串翻译选项来翻译页眉或页脚或我指定的任何位置中的任何文本。这是我的问题。
我想要这个问题的解决方案,提前致谢。
抱歉,如果有任何语言错误和布局错误,我是通过手机发短信的。
我已经从列表中隐藏了管理员用户并减去了用户数量,但是,用户列表中的管理员角色选项卡(用户>>所有用户)仍然显示,我想随意隐藏它。
这是我用来隐藏管理员的代码:
add_action('pre_user_query','site_pre_user_query');
function site_pre_user_query($user_search) {
global $current_user;
$username = $current_user->user_login;
if ($username == 'admin') {
}
else {
global $wpdb;
$user_search->query_where = str_replace('WHERE 1=1',
"WHERE 1=1 AND {$wpdb->users}.user_login != 'admin'",$user_search->query_where);
}
}
Run Code Online (Sandbox Code Playgroud)
这就是我用来减去用户数量的方法:
add_filter("views_users", "site_list_table_views");
function site_list_table_views($views){
$users = count_users();
$admins_num = $users['avail_roles']['administrator'] - 1;
$all_num = $users['total_users'] - 1;
$class_adm = ( strpos($views['administrator'], 'current') === false ) ? "" : "current";
$class_all = ( strpos($views['all'], 'current') === false ) ? "" : "current";
$views['administrator'] = '<a href="users.php?role=administrator" class="' …Run Code Online (Sandbox Code Playgroud) 我需要在一页上显示所有页面.
目前我正在使用它来引入每个页面:
<?php
$page_id = 5; //id example
$page_data = get_page( $page_id );
$content = apply_filters('the_content', $page_data->post_content);
$title = $page_data->post_title;
echo $content;
?>
Run Code Online (Sandbox Code Playgroud)
但是如果创建了一个新页面,它就不会显示它,因为它不会有这个代码和它的ID.
有没有办法自动引入所有页面?
任何帮助将不胜感激,谢谢
我正在使用get_results来获取包含数据的数组.在此数据中有帖子ID.当我尝试检索带有帖子ID的图像时,我没有检索到图像.任何的想法 ?
这是我的代码.
首先,我在functions.php中添加下一个代码
/**
* Check to see if the function exists
* It is always a good practice to avoid any version conflict
*/
if(function_exists('add_theme_support'))
{
/** Exists! So add the post-thumbnail */
add_theme_support('post-thumbnails');
/** Now Set some image sizes */
/** #1 for our featured content slider */
add_image_size( $name = 'itg_featured', $width = 500, $height = 300, $crop = true );
/** #2 for post thumbnail */
add_image_size( 'itg_post', 250, 250, true );
/** #3 for …Run Code Online (Sandbox Code Playgroud)