我正在创建一个每周工作的表日历.日历看起来像这样
我使用我在这里找到的代码来设置标题日期.我的代码看起来像这样:
$dt = new DateTime;
$dt->setISODate($dt->format('o'), $dt->format('W'));
$year = $dt->format('o');
$week = $dt->format('W');
$current_time = time();
$return .= '<table class="reservation_time_table">
<tr><th>'.esc_html__('Hours', 'time_reservation').'</th>';
do {
$return .= '<th>' . $dt->format('l') . '<br>' . $dt->format('d M Y') . '</th>';
$dt->modify('+1 day');
} while ($week == $dt->format('W'));
$return .= '</tr>';
for ($hour=8; $hour < 23 ; $hour++) {
$return .= '<tr>';
$return .= '<th>'.$hour.':00</th>';
for ($i=0; $i <7 ; $i++) {
$return .= '<td data-reservation_time=""></td>';
}
$return .= '</tr>';
} …
Run Code Online (Sandbox Code Playgroud) 我已经在单个产品页面上的简短描述后成功添加了一个内容
if (!function_exists('my_content')) {
function my_content( $content ) {
$content .= '<div class="custom_content">Custom content!</div>';
return $content;
}
}
add_filter('woocommerce_short_description', 'my_content', 10, 2);
Run Code Online (Sandbox Code Playgroud)
我看到short-description.php
那里有apply_filters( 'woocommerce_short_description', $post->post_excerpt )
所以我迷上了.
以同样的方式,我想在添加到购物车按钮后添加内容,所以我找到了do_action( 'woocommerce_before_add_to_cart_button' )
,现在我正在挂钩woocommerce_before_add_to_cart_button
.我正在使用
if (!function_exists('my_content_second')) {
function my_content_second( $content ) {
$content .= '<div class="second_content">Other content here!</div>';
return $content;
}
}
add_action('woocommerce_after_add_to_cart_button', 'my_content_second');
Run Code Online (Sandbox Code Playgroud)
但没有任何反应.我可以只挂钩里面的钩子apply_filters
吗?从我到目前为止通过使用钩子所理解的是,你只需要一个挂钩名称来挂钩,就是这样.第一个是过滤器钩子,所以我使用了add_filter
,第二个是动作钩子所以我应该使用add_action
,所有都应该工作.那为什么不呢?
我有一个select元素,其中的选项值为某些数字(某些id).
<select id="select">
<option value="21">Random<option>
<option value="23">Random 2<option>
<option value="25">Random 3<option>
<option value="27">Random 4<option>
</select>
Run Code Online (Sandbox Code Playgroud)
它旁边是一个提交按钮,它将执行某种提交.
<a class="button" href="www.random.org">Click me!</a>
Run Code Online (Sandbox Code Playgroud)
我需要?id=
使用select的id值添加到该链接.我创建了代码,但问题是它只是在?id=
每次更改select选项时附加
var id;
$('#select').on('change', function(){
id = $(this).val();
var new_href = $('.button').attr('href') + '?id=' + id;
$('.button').attr('href', new_href);
});
Run Code Online (Sandbox Code Playgroud)
所以,当我点击第一个选项时,我得到了 href
www.random.org?id=21
Run Code Online (Sandbox Code Playgroud)
但是,如果我点击第二个(或任何相关的)我得到
www.random.org?id=21?id=23
Run Code Online (Sandbox Code Playgroud)
它附加了id.如何"清除"以前的更改ID,并替换为所选的?我究竟做错了什么?
所以我正在通过freecodecamp,我正在解决那里的问题,继续编程循环,我偶然发现了一个障碍,我不太确定是什么问题.
所以我有一个名为contacts的对象数组,我需要创建一个名为的函数lookUp(firstName, prop)
.作业的文本是这样的:
该函数应检查是否
firstName
是实际联系人firstName
,并且给定的property(prop
)是该联系人的属性.如果两者都为真,则返回该属性的"值".
如果
firstName
不对应任何联系人,则返回"没有此类联系人"如果
prop
不对应任何有效的属性,则返回"No such property"
代码:
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"]
},
{
"firstName": "Sherlock",
"lastName": "Holmes",
"number": "0487345643",
"likes": ["Intruiging Cases", "Violin"]
},
{
"firstName": "Kristian",
"lastName": "Vos",
"number": "unknown",
"likes": ["Javascript", "Gaming", "Foxes"]
},
];
function lookUp( firstName, prop …
Run Code Online (Sandbox Code Playgroud) 我有一点问题.我有一个程序,它将为潜力绘制波函数,当我使用绘图中的选项(使用pylab)' - '时它看起来很好:例如:http://img41.imageshack.us/img41/8798/59138635 . PNG
如果我使用'o'我会得到:http: //img16.imageshack.us/img16/3741/22378006.png
你看它看起来很难看:
是否有一种简单的方法可以使圆圈更加间隔,或者这取决于代码的细节?
代码是:
from math import *
from scipy.special import *
from pylab import *
from scipy.linalg import *
firebrick=(178./255.,34./255.,34./255.)
indianred=(176./255.,23./255.,31./255.)
steelblue=(70./255.,130./255.,180./255.)
slategray1=(198./255.,226./255.,255./255.)
slategray4=(108./255.,123./255.,139./255.)
lavender=(230./255.,230./255.,230./255.)
cobalt=(61./255.,89./255.,171./255.)
midnightblue=(25./255.,25./255.,112./255.)
forestgreen=(34./255.,139./255.,34./255.)
#grid
Nmesh=512
L=4.0
dx=L/Nmesh
Xmax=L
x=arange(-L,L+0.0001,dx)
Npts=len(x)
numwav=2 #number of wave function that is being drawn
V=zeros([Npts],float)
for i in range(Npts):
V[i]=x[i]**4
a=zeros([2,Npts-2],float)
wave=zeros([Npts],float)
wave1=zeros([Npts],float)
encor=3.0/4*(3.0/4)**(1.0/3)
#numerical solution
for i in range(1,Npts-1,1):
a[0,i-1]= 1.0/dx**2+V[i] #diagonal elements
a[1,i-1]=-1.0/dx**2/2 #the elements below the …
Run Code Online (Sandbox Code Playgroud) 我正在使用基于aps文章的LaTeX模板,我想在两篇文章中将两张图片彼此相邻(带字幕),以便它们跨越两列.
我使用了minipage inside figure选项(在一篇专栏文章中有效),但我无法得到理想的结果.我希望它看起来像这样: 我希望它看起来如何
所以这个例子只有一个标题,但那是无关紧要的.我想把两张图片放在一起,以便它们位于页面顶部.
有什么建议?谢谢 : )
我尝试删除类名为"true"的last-child的边框.:last-child
不管用.
<div>
<div class="common true">1111</div>
<div class="common">2222</div>
<div class="common true">3333</div>
<div class="common true">4444</div>
<div class="common true">5555</div>
<div class="common true">6666</div>
<div class="common true">7777</div>
<div class="common">8888</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.common.true {
display: block;
border-top: 1px solid;
}
.true:last-child {
border-top: none;
}
Run Code Online (Sandbox Code Playgroud)
JSFIDDLE:http://jsfiddle.net/C23g6/1253/
我想弄清楚如何将我的<h4>
标签和<button
标签并排放置。
当前行为- 现在它们在我的图像下方,我希望它们处于水平位置。
必需的行为- 我希望<h4>
与图像<button>
并排,并与<h4>
.
我尝试向右浮动并显示块,但元素仍然在图像下方且彼此之间。
如何data-attr
在 Angularjs 中获取 html5值,并在同一类单击中单击相同的功能。
就像在 jquery 中我们点击一些类元素并获取当前元素 data-num
。
我必须以有角度的方式实现这一点。
如何让多类元素点击并获取当前数据值($this)?
<html ng-app="myApp">
<head></head>
<body ng-controller="mainController">
<div ng-click="clicked()" data-num="1" class="same white">White</div>
<div ng-click="clicked()" data-num="2" class="same green">Green</div>
<div ng-click="clicked()" data-num="3" class="same red">Red</div>
<div ng-click="clicked()" data-num="4" class="same white">White</div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script>
<script>
var myApp = angular.module('myApp',[]);
myApp.controller('mainController',function($scope){
$scope.clicked = function(){
var id = angular.element('.same').scope();
console.log(id);
};
});
</script>
</html>
Run Code Online (Sandbox Code Playgroud) wp_create_user(工作)
$username='balan';
$user_pass ='balan';
$user_email= 'random_email@email.com';
$password = wp_hash_password( $user_pass );
$user_id = wp_create_user( $user_name, $password, $user_email );
Run Code Online (Sandbox Code Playgroud)
$username='balan';
$user = get_user_by( 'login', $username );
$pass ='balan';
$hash = wp_hash_password($pass);
if (wp_check_password( $pass, $user->data->user_pass, $user->ID ) ) {
echo "<br>Correct";
} else {
echo "<br>Wrong";
}
**WordPress login function**
$creds = array();
$creds['user_login'] = 'balan';
$creds['user_password'] ='balan';
$creds['remember'] = true;
$user = wp_signon( $creds, false );
Run Code Online (Sandbox Code Playgroud)
比较登录密码时出错.如何比较登录密码?
wp_check_password()
不管用.请帮我解决这个问题.