我需要在wordpress上显示最新帖子
<div class="your-tab">
<p class="min-title">The title of video here</p>
</a>
<a href="#">
<img src="images/images4.jpg" alt="" />
<p class="min-title">The title of video here</p>
</a>
<a href="#">
<img src="images/images4.jpg" alt="" />
<p class="min-title">The title of video hereا</p>
</a>
<a href="#">
<img src="images/images4.jpg" alt="" />
<p class="min-title">The title of video here</p>
</a>
<a href="#">
<img src="images/images4.jpg" alt="" />
<p class="min-title">The title of video here</p>
</a>
</div>
请将“images / images4.jpg”更改为拇指和“视频标题”以发布标题请帮助
答案 0 :(得分:1)
您可以这样做以显示Wordpress上的最新帖子:
https://codex.wordpress.org/Function_Reference/wp_get_recent_posts
它应该是:
<p class="min-title">The title of video here</p>
<a href="#"><img src="images/images4.jpg" alt="" /></a>
或者在p标签周围......无论你想要链接在哪里。
答案 1 :(得分:0)
有几种方法可以做到这一点;这是一个; 如果您告诉我们您尝试执行此操作的位置以及视频的jQuery滑块,它还可以提供帮助吗?
<?php query_posts('cat=-20'); ?>
<li>
<h2>Recent Posts</h2>
<ul>
<?php while (have_posts()) : the_post(); ?>
<li><a href='<?php the_permalink() ?>'><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
</li>
看看这个以获取缩略图: get_the_post_thumbnail
$posts = get_posts( array( 'posts_per_page' => 5 ) );
foreach ( $posts as $_post ) {
if ( has_post_thumbnail( $_post->ID ) ) {
echo '<a href="' . get_permalink( $_post->ID ) . '" title="' . esc_attr( $_post->post_title ) . '">';
echo get_the_post_thumbnail( $_post->ID, 'thumbnail' );
echo '</a>';
}
}
Read More about post thumbnail
https://codex.wordpress.org/Function_Reference/the_post_thumbnail