小编Adr*_*ian的帖子

进度圆与颜色之间的空格

我试图实现这种效果(蓝色和灰色之间的空格),就像附加的图像一样.那些就像两种颜色的边缘或两种颜色之间没有颜色.

我想要实现的目标:弧之间有空格.

但目前设法这个(没有空格).

我现在拥有的:弧之间没有空格.

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)

html javascript css jquery

8
推荐指数
1
解决办法
615
查看次数

使用新的wp_query将transofrm sql查询到wordpress查询

我试图将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 mysql sql-server wordpress

6
推荐指数
1
解决办法
3890
查看次数

如何在wordpress中的查询中动态添加帖子数量

我的滑块中有以下查询

<?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)

它没有做任何事情或回应任何错误

php wordpress

5
推荐指数
1
解决办法
51
查看次数

悬停在星空上时星级评定css问题

当我徘徊在一些星星上时,我有一个奇怪的问题.明星效应应该正常工作,当用户徘徊第二颗星时,第一颗星也应该被填充,当用户在第三颗星上徘徊时,应该也填充前一颗星.

的jsfiddle:

http://jsfiddle.net/tkh2czee/

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)

html css hover

4
推荐指数
1
解决办法
716
查看次数

如何使用htaccess阻止垃圾邮件和垃圾邮件?

几周后,我开始再次研究垃圾邮件问题,并发现了许多.htaccess服务器端解决方案.我已经完成了创建以下.htaccess代码,帮助我100%打击垃圾邮件.我决定用所有提示制作一个htaccess代码.看看下面.

php apache .htaccess mod-rewrite spam

3
推荐指数
1
解决办法
1万
查看次数

在while循环中获取索引php中的帖子标题

我有

<?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 wordpress

2
推荐指数
1
解决办法
3594
查看次数

将天数转换为剩余年份和天数

我正在尝试将天数转换为年数和剩余天数格式.这是我试过的:

<?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)

http://codepad.org/MDQjsz5l

应该是 - 500

1 years and 135 days
Run Code Online (Sandbox Code Playgroud)

我错了什么 …

php

2
推荐指数
1
解决办法
2848
查看次数

在函数php中访问类中的公共静态变量

我试图在函数中访问类中的变量:

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)

php oop class

2
推荐指数
2
解决办法
6962
查看次数

$.post在ajaxstop函数中不断循环

我试图$.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)

javascript ajax jquery json

2
推荐指数
1
解决办法
1018
查看次数

通过扩展一个类,在它之外使用wordpress 4.0?

我正在尝试使用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)

php wordpress

2
推荐指数
1
解决办法
286
查看次数

标签 统计

php ×7

wordpress ×4

css ×2

html ×2

javascript ×2

jquery ×2

.htaccess ×1

ajax ×1

apache ×1

class ×1

hover ×1

json ×1

mod-rewrite ×1

mysql ×1

oop ×1

spam ×1

sql-server ×1