【问题标题】:Wordpress jquery datepicker only highlight posted dates?Wordpress jquery datepicker 仅突出显示发布日期?
【发布时间】:2017-08-25 13:09:52
【问题描述】:

Wordpress jquery datepicker 仅突出显示仅包含帖子日期的日期?

【问题讨论】:

    标签: jquery database wordpress plugins


    【解决方案1】:
     I own found solution for this question.
    
      $(function() {
    
      var array = [];
      var res=[];
      $.ajax({
       url: 'get_post_dates.php',
       type: 'POST',
       dataType:"JSON",
       success: function(data) {
         for (var i = 0; i <(data.r.length); i++) {
          array.push(data.r[i])
         }
        },
      });
     $("#datepicker").datepicker({
        beforeShowDay: function(date){
          var string = $.datepicker.formatDate('yy-mm-dd', date);
          return [ array.indexOf(string) != -1 ]
        },
      }); // end datepicker
    
     }); 
    
     --
     get_post_dates.php
     $con = mysqli_connect("hostname","db_user","db_pass","db_name");
     if (mysqli_connect_errno()){
       echo "Failed to connect to MySQL: " . mysqli_connect_error();
     }
     $query= "SELECT posted_date as pDated FROM `blog_posts`";
     $result = $con->query($query);
     $array =array();
     while( $row = $result->fetch_assoc() ) {
       array_push($array,$row["pDated"]);
     }
     echo json_encode( array("r"=>$array));   
    

    【讨论】:

      猜你喜欢
      • 2012-12-11
      • 1970-01-01
      • 2013-01-17
      • 2016-12-07
      • 1970-01-01
      • 2012-03-11
      • 2019-12-26
      • 2015-12-14
      • 2013-06-24
      相关资源
      最近更新 更多