Wordpress高级自定义字段PDF链接已损坏

时间:2018-01-18 15:35:14

标签: php wordpress hyperlink custom-post-type advanced-custom-fields

我们在Wordpress网站上使用高级自定义字段插件(https://www.advancedcustomfields.com/)为我们的自定义帖子类型(https://codex.wordpress.org/Post_Types)创建字段。帖子类型称为"出版物",并显示我们所有的在线PDF出版物。

我们已将发布的自定义字段设置为:

第1个字段 - 链接类型(PDF,在线等)(只是文本字段) 第二个字段 - 链接到在线版本(链接到媒体库中的PDF) 第3个字段 - 文件上传(上传pdf文件)

当用户查看出版物存档页面并选择出版物时,存档将被编码以打开添加到出版物的PDF链接(第3个字段)

以前一直有效(http://section27.org.za/section-27-publications/)并且仍适用于所有旧帖子(这似乎不是由于捕获)。

虽然添加的任何新出版物以及PDF和链接现在都链接到空帖子。 (查看SPOTLIGHT EDITION#4 - 2017年12月复制在页面底部 - http://section27.org.za/section-27-publications/

请查看输出出版物的出版物模板:

            <section class="pubs">

            <?php
            $args = array (
            'post_type'              => 'publication', // your event post type slug
            'post_status'            => 'publish', // only show published events
            'orderby'                => 'title',
            'order'                  => 'ASC', // Show earlier events first
            'posts_per_page'         => -1,
            );

            $myposts = get_posts( $args );
            foreach ( $myposts as $post ) : setup_postdata( $post ); 
            ?>

            <figure>
            <?php echo get_the_post_thumbnail( $thumbnail->ID, 'publications' ); ?>
            <figcaption><?php the_title(); ?></figcaption>

            <?php if( have_rows('links') ): ?>

            <ul>

            <?php while( have_rows('links') ): the_row(); ?>

            <li><a target="_blank" href="<?php the_sub_field('link_url'); ?><?php
            the_sub_field('upload_pdf'); ?>"><?php the_sub_field('type_of_link'); ?></a></li>               

            <?php endwhile; ?>

            </ul>

            <?php endif; ?>


            </figure>

            <?php 
            endforeach; 
            wp_reset_postdata();
            ?>
            </section>

亲切的问候, 约瑟夫哈特

0 个答案:

没有答案