简体   繁体   English

如何将非文本编辑器内容分成多个页面(WordPress)

[英]How to break non text editor content into multiple pages (wordpress)

So the question basically says it all. 所以问题基本上说明了一切。 I have a custom post type made with a verity of custom fields in it (images, wysiwyg. ect) I am trying to break the post up into multiple pages. 我有一个自定义帖子类型,其中包含大量自定义字段(图像,所见即所得等),我试图将帖子分成多个页面。 For example have the text-editor input appear on one page and the image editor input appear on another page. 例如,将文本编辑器输入显示在一页上,将图像编辑器输入显示在另一页上。 I have tried using in a multitude of ways, including inserting a text editor between post types and adding . 我尝试了多种方式使用,包括在帖子类型之间插入文本编辑器并添加。 But none of them have worked and it just displays all the content on one page. 但是它们都不起作用,它仅将所有内容显示在一页上。

So does anyone know how/if its possible to split custom fields data into multiple pages? 那么,有谁知道/如何将自定义字段数据拆分为多个页面?

-Note- Another option I've thought of is just creating different pages for each of the content then hard-linking them. -注意-我想到的另一种选择是为每个内容创建不同的页面,然后对其进行硬链接。 But I don't think it's possible to reference other post data from another post. 但是我认为不可能引用其他帖子中的其他帖子数据。

Here my single-track.php page currently 这是我目前的single-track.php页面

<?php get_header(); ?>

<div class="single-track-storie">
e_title(); ?> </h1>
<?php the_field('content-1'); ?>

</div>
<?php
$img1 = get_field('game_image1');
$img2 = get_field('game_image1');
?>

<img src="<?php echo $img1['url']; ?> " alt="<?php echo $img1['alt']; ?>">
<img src="<?php echo $img2['url']; ?> " alt="<?php echo $img2['alt']; ?>">

<?php wp_footer(); ?>

There are some ways to do this, however none of them are native to WP functions. 有一些方法可以做到这一点,但是它们都不是WP函数所固有的。

1. You can add a Shortcode . 1.您可以添加一个简码

The idea is that you register a shortcode, with what you want to show like [post-image-stuff] and then you add that code to your post content and it will load. 这个想法是,您注册一个要显示的简短代码,例如[post-image-stuff] ,然后将该代码添加到您的帖子内容中,然后将其加载。 To paginate, you use <!––nextpage––> 要分页,请使用<!––nextpage––>

Ex: 例如:

Article content and so on

<!––nextpage––>

[post-image-stuff]

This will be your post content, the negative part is that you need to register the shortcodes, but it's not that hard. 这将是您的帖子内容,缺点是您需要注册短代码,但这并不难。 I confess I've never tried this, but it should work. 我承认我从未尝试过,但是应该可以。

2. Do you really need to paginate? 2.您真的需要分页吗? Why don't you put a section with Tabs to show the other content? 为什么不在带有“标签”的部分中显示其他内容? You can put a gallery, a map and author information inside it without the need to reload the page. 您可以在其中放入图库,地图和作者信息,而无需重新加载页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM