我有一个像这样的简单链接: <a href="?wp_accept_function=10">Accept</a>
我的想法是,这将运行一个名为wp_accept_function的函数,并传入10的id,我该怎么做?谢谢
这是我到目前为止的代码,但我觉得我出错了,需要将数字传递给函数,然后才能在函数中使用它.谢谢
if ( isset ( $_GET ['wp_accept_function'] ) )
{
function wp_accept_favor ( $id )
{
// JAZZ
}
}
Run Code Online (Sandbox Code Playgroud) 我有以下链接,允许作者删除我网站上的帖子,但我需要它之后重定向到主页,因为目前它试图将用户带到帖子本身,这会抛出 404 错误不再存在(不太用户友好)
这是代码:<p id="delete"><a title="Delete your Favor?" href="<?php echo get_delete_post_link( $post->ID ); ?>">Delete your Favor?</a></p>
如何修改它以重定向到主页?
这有什么问题?
echo '<a title="Last Chance" href="'.the_permalink().'" class="status open">Last Chance</a>';
Run Code Online (Sandbox Code Playgroud)
因为它是在它the_permalink()之前<a而不是在它内部.
我想使用select来更改url末尾的查询以更改它的排序选项.例如:
<select id="sort">
<option value="?order_by=date">Recent</option>
<option value="?order_by=random">Popular</option>
<option value="?order_by=random">Random</option>
<option value="">Staff Picks</option>
</select>
Run Code Online (Sandbox Code Playgroud)
因此,例如默认情况下,帖子列表将按日期显示,然后如果用户选择一个选项,它将使用URL末尾的查询字符串重新加载页面.如果可能的话,希望使用jQuery来实现这一目标.谢谢.
/action?query=value和之间有什么区别/action/query:value
因为后者似乎是在CakePHP中处理查询字符串的方式,我如何在Cake中执行后者或前者?
谢谢
我正在使用Url.Action,因此我可以创建更复杂的HTML链接,因为ActionLink不允许在其中使用HTML.例:
<a class="uiButton" href="@Url.Action("Areas","Organisations","Manage","Create")" title="New Organisation">
<span class="icon organisations-new">New Organisation</span>
</a>
Run Code Online (Sandbox Code Playgroud)
但是URL没有出现在href?有什么想法吗?:/
我目前使用以下内容告诉我的表不使用jquery Tablesorter插件对某些列进行排序:
$(".uiGridContent table").tablesorter({
sortList: [[1, 0]],
headers: {
0: { sorter: false },
5: { sorter: false },
6: { sorter: false }
}
});
Run Code Online (Sandbox Code Playgroud)
问题是在我的应用程序上,用户可以添加和删除列,因此订单可以更改,因此我当前的代码不是一个可行的解决方案.如果我在列上放一个类,我不想排序,例如<col class="nosort" />我怎么能这样做,所以它不排序那些列?
因为我正在使用<col />我尝试了以下内容:
$filter_ignore = $("col.nosort").closest("th").index();
$(".uiGridContent table").tablesorter({
sortList: [[1, 0]],
headers: {
$filter_ignore: {
sorter: false
}
}
});
Run Code Online (Sandbox Code Playgroud)
但是不起作用:/
我想我需要某种循环来找到所有这些带有柱子的柱子!这是我的表的一个例子:
<table>
<colgroup>
<col class="nosort" />
<col />
</colgroup>
<thead>
<tr>
<th scope="col">a</th>
<th scope="col">b</th>
</tr>
</thead>
<tbody>
<tr>
<td scope="col">a</td>
<td scope="col">b</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
谢谢
我有以下示例,当用户单击导航线时,它使用AJAX加载某些内容,并使用jquery history.js https://github.com/browserstate/History.js/插件更新url和title 一些HTML5历史.
ajaxNav: function () {
$('#uiTabs li a, .ajax').live('click', function (e) {
e.preventDefault();
$('<div id="uiLoader"></div>').appendTo('body').hide().fadeIn();
var url = $(this).attr('href');
var bodyid = $(this).data('body');
$.ajax({
url: url,
timeout: 5000,
success: function (responseHtml) {
isAjaxNav = true;
var content = $(responseHtml).find('#ajax-nav-html');
$('.uiContent > .uiPadding').html(content.hide().fadeIn('slow'));
History.pushState(null, $(responseHtml).filter('title').text(), url);
$('body').attr('id', bodyid);
$('#uiLoader').fadeOut(function () { $('#uiLoader').remove() });
},
error: function (jqXHR, textStatus, errorThrown) {
if (textStatus == 'timeout') {
uiModal.errorTimeoutModal(jqXHR, textStatus, errorThrown);
} else if (jqXHR.status == "500") {
uiModal.error500Modal(jqXHR, textStatus, …Run Code Online (Sandbox Code Playgroud) 我在我的网站上构建了一个简单的游览,将使用HTML5动画进行编码.它将使用HTML5音频标签中的声音,并使用jquery加载巡视.
加载巡视后,它将开始播放音频,用户可以通过切换链接来静音.如果他们关闭游览,则重置音频!
我有部分工作,但似乎无法正常切换音乐开关,然后如果他们关闭巡演完全停止.有人可以帮忙吗?
var sound;
$(document).ready(function ()
{
sound = $('#soundTour');
$('.sound a').click(function()
{
$(this).parents('div').toggleClass('mute');
if (sound.paused)
{
sound.play();
}
else
{
sound.pause();
}
});
$('.showTour').click(function()
{
$('body').addClass('theatre'); $('#tour').fadeIn('slow', function() { });
sound.trigger('play');
});
$('#tour').find('.tourClose').click(function()
{
$('body').removeClass('theatre'); $('#tour').fadeOut('slow', function() { });
sound.currentTime=0;
sound.pause();
});
});
Run Code Online (Sandbox Code Playgroud) jquery ×5
php ×3
wordpress ×3
asp.net-mvc ×1
cakephp ×1
function ×1
html5-audio ×1
javascript ×1
razor ×1
redirect ×1
sorting ×1
tablesorter ×1