WordPress Post拇指后退

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了WordPress Post拇指后退相关的知识,希望对你有一定的参考价值。

If post thumbnail doesn't exist, then get the first uploaded image. Change sizes as needed.
  1. //add support in functions file
  2. add_theme_support( 'post-thumbnails');
  3. add_image_size( 'home-feature', 590, 265, true ); // Homepage Feature Image
  4.  
  5. //function to call first uploaded image in functions file
  6. function main_image() {
  7. $files = get_children('post_parent='.get_the_ID().'&post_type=attachment&post_mime_type=image&order=desc');
  8. if($files) :
  9. $keys = array_reverse(array_keys($files));
  10. $j=0;
  11. $num = $keys[$j];
  12. $image=wp_get_attachment_image($num, 'large', true);
  13. $imagepieces = explode('"', $image);
  14. $imagepath = $imagepieces[1];
  15. $main=wp_get_attachment_url($num);
  16. $template=get_template_directory();
  17. $the_title=get_the_title();
  18. print "<img src='$main' alt='$the_title' class='frame' />";
  19. endif;
  20. }
  21.  
  22. //goes in template to call image
  23. <?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) {
  24. echo get_the_post_thumbnail($post->ID,array(590, 265));
  25. } else {
  26. echo main_image();
  27. } ?>

以上是关于WordPress Post拇指后退的主要内容,如果未能解决你的问题,请参考以下文章

Wordpress拇指

滚动时在另一个片段视频视图中重叠一个片段的视频拇指

PHP WordPress相关帖子带拇指

ActionBar的后退主页按钮无法使用片段

Wordpress查询从文章/页面中提取片段

如何禁用在android片段类中按下的后退按钮