早上好,我发现了许多类似的问题,但没有一个答案适合我的问题.关键是非常简单:我有一个带get_posts()的自定义循环,我想排除显示的当前帖子.
代码是:
$args = array(
'posts_per_page' => 3,
'orderby' => 'meta_value',
'order' => 'ASC',
'post_type' => 'fasthomepress_pt',
'post__not_in' => array(get_the_id()),
'meta_query' => array(
array(
'key' => 'custom_richiesta',
'value' => array($custom_boxes['custom_richiesta'][0] - 10000, $custom_boxes['custom_richiesta'][0] + 10000 ),
'type' => 'numeric',
'compare' => 'BETWEEN'
)
)
);
Run Code Online (Sandbox Code Playgroud)
我尝试过:
'post__not_in' => array(get_the_ID),
'post__not_in' => array($post->ID),
'exclude' => $post->ID,
'exclude' => get_the_ID,
Run Code Online (Sandbox Code Playgroud)
以及许多其他有或没有数组的组合.诅咒,当前post id在此循环之前正确回显,如果我尝试echo($ post-> ID)和echo(get_the_ID()),我有相同的,正确的结果.
我真的不知道发生了什么,非常感谢你的帮助,
马尔科
我正在使用window.matchMedia条件,以避免在移动设备中注入视频.这里说自从Safari 9(我正在测试它)之后,matchMedia将顺利运行,但我的代码完全被忽略了:
if ( window.matchMedia("(min-width: 1025px").matches) {
console.log('match');
document.addEventListener("DOMContentLoaded", function() { initialiseMediaPlayer(); }, false);
function initialiseMediaPlayer() {
(stuff here...)
}
}
Run Code Online (Sandbox Code Playgroud)
此代码适用于Chrome,Chromium,Firefox,IE和Edge.
有没有人有类似的问题?