我刚刚开始使用GIT并认为它很精彩,但我对merge命令的作用有点困惑.
让我们说我们在分支"A"中有一个工作项目.
我回家对这个分支进行更改并将其保存为"B".另一个程序员对"A"进行更改并将其保存为"C".
有没有办法将两个分支"B"和"C"合并在一起,然后将更改作为新分支提交,说"D"?
或者我错过了"合并"的观点?
我读了一些关于如何在wordpress插件中集成媒体上传器的教程.我根据教程做了媒体上传器.
http://wordpress.org/support/topic/howto-integrate-the-media-library-into-a-plugin?replies=4
我这样做,它完美地工作.当我再次尝试相同的脚本多次媒体上传时,这是我试过的小提琴只是改变了特定文本字段的ID.
http://jsfiddle.net/UrXPe/1/
不过当我点击上传一切都是为了是做到了完美.唯一的事情,如果我点击insert into post它的图像的网址出现在第二个浏览字段中.这是我完全面对的截图.

当我在插入帖子后点击第一个上传字段(上传过程成功)时,相应的媒体网址出现在第二个字段中,而不是第一个.我不知道问题在哪里,任何建议都会很棒.
我试图找到do_action和add_action的确切作用.我已经用add_action检查了但是对于do_action我正在尝试新的.这是我试过的.
function mainplugin_test() {
$regularprice = 50;
if(class_exists('rs_dynamic')) {
$regularprice = 100;
}
// and doing further
//like i echoing the regular price
echo $regularprice; //It print 100 from this code
}
Run Code Online (Sandbox Code Playgroud)
现在我没有在主文件中放置少量代码,而是计划创建do_action以避免代码混乱问题.
function mainplugin_test() {
$regularprice = 50;
do_action('testinghook');
// and doing further
//like i echoing the regular price
echo $regularprice; //It should print 100 but it print 50
}
Run Code Online (Sandbox Code Playgroud)
所以我创建了另一个函数来指出钩子就像
function anothertest() {
if(class_exists('rs_dynamic')) {
$regularprice = 100;
}
}
add_action('testinghook','anothertest');
Run Code Online (Sandbox Code Playgroud)
不知道如何将代码行添加到上面的函数可能有效的钩子中?按照我在测试环境中尝试过没有任何帮助.如果我理解正确的do_action更像是包含一个文件??? 如果没有,请告诉我.
谢谢.
在这里,我试图禁用Ctrl+,P但它不会让我警觉,它也显示打印选项
jQuery(document).bind("keyup keydown", function(e){
if(e.ctrlKey && e.keyCode == 80){
alert('fine');
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
我不知道如何使用jQuery或JavaScript 禁用Ctrl+ P组合.
谢谢
我想使用php preg replace来删除反斜杠.
例如:我有一个字符串看起来像
$var = "This is the for \testing and i want to add the # and remove \slash alone from the given string";
Run Code Online (Sandbox Code Playgroud)
如何\使用php从相应的字符串中删除单独preg_replace
如何<br/>使用jquery 拆分包含标记的字符串.我尝试了以下代码,但它在控制台中出错.我不知道如何基于<br/>标签拆分字符串这是我尝试的代码
jQuery(document).ready(function($)
{
var lines = jQuery('this is for testing <br/> How are you<br/>').split('<br/>');
jQuery.each(lines, function() {
alert(this);
});
});
Run Code Online (Sandbox Code Playgroud)
任何建议都会很棒.
问题可能很奇怪:(
我试图通过短码来显示折扣的一些信息结帐页面的woocommerce有钩的woocommerce_before_checkout_form.如果我在购物车页面应用的优惠券,并参观结账注意到挂钩的消息显示了打折的正确值,但结账如果我删除/添加没有出现在那个woocommerce_before_checkout_form钩子我尝试通过删除和添加该钩子但仍然短码值没有更新,我测试了多次与以下功能可以任何人有一些工作的想法/建议将是伟大的
<?php
/*
* Plugin Name: Hook Priority
*
*/
function add_my_shortcode() {
ob_start();
global $woocommerce;
echo $woocommerce->cart->discount_cart;
return ob_get_clean();
}
add_shortcode('my_shortcode', 'add_my_shortcode');
function add_message_in_checkout() {
var_dump(do_shortcode('[my_shortcode]'));
}
add_action('woocommerce_before_checkout_form', 'add_message_in_checkout');
function coupon_removed_function( $coupon_code ) {
remove_all_actions('woocommerce_before_checkout_form');
remove_shortcode('my_shortcode');
do_action('woocommerce_before_checkout_form');
}
add_action("woocommerce_removed_coupon", 'coupon_removed_function');
Run Code Online (Sandbox Code Playgroud)
我尝试使用javascript重新加载页面(刷新实例)并且它正在工作,我不想使用那个,除非没有本机wordpress/php解决方案需要克服.
echo "<script type='text/javascript'>location.reload();</script>";
Run Code Online (Sandbox Code Playgroud)
我身边目前发生的事情是
我从购物车添加了10美元的折扣,然后在结帐时,我可以看到10美元的价值,但如果我从结帐中删除优惠券它仍然显示10美元但它应该是0美元.
提前致谢.
我正在尝试创建一个基于AJAX的WordPress示例插件.我阅读了一个教程并做了一个插件,但它没有用.我是AJAX的新手.这是我试过的代码:
<?php
class ajaxtest {
function ajaxcontact() {
?>
<div id="feedback"></div>
<form name="myform" id="myform">
<li>
<label for fname>First Name</label><input type="text" id="fname" name="fname" value=""/>
</li>
<li>
<label for lname>Last Name</label><input type="text" id="lname" name="lname" value=""/>
</li>
<input type="submit" value="Submit" id="submit" name="submit"/>
</form>
<script type="text/javascript">
jQuery('#submit').submit(ajaxSubmit);
function ajaxSubmit() {
var newcontact = jQuery(this).serialize();
jQuery.ajax({
type: "POST",
url: "/wp-admin/admin-ajax.php",
data: newcontact,
success: function(data) {
jQuery("#feedback").html(data);
}
});
return false;
}
</script>
<?php
}
function addcontact() {
$fname = $_POST['fname'];
if ($fname != "") { …Run Code Online (Sandbox Code Playgroud) 我尝试<style type="text/css"></style>使用jquery 添加到头部.我试过这样的
$("<style type='text/css'></style>").appendTo("head");
Run Code Online (Sandbox Code Playgroud)
以前,我有这种类型
<style type="text/css">
img{
-moz-animation:.6s rotateRight infinite linear;
-webkit-animation:.6s rotateRight infinite linear;
}
@-moz-keyframes rotateRight{
0%{ -moz-transform:rotate(0deg); -moz-transform-origin:50% 50%; }
100%{ -moz-transform:rotate(360deg); }
}
@-webkit-keyframes rotateRight{
0%{ -webkit-transform:rotate(0deg); -webkit-transform-origin:50% 50%; }
100%{ -webkit-transform:rotate(360deg); }
}
</style>
Run Code Online (Sandbox Code Playgroud)
当我用这样的jquery尝试这个时,上面的样式工作:
$("<style type='text/css'>img{
-moz-animation:.6s rotateRight infinite linear;
-webkit-animation:.6s rotateRight infinite linear;
}
@-moz-keyframes rotateRight{
0%{ -moz-transform:rotate(0deg); -moz-transform-origin:50% 50%; }
100%{ -moz-transform:rotate(360deg); }
}
@-webkit-keyframes rotateRight{
0%{ -webkit-transform:rotate(0deg); -webkit-transform-origin:50% 50%; }
100%{ -webkit-transform:rotate(360deg); }
}</style>").appendTo("head");
Run Code Online (Sandbox Code Playgroud)
但我在编辑器本身得到错误.这是照片
我想我搞砸了一些东西:(
http://jsfiddle.net/jSvUE/ …
jquery ×5
php ×4
wordpress ×4
javascript ×3
css ×2
html ×2
commit ×1
git ×1
merge ×1
preg-replace ×1
regex ×1
replace ×1
stripslashes ×1
woocommerce ×1