我正在开发像音乐商店这样的项目,我需要像ReverbNation一样实现持久音乐播放器.我检查了ReverbNation,发现他们正在使用ajax加载中心内容,以便玩家始终完好无损.我的项目已经opencart完成,而且几乎已经完成.所以我不想改变很多东西,只为玩家加载ajax的所有东西.我尝试过iframe,但它有效,但问题是地址栏中的url始终保持不变.是否可以更改iframe中加载的内容的地址栏中的网址?或者有没有什么好方法来实现持久音乐播放器?请建议.
我正在使用以下查询来获取post_type'portfolio'的所有帖子.
$args = array(
'posts_per_page' => -1,
'offset'=> 0,
'post_type' => 'portfolio'
);
$all_posts = new WP_Query($args);
Run Code Online (Sandbox Code Playgroud)
在哪里$args:
$args = array(
'posts_per_page' => -1,
'offset'=> 0,
'post_type' => 'portfolio',
'orderby' => 'up_count', //up_count is numeric field from posts table
'order' => DESC
);
Run Code Online (Sandbox Code Playgroud)
这应该按up_count对结果进行排序.但事实并非如此.wp_query的codex没有明确说明使用自定义字段排序(或者可能是我遗漏了什么?).
这是我在调试wp_query请求时得到的查询.
SELECT ap_posts.* FROM ap_posts WHERE 1=1 AND ap_posts.post_type = 'portfolio' AND (ap_posts.post_status = 'publish' OR ap_posts.post_status = 'private') ORDER BY ap_posts.post_date DESC
Run Code Online (Sandbox Code Playgroud)
编辑:up_count是表格posts中int类型的额外字段.
PS我正在使用wordpress …
我最近为 WordPress 安装了动态特色图像插件。但我不知道如何链接图像。我正在尝试创建一个像这样的画廊http://www.subcreative.com.au/#work - 向下滚动到项目,您将看到 。
我已将此代码放入functions.php中
<?php
while ( have_posts() ) : the_post();
if( function_exists('dfi_get_featured_images') ) {
$featuredImages = dfi_get_featured_images();
//Now, loop through the image to display
}
endwhile;
?>
Run Code Online (Sandbox Code Playgroud)
并用它来链接图像。
echo ' <a class="fancybox" href="'. dfi_get_featured_images() .'" style="text-align:center">Take a look</a> '; ?>
Run Code Online (Sandbox Code Playgroud)
但是当我尝试打开图像时,它变成“/array”