ACF(SCF)

用ACF(已改名为scf)添加内容类型后,我们可以自定义一个列表页list

视频:https://www.bilibili.com/video/BV142421P7Wc/

demo: https://sc.chinaz.com/moban/240308078900.htm

首先我们通过模板分层概念,知道列表页用到的是哪个模板?

----------

ACF:  https://wordpress.org/plugins/advanced-custom-fields/ 

SCF: https://wordpress.org/plugins/secure-custom-fields/

acf和scf是什么关系? 其实以前是acf(由WP Engine出品),然后2024年wp官方和acf官网闹矛盾,把acf收为已用改为scf,过段时间可能和好了,acf又恢复了。但scf也继续保留。到底用哪个,看你自己选了。

-------

视频里用到下面的代码:

<?php
 
while ( have_posts() ) :
    the_post();
   // pre($post);
  
    $title = $post->post_title;
 
    
   $despjj =  get_nodedespjj($post->post_excerpt,$post->post_content,'',$cus_substrnum);

    if ( has_post_thumbnail() ) {
   
     $image = get_the_post_thumbnail( $post->ID, 'medium', array(
        // 'title' => $title,
         'alt'   => $title,
       ) ) ;
     }
     else $image = DEFAULTIMGDIV;

       ?>

             <li class="hasimg <?php echo $cus_columnsv;?>">
             <a class="img" href="<?php the_permalink(); ?>"> <?php echo $image;?> </a>
             <div class="text">
             <a href="<?php the_permalink(); ?>" class="title"><?php the_title(); ?></a>
             <div class="desp"> <?php echo $despjj; ?></div></div>
            </li>
        

    <?php
  

endwhile;

?>

---------

一定要看到最后了,这里有教程里讲到的代码: https://codecopy.cn/post/bmeeoi

==============

分页代码在这里>