我指的是经常出现的“我们的客户”部分,通常是一个客户标识网格,链接到各自的网站/成功案例帖子。网站所有者应该能够轻松地添加或删除这些内容。
现在,我能想到的最好方法是在主题中添加一个自定义图像大小,并将页面作为一个常规页面包含在内容中的所有徽标,如<div id="customers"><a href="http://site.com">Customer</a></div>
.
我在google上想这应该是一个热门话题,但不是真的:P。
我指的是经常出现的“我们的客户”部分,通常是一个客户标识网格,链接到各自的网站/成功案例帖子。网站所有者应该能够轻松地添加或删除这些内容。
现在,我能想到的最好方法是在主题中添加一个自定义图像大小,并将页面作为一个常规页面包含在内容中的所有徽标,如<div id="customers"><a href="http://site.com">Customer</a></div>
.
我在google上想这应该是一个热门话题,但不是真的:P。
链接到各自网站/成功案例帖子的客户徽标网格。网站所有者应该能够轻松地添加或删除这些内容。
我认为最简单的方法是Custom Post Type 称为“客户徽标”。之后,您可以通过多种方式处理内容和图像:
More Precise Control but More Work
Create an image size 将代表每个徽标。无论何时registering your post type 您需要确保它支持thumbnail
这样网站所有者就可以上传一张“特色图片”,这将是客户的徽标。然后可以创建Metabox 以存储您的链接,该链接将存储为Posteta。这将确保用户只能添加标题、图像和链接,并且在创建网格时,可以确保所有内容都是一致的。Easier but Less Control
而不是上述内容registering your post type 您只需获得it支持title, editor
其中,网站所有者只需将图像上传到帖子类型并直接链接即可。这种方法的问题是,它为网站所有者提供了更多的空间,可以打乱您决定使用的任何布局。Finally
您必须创建Post Type Archive 显示您的帖子和一些HTML/CSS以将其放入循环中。希望这能让您更好地了解从哪里开始,做什么,但您必须进行一些编码。您可以将徽标作为图库插入帖子内容,并自行编写图库输出。
add_filter( \'post_gallery\', \'your_gallery_output_function\', 10, 2 );
function your_gallery_output_function( $output, $attr ) {
global $post;
$args = array(
\'post_type\' => \'attachment\',
\'post_status\' => \'inherit\',
\'post_mime_type\' => \'image\',
\'orderby\' => $orderby,
\'post_parent\' => $post->ID,
\'number_of_posts\' => -1
);
// get images
$images = get_posts( $args );
// if no images are found
if ( empty( $images ) )
return;
// add a wrapper around all images
$output = \'<div class="your-gallery-wrapper">\';
// loop through the images
foreach ( $images as $an_image ) {
// .. do something with all the logos here
// and add them to $output...
}
// close wrapper
$output.= \'</div>\';
return $output;
}
我创建了一个插件并使用php文件作为样式表文件PHP样式表文件:<?php header(\'Content-type: text/css; charset: UTF-8\'); $x_position = 0; $y_position = -40px; ?> .blugin_box{ width:140px; height:140px; background:url(\"/mysi