Wordpress页面中带有用户图像的预格式化内容
我正在为我的公司建立一个Wordpress主题 在主页上,布局以图形化的复杂块为特征,包含一个图像和一个文本。这是块的两个可编辑内容,其余部分由设计固定。该网站的编辑无法编写HTML,因此我必须为他们提供简单的选项 我应该使用什么让编辑器能够通过选择图像和输入文本来添加这样的块?他们应该从这两条数据构建块 理想情况下,我希望编辑器可以单击添加位置块位置是内容类型,然后提示输入文本,然后可以通过Worpress图像对话框选择图像 我一直在研究自定义帖子类型,但它似乎并没有解决我的问题,因为我只想在页面中显示一些特定的内容Wordpress页面中带有用户图像的预格式化内容,wordpress,custom-post-type,Wordpress,Custom Post Type,我正在为我的公司建立一个Wordpress主题 在主页上,布局以图形化的复杂块为特征,包含一个图像和一个文本。这是块的两个可编辑内容,其余部分由设计固定。该网站的编辑无法编写HTML,因此我必须为他们提供简单的选项 我应该使用什么让编辑器能够通过选择图像和输入文本来添加这样的块?他们应该从这两条数据构建块 理想情况下,我希望编辑器可以单击添加位置块位置是内容类型,然后提示输入文本,然后可以通过Worpress图像对话框选择图像 我一直在研究自定义帖子类型,但它似乎并没有解决我的问题,因为我只想在
谢谢你们 好的,所以我用了一种我没有想到的自定义帖子类型 我注册了一个新类型的帖子,然后在一个定制的循环中列出它们,这要感谢专用模板中的WP查询。我不知道你可以在其他帖子页面中使用自定义帖子类型,也可以在模板中使用 是这样的: functions.php持有post类型注册:
function place_post_type() {
$labels = array(
'name' => _x( 'Places', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Place', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Places', 'text_domain' ),
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
'all_items' => __( 'All Places', 'text_domain' ),
'view_item' => __( 'See Place', 'text_domain' ),
'add_new_item' => __( 'Add New Place', 'text_domain' ),
'add_new' => __( 'Add New', 'text_domain' ),
'edit_item' => __( 'Edit Place', 'text_domain' ),
'update_item' => __( 'Update Place', 'text_domain' ),
'search_items' => __( 'Search Places', 'text_domain' ),
'not_found' => __( 'Not found', 'text_domain' ),
'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
);
$args = array(
'label' => __( 'place_type', 'text_domain' ),
'description' => __( 'Places', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'excerpt', 'thumbnail'),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'menu_icon' => '',
'can_export' => false,
'has_archive' => false,
'exclude_from_search' => true,
'publicly_queryable' => true,
'rewrite' => false,
'capability_type' => 'page',
);
register_post_type( 'place_key', $args );
}
add_action( 'init', 'place_post_type', 0 );
然后在模板中很容易使用它:
<?php query_posts('posts_per_page=-1&post_type=place_type'); ?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="place">
<p class="place_image"><?php the_post_thumbnail(); ?></p>
<p class="place_desc">
<span class="place_title"><?php echo get_the_title(); ?><br /></span>
<span class="place_excerpt"><?php echo nl2br(get_the_excerpt()); ?></span>
</p>
</div>
<?php endwhile; ?>
我唯一没有弄清楚的两件事是如何:
在自定义帖子类型中设置自定义字段和必填字段您可以使用标准字段,也可以接受自定义字段,但不能定义创建此类型帖子时所需的必填字段。
如何使标签与语言相关。