我试图实现这种效果(蓝色和灰色之间的空格),就像附加的图像一样.那些就像两种颜色的边缘或两种颜色之间没有颜色.
但目前设法这个(没有空格).
function loadPieCircle() {
var el = document.getElementsByClassName('chart'); // get canvas
for (i = 0; i < el.length; i++) {
var options = {
percent: el[i].getAttribute('data-percent') || 25,
size: el[i].getAttribute('data-size') || 220,
lineWidth: el[i].getAttribute('data-line') || 15,
rotate: el[i].getAttribute('data-rotate') || 0
}
var canvas = document.getElementById('canvas-' + i);
if (typeof(G_vmlCanvasManager) !== 'undefined') {
G_vmlCanvasManager.initElement(canvas);
}
var ctx = canvas.getContext('2d');
canvas.width = canvas.height = options.size;
el[i].appendChild(canvas);
ctx.translate(options.size / 2, options.size / 2); // change center
ctx.rotate((-1 / 2 + options.rotate / …
Run Code Online (Sandbox Code Playgroud)我试图将SQL查询转换为wordpress查询,但无法理解它是如何完成的?
查询我尝试转换为 new wp_query
$query = " SELECT SQL_CALC_FOUND_ROWS distinct wp_posts.ID
FROM wp_posts
INNER JOIN wp_postmeta
ON ( wp_posts.id = wp_postmeta.post_id )
INNER JOIN wp_postmeta AS mt1
ON ( wp_posts.id = mt1.post_id )
WHERE 1 = 1
AND wp_posts.id NOT IN ( 0 )
AND wp_posts.post_type = 'topic'
AND ( wp_posts.post_status = 'publish'
OR wp_posts.post_status = 'closed'
OR wp_posts.post_status = 'reported' )
AND ( wp_postmeta.meta_key = '_bbp_last_active_time')
GROUP BY wp_posts.id
ORDER BY wp_postmeta.meta_value DESC
LIMIT 0, 10
";
$topics = …
Run Code Online (Sandbox Code Playgroud) 我的滑块中有以下查询
<?php query_posts( 'category_name=Uncategorized&posts_per_page=3' );
Run Code Online (Sandbox Code Playgroud)
而不是3我需要动态添加posts_per_page.为了触发我的functions.php主题的选项,我通常会这样做
<?php $settings = get_option('mytheme_options'); echo $settings['postspage'];?>
Run Code Online (Sandbox Code Playgroud)
我试过了
<?php
query_posts('category_name=Uncategorized&posts_per_page=$settings["postspage"]');
?>
Run Code Online (Sandbox Code Playgroud)
它没有做任何事情或回应任何错误
当我徘徊在一些星星上时,我有一个奇怪的问题.明星效应应该正常工作,当用户徘徊第二颗星时,第一颗星也应该被填充,当用户在第三颗星上徘徊时,应该也填充前一颗星.
的jsfiddle:
HTML
<ul class="star-rating">
<li><a id="1" title="1 star out of 5" class="one-star starz">1</a></li>
<li><a id="2" title="2 stars out of 5" class="two-stars starz">2</a></li>
<li><a id="3" title="3 stars out of 5" class="three-stars starz">3</a></li>
<li><a id="4" title="4 stars out of 5" class="four-stars starz">4</a></li>
<li><a id="5" title="5 stars out of 5" class="five-stars starz">5</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
CSS
.star-rating{
list-style:none;
margin: 0 auto;
padding:0px;
width: 250px;
height: 50px;
position: relative;
background: url(http://s11.postimg.org/cfr9p1xjz/alt_star.png) top left repeat-x;
}
.star-rating li{
padding:0px;
margin:0px;
float: left;
}
.star-rating li …
Run Code Online (Sandbox Code Playgroud) 几周后,我开始再次研究垃圾邮件问题,并发现了许多.htaccess服务器端解决方案.我已经完成了创建以下.htaccess代码,帮助我100%打击垃圾邮件.我决定用所有提示制作一个htaccess代码.看看下面.
我有
<?php while ( have_posts() ) : the_post(); ?>
<div class="boxes-third boxes-first">
<div class="latestthree">
<div class="title">
<?php get_the_title($id); ?> // I am trying to get the post title here but doesn't work
<span class="titlearrow"></span>
</div>
<div class="latestthreeimage">
<a rel="prettyPhoto" title="<?php get_the_title($id); ?>"> /same here
<?php the_post_thumbnail(array(300,133)); ?>
</a></div>
<div class="text">
Here i would like to get the excerpt of the post that is no longer than 25 words
<span class="textarrow"></span>
</div>
</div>
</div>
<?php endwhile; ?>
Run Code Online (Sandbox Code Playgroud)
我正在尝试执行上述操作,但没有成功,并且在最后一个没有找到相关信息。我正在使用 wp 3.7.1。请帮我。
我正在尝试将天数转换为年数和剩余天数格式.这是我试过的:
<?php
$reg_date = date('Y-m-d', strtotime($whois_details[5])); // 1997-09-15
$total_days = (date('Y-m-d') - $reg_date) * 365; // 2014-07-30
$total_years = intval($total_days / 365);
$remaining_days = ($total_days % 365) % 30;
if ($total_days < 365) {
$remaining_days = $total_days;
}
echo $total_years.' years and '.$remaining_days.' days';
?>
Run Code Online (Sandbox Code Playgroud)
输出 - 300
0 years and 300 days - THIS IS OK
Run Code Online (Sandbox Code Playgroud)
输出 - 500
1 years and 15 days - THIS IS NOT OK
Run Code Online (Sandbox Code Playgroud)
应该是 - 500
1 years and 135 days
Run Code Online (Sandbox Code Playgroud)
我错了什么 …
我试图在函数中访问类中的变量:
class google_api_v3 {
public static $api_key = 'this is a string';
function send_response() {
// access here $api_key, I tried with $this->api_key, but that works only on private and that variable I need also to access it outside the class that is why I need it public.
}
}
function outside_class() {
$object = new google_api_v3;
// works accessing it with $object::api_key
}
Run Code Online (Sandbox Code Playgroud) 我试图$.post
在所有 ajax 调用完成后调用一个函数。该调用被触发只是因为它在连续循环中运行。
var jQuery_1_11_0 = $.noConflict(true);
jQuery_1_11_0(document).ready(function () {
var domain = '<?php echo $url; ?>';
// AJAX 1
$.ajax({
type: 'POST',
url: 'lib/ajax.html',
data: {/* some data*/},
beforeSend: function (data) {/* some code */},
complete: function () {
$.getJSON('lib/get-details.html', function(data) {
// some code here
}
});
// AJAX 2
$.ajax({
type: 'POST',
url: 'lib/ajax.html',
data: {/*some code*/},
beforeSend: function (data) {/*some code*/},
complete: function () {
$.getJSON('lib/get-details.html', function(data) {
// some code here
}
}); …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用wordpress函数和$wbdb
我在wordpress之外的脚本,但我无法弄清楚如何做到这一点.
我试过了:
require_once('./wp-load.php' ); // this is the correct path is tested.
class cron extends wpdb {
public function results(){
$sql = 'SELECT sub_id,email,cate_id FROM co_subsriber WHERE status = 0 ORDER BY sub_id ASC LIMIT '.$start.',750'; // $start =0
$records = $wpdb->get_results($sql);
}
}
Run Code Online (Sandbox Code Playgroud)
我收到错误
Warning: Missing argument 1 for wpdb::__construct(), called in wp-db.php on line 578
Warning: Missing argument 2 for wpdb::__construct() called in wp-db.php on line 578
Warning: Missing argument 3 for wpdb::__construct() called in wp-db.php …
Run Code Online (Sandbox Code Playgroud)