【问题标题】:How to add a css styled html-list to wordpress, manageable in the dashboard如何将 css 样式的 html 列表添加到 wordpress,可在仪表板中进行管理
【发布时间】:2012-07-30 23:03:25
【问题描述】:

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

我已经在其他网站上通过使用 css 设置列表样式来完成此操作。不过这次是给客户的,我不能相信他们会复制和粘贴<li>,编辑姓名、职位和img 名称而不会搞砸。

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

我是 WordPress 新手(尽管我了解它的工作原理),但我擅长编码,因此希望在正确方向上提供信息性的推动就足够了。

谢谢,本。

【问题讨论】:

  • 如果这不是编码问题,则应该转而使用 Wordpress Stack Exchange,wordpress.stackexchange.com
  • 这个问题似乎是题外话,因为它是关于使用 Wordpress。

标签: php css wordpress html-lists


【解决方案1】:

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

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

<?
/*
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; ?>

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

要获得正确大小的缩略图,您已调用“new-image-size” - 要进行设置,请在您的 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 );

【讨论】:

    猜你喜欢
    • 2016-07-27
    • 1970-01-01
    • 1970-01-01
    • 2015-01-11
    • 2017-01-29
    • 1970-01-01
    • 2013-09-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多