如何将css样式的html列表添加到wordpress,可在仪表板中管理


How to add a css styled html-list to wordpress, manageable in the dashboard

我想在WordPress页面上添加一个功能,以显示一个简短的人员列表,就像这里看到的那样-http://www.blenderbox.com/company/team

我已经在其他网站上用css样式列表做到了这一点。然而,这一次是为客户准备的,我不相信他们会复制和粘贴<li>,编辑姓名、职称和img名称而不会弄乱它。

创建它的最佳方法是什么,以便在WordPress面板中轻松减少/添加它?基本上,用户只需单击"添加人员",然后在更新页面之前填写一些字段。

我是WordPress的新手(尽管我了解它是如何工作的),但我擅长编码,所以希望向正确的方向提供信息就足够了。

谢谢,本。

使用类别。创建一个名为"个人"或"团队"之类的新类别。然后使用帖子标题作为他们的姓名-任何其他信息都可以放在帖子中,然后将图像添加到特色图像中。

通过复制另一个模板文件并给它一个这样的标题来命名,为这个页面创建一个新模板。

<?
/*
Template Name: About Us / Team / Whatever
*/
?>

在页面中,只调用您想要的信息,如下所示:

//Set up the Loop
<?php 
    global $post;
    $args = array (
    'category' => 4,
    'order' => 'ASC');  
        $teamposts = get_posts( $args );
        foreach( $teamposts as $post ) :    setup_postdata($post); ?>

//Call the information you want - put them in <li> if you need
<?php the_title();?>
    <?php the_excerpt();?> //OR the_content
<?php the_post_thumbnail('new-image-size');?>
//Close the loop
<?php endforeach; ?>

然后,您可以继续调用任何其他需要的信息,或者在同一页面上运行另一个循环来调用其他信息。

要获得正确大小的缩略图,您称之为"新图像大小"-要设置它,请在functions.php文件中添加一行类似的内容。

// Post Thumbnails
    add_theme_support( 'post-thumbnails' );
    // name of the thumbnail, width, height, crop mode
    add_image_size( 'front-page-services',  450, 270, true );