我开发了一个在单个站点WP上运行良好的插件.
但是当在具有子域的WPMU上测试它时,我得到404 Not Found错误.
奇怪的是,即使我收到错误消息,内容也会被加载 - 但内容永远不会显示.
你可以在这里看到截图:http:
//www.stiengenterprises.com/download/tmp/jQuery_load_error.png
jQuery代码如下所示:
jQuery.post("/wp-content/plugins/wp-eventcal/eventcal_jquery.php", { instance: 'getEvent', eventID: eventID },
function(event)
{
alert(event); // For testing - never fires
}, "json");
Run Code Online (Sandbox Code Playgroud)
有关如何解决此问题的任何建议?
的.htaccess
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] …Run Code Online (Sandbox Code Playgroud) 如何获取具有<span>元素的所有列表元素class="required"
<form id="aform">
<ul>
<li id="name" >
<label class="description" for="name">Name<span class="required">*</span></label>
<div>
<input id="brand_name" name="brand_name" class="text textfield50pc" type="text" maxlength="40" value="<?php echo $brand->name; ?>"/>
</div>
</li>
</ul>
</form>
Run Code Online (Sandbox Code Playgroud) 我正在使用jQuery对话框询问用户是否确实要删除记录(用户已登录).
如果是,我获取记录的ID并运行jQuery.ajax.
record_id因此删除他不应删除的记录吗?这是我的代码:
function initDeleteRecord() {
var options = {
title: "Delete record",
modal: true,
buttons: {
"Ok": function() {
var record_id = jQuery('#recordID').val(); // <-- Can this be manipulated?
deleteRecord(record_id);
},
"Cancel": function() {
jQuery(this).dialog("close");
}
}
};
jQuery('#dialog').dialog(options);
jQuery('#dialog').dialog("open");
}
function deleteStore(store_id) {
jQuery.ajax({
url: siteURL +"/jquery.php",
data: {instance: 'deleteRecord', record_id : record_id},
success: (function(data) {
jQuery('#dialog').dialog("close");
window.location(siteURL);
}),
dataType: 'json'
});
}
Run Code Online (Sandbox Code Playgroud) 我正在开发一个网站,看起来不错。然后我打开调试以查看是否有任何错误,并收到以下消息:
Notice: Undefined offset: 0 in I:\path\to\file\MyFile.class.php on line 105
Run Code Online (Sandbox Code Playgroud)
在该行中,您将找到以下代码:
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $result[0]; // line 105
Run Code Online (Sandbox Code Playgroud)
如果我做一个print_r(result)我得到以下结果:
Array (
[0] => Array (
[id] => 3721
[parentID] =>
)
)
Array (
)
Run Code Online (Sandbox Code Playgroud)
如您所见,结果包含两个数组。第一个有数据,第二个没有数据。我从未见过print_r像这样输出两个数组。我猜这是第二个给我带来问题的。
谁能告诉我为什么第二个阵列潜入?
VAR转储
array
0 =>
array
'id' => string '3721' (length=4)
'parentID' => null
array
empty
Run Code Online (Sandbox Code Playgroud) 我正在创建一个用于在 Wordpress 中搜索用户的自动建议。
问题是名字和姓氏存储为 meta_key。
所以“正常”搜索是不可能的。
我可能需要做两个查询。可以做一个JOIN吗?
这是我不成功的第一次尝试:
SELECT user_id, first_name, last_name
FROM wp_usermeta
WHERE (meta_key='first_name' OR meta_key='last_name' OR meta_key = 'user_email')
AND LOWER(meta_value) LIKE '%jon%'
Run Code Online (Sandbox Code Playgroud) 在我做了一些更改后,我的反馈div不再以屏幕为中心,我无法弄清楚原因.
要使元素居中,只需设置宽度然后就可以了margin: 0 auto; 这应该足够了.
目标是让div显示在屏幕顶部,居中.你可以在这里看到我的fiddel:
码:
#feedback {
position: fixed;
top: 0px;
min-height: 50px;
width: 300px;
margin: 10px auto;
z-index: 9000;
font-weight: bold;
line-height: 24px;
border: solid 1px #d1d2d1;
padding: 10px;
background-color: #f7f2e7;
display: none;
border-radius: 5px;
-moz-border-radius: 5px; /* FF < 4.0 */
-webkit-border-radius: 5px; /* Rounded corners for Safari */
}
#feedback span { display: block; float: left;}
#feedback #feedback_icon { width: 24px; height: 24px; overflow: hidden; margin-right: 10px; }
#feedback #feedback_text { height: …Run Code Online (Sandbox Code Playgroud) 我的php页面中有以下代码:
$fair = Factory::new_fair_obj();
$fairs = $fair->getAllFairs();
$fairs_ddl = createFairDDL($fairs);
$first_fair_id = $fairs[0]['id'];
$fair = $fair->getFair($first_fair_id); // <-- works till here
$floorplan = $fair->getFloorplan($first_fair_id); // <-- This is where it breaks
Run Code Online (Sandbox Code Playgroud)
这是扩展DAO的业务类:
interface iFair {
public function getAllFairs();
public function getFair($id);
public function getFloorplan($id);
}
class Fair extends FairDAO implements iFair {
protected $db;
function __construct(&$db) {
$this->db = $db;
}
public function getAllFairs(){
return parent::getAllFairs();
}
public function getFair($id){
return parent::getFair($id);
}
public function getFloorplan($id){
return parent::getFloorplan($id);
}
} …Run Code Online (Sandbox Code Playgroud) 我在Wordpress网站上工作并从一些简单的sqripts开始:
(function () {
// Flex
if ($(".flexslider").length) {
$('.flexslider').flexslider();
}
})(jQuery);
Run Code Online (Sandbox Code Playgroud)
我也试过了
$(function () {
// Flex
if ($(".flexslider").length) {
$('.flexslider').flexslider();
}
});
Run Code Online (Sandbox Code Playgroud)
jQuery正在运行,为什么不$被识别?如果我$用jQuery它替换它工作正常.
这也不起作用:
jQuery(document).ready(function() {
$('.section_header').click(function(){
alert('test');
});
});
Run Code Online (Sandbox Code Playgroud) 我在这里创造了一个小提琴:http://jsfiddle.net/zY3rL/1/
在我的CSS中,我通过执行以下操作重置链接样式:
@import "http://necolas.github.io/normalize.css/3.0.0/normalize.css"
@import "http://fonts.googleapis.com/css?family=Open+Sans:400,300"
a { text-decoration: none; }
ol,ul { list-style: none; margin: 0; padding: 0; }
Run Code Online (Sandbox Code Playgroud)
为什么这段代码中的链接仍然有下划线?
<ul class="menu">
<li>
<a href="">Invoicing</a>
<ul>
<li><a href="">Create an Invoice</a></li>
<li><a href="">View sent Invoices</a></li>
<li><a href="">View rejected Invoices</a></li>
</ul>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)