Basically, I want to have two columns Wordpress page; one displaying video posts, and the other audio posts.
What's the easier 开发者_StackOverflowway of doing this?
<div class="leftcol">
<?php $args = array( 'post_type' => 'video_post' ); //select only posts of type 'video_post'
$wp_query = new WP_Query($args);
while ( have_posts() ) : the_post(); ?>
<div class="post">
<h3><?php the_title() ?></h3>
<?php the_content() ?>
</div>
<?php endwhile; rewind_posts(); ?>
</div>
<div class="rightcol">
<?php $args = array( 'post_type' => 'audio_post' ); //select only posts of type 'audio_post'
$wp_query = new WP_Query($args);
while ( have_posts() ) : the_post(); ?>
<h2><?php the_title() ?></h2>
<?php endwhile; rewind_posts(); ?>
</div>
I'm assuming you do know the basics of editing a theme, but if not, just say so! Alternatively, you could do the same thing using 'cat' instead of 'post_type' to separate your posts by category instead of two different types. I'd recommend using categories if you don't intend on adding any extra fields to enable your audio/video functionality.
I'm not sure if I understood you well, but I would do it with Widgets using Widget Logic plugin http://wordpress.org/extend/plugins/widget-logic/
If you want to hardcode your template you may need to check the query_posts() and reset_posts() finctions: http://codex.wordpress.org/Function_Reference/query_posts
Do you know how to use WordPress Codex? Do you know how the loop works? If yes you may want to use the second way, if not try to do it with the first option.
Good luck, gezope
精彩评论