Owl Carousel 中的链接在初始页面加载时不起作用

问题描述

我正在管理一个由合同开发人员创建的站点,该站点不再属于公司。我很难解决这个问题。我的 JQuery 和 CSS 知识非常初级,我已经研究了这个问题一周,但没有任何成功。所以我希望有人可以提供帮助。

每张幻灯片都提供指向另一个页面、外部资源或下载资源的链接。出于某种原因,在初始页面加载链接页面和外部网站不会触发。他们甚至不承认他们是链接。但是,下载资源的链接始终有效。当用户刷新页面时,所有链接都开始正常工作。这发生在 Chrome 和 IE 中,但不在 Firefox 中。但是,Chrome 是我公司的标准浏览器。

如果我需要提供任何其他信息来帮助找到解决方案,请告诉我。提前致谢!

以下是用于测试目的的临时站点https://jllstaging.wpengine.com/

首页 PHP 代码

get_header();

?>

<div id="primary" class="content-area">
    <main id="main" class="site-main">

    <!-- Section Carousel -->
    <?PHP if( have_rows('carousel') ): ?>
        <section class="section-carousel section-collapsed">
            <div class="owl-carousel owl-home-carousel">

                <?PHP while ( have_rows('carousel') ) : the_row(); ?>
                    <div class="item">
                        <div class="section-image carousel-image" style="<?PHP if (!get_sub_field('is_image_featuring_employee')) : ?> background-image: url('<?PHP the_sub_field('carousel_item_image'); ?>');<?PHP endif; ?>">
                            <div class="col-container">
                                <div class="col col-6 mobile">
                                    <?PHP if (get_sub_field('is_image_featuring_employee')) : ?>
                                        <div class="img-profile">
                                            <img src="<?PHP the_sub_field('carousel_item_image'); ?>" alt="Image of JLL employee" />
                                        </div>
                                    <?PHP endif; ?>
                                </div>
                                <div class="col col-6 col-12-sm <?PHP if (get_sub_field('include_black_opacity_background_on_content')) : ?>section-black-trans<?PHP endif; ?>">

                                    <div class="content">
                                        <?PHP if (get_sub_field('is_image_featuring_employee')) : ?>
                                            <div class="img-profile show-sm">
                                                <img src="<?PHP the_sub_field('carousel_item_image'); ?>" alt="Image of JLL employee" />
                                            </div>
                                        <?PHP endif; ?>
                                        <h6 class="text-<?PHP echo get_sub_field('carousel_title_and_link_color'); ?>">
                                            <?PHP the_sub_field('carousel_item_title'); ?>
                                        </h6>
                                        
                                        <div class="text-<?PHP echo get_sub_field('carousel_content_color'); ?>">
                                            <?PHP the_sub_field('carousel_item_content'); ?>
                                        </div>

                                        <?PHP if (get_sub_field('carousel_item_link_text') ) : ?>
                                            <div class="row">
                                                <div class="col-12 row-link text-<?PHP echo get_sub_field('carousel_title_and_link_color'); ?>">
                                                    <?PHP if (get_sub_field('carousel_item_link_file') ) : ?>
                                                        <a href="<?PHP the_sub_field('carousel_item_link_file'); ?>" title="<?PHP the_sub_field('carousel_item_link_text'); ?>" download>
                                                            <i class="far fa-arrow-alt-circle-down"></i>
                                                            <?PHP the_sub_field('carousel_item_link_text'); ?>
                                                        </a>
                                                    
                                                    <?PHP elseif (get_sub_field('carousel_item_link_url') ) : ?>
                                                        <a href="<?PHP the_sub_field('carousel_item_link_url'); ?>" title="<?PHP the_sub_field('carousel_item_link_text'); ?>">
                                                            <?PHP the_sub_field('carousel_item_link_text'); ?>
                                                            <i class="fas fa-long-arrow-alt-right"></i>
                                                        </a>
                                                    <?PHP endif; ?>
                                                </div>
                                            </div>
                                        <?PHP endif; ?>
                                        
                                    </div>
                                    <div class="logo-stamp">
                                        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 57.38 25.56" class="icon-<?PHP echo get_sub_field('carousel_title_and_link_color'); ?> letters-<?PHP echo get_sub_field('carousel_content_color'); ?>"><defs>
                                            <style>.cls-1{fill:#fff;}.cls-1,.cls-2{fill-rule:evenodd;}.cls-2{fill: #e30613;}</style>
                                        </defs><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M34.79,5.11v5.7a1.72,1.72,0-1.12.38c-.39.35-.39.92-.39,2.05v8.21c0,3.46-2,4.49-4.21,4.49-2.62,0-3.71-1.38-4-3.4h.74A2.35,2.35,28,19.3c2.17,2-2.12,2-3.65V8.13c0-1.11,0-1.74-.38-2.07a1.33,1.33,0-.56-.25c-.21,0-.45-.07-.76-.11V5.11Zm7.46,.61a2.45,2.45,0-1.34.34c-.38.33-.38.94-.38,2.07v9.09c0,1,.14,1.51.46,1.72a3.62,3.62,1.86.3,2.87,3-1.83h.75l-1,3H35.77v-.59a1.75,1.75,1.13-.39c.3-.24.34-.7.36-1.43V7.52c0-.75-.06-1.17-.36-1.44a1.65,1.65,0-1.13-.38V5.11Zm10.81,0v.61a2.45,.13,1.72a3.57,3.57,1.85.3,3-1.83h.74l-1,3H46.56v-.59a1.75,0-1.13-.38V5.11Z"/><path class="cls-2" d="M9.53,25.06a7.06,7.06,.88-.5l.17-.11a6,6,.95-.88,10.77,1.06-1.34,12.22,.67-1.17,17.13,1.56-5,20.67,.25-3.31,0-.25-3.31,16.37,0-1.56-5L13,3.92a14.46,14.46,0-1.05,19.39,.93,4.76c0,.54.06,1.11.06,1.65s0,1.11-.06,1.64a18,18,1-1.3,5.78,11.67,1-1.05,2.05,4.92,1-.29.46c-.21.3-.42.59-.65.89a8.69,8.69,1-.88,7.42,1-1,.88l-.09.06v0a5.33,5.33,2-.48Zm4,0a5.87,5.87,.88-.5l.18-.11a9.56,9.56,2.67-3.35,16.85,1.57-5,16,0-1.57-5,9.7,0-2.42-3.16,9.25,0-.92,1.13l.28.4a16.7,16.7,2.64,8.28c0,1.64a16.57,16.57,1-2.64,8.28c-.21.31-.42.6-.65.9a8.69,8.15,1-1.05.88l-.09.06v0A5.61,5.61,13.5,25.06Zm5.05-.63a9.48,9.48,2.68-3.35,17.15,22,0-6.62,16.39,9.26,0-2.68-3.35,5.18,0-3-1.13V0a10,10,2.81,1.64a16.64,16.64,8.29,10.93,1-2.66,2.81v0a5.47,5.47,3.06-1.13ZM13.5.48a5.2,5.2,0-.88.5l-.17.11A8.39,8.39,11.5,2a10.08,10.08,0-1.06,1.34,13.2,0-.67,1.17,0-1.56,5A20.67,8,12.76a20.67,.25,3.31,1.56,5l.29.54a14.46,1-2.45,19.38,1-.93-4.77c0-.53-.06-1.11-.06-1.64s0-1.11.06-1.65a17.92,17.92,1.3-5.77,14.3,1.07-2.05,3.89,.29-.46l.65-.9A8.62,8.62,14.37,6.36,15.42.08L15.51,0V0a5.29,5.29,0-2,.48Zm-4,0a4.53,4.53,0-.88.5l-.18.11A10,5.8,4.44a17.15,0-1.57,5A22.15,22.15,4,12.76a21.89,21.89,1.57,5,9.6,2.43,3.16,11.24,.91-1.13l-.28-.4A16.71,16.71,6.22,14.4c0-.53-.06-1.11-.06-1.64s0-1.11.06-1.65A16.64,8.86,2.83c.21-.31.42-.59.65-.9A8.62,10.39,1a8.3,8.3,1-.85l.1,0V0a5.19,5.19,.48Zm-5,.63A9.48,1.82,4.46a17.15,12.78a21.89,5A9.35,9.35,4.5,24.43a5.69,5.69,3,1.11v0a10.17,10.17,1-2.66-2.81A16.71,2.24,4.88,2.83,7.54,0-3,1.11Zm7.72,23.13a11.32,11.32,.92-1.13l-.29-.4-.28-.46a9.52,9.52,1.34c.21.22.47.44.7.65m2.16.32a5.63,5.63,1-.88.5,2,.48v0a9.7,1-1.11-.94"/><path class="cls-2" d="M11.15,25.52a1.86,1.86,.33,0l-.33-.23a7.81,7.81,1-.74-.65,6.73,5.3,1.3.4.87.87,.32,0m.37,0v0l-.06,0a1.86,1-.33,0A1.36,1.36,11.52,25.54ZM10.83,1.32a10.28,10.28,1.13l.29.4.28.46a9,9,1-1.34,0-.7-.65M8.65,1A4.91,4.91,9.53.5a4.84,4.84,0-2-.5V0A7.07,7.07,8.65,1M13.5.48a4.9,4.9,0-1.3-.4,0-.32,2.09,0-.36,0V0l.05,.33.23a7.81,.74.65A8.34,8.34,13.5.48"/></g></g></svg>
                                    </div>

                                    


                                </div>
                            </div>
                            <?PHP if (get_sub_field('carousel_item_include_power_up_text') ) : ?>
                                <div class="power-up">
                                    Power Up
                                </div>
                            <?PHP endif; ?>
                        </div>
                    </div>
                <?PHP endwhile; ?>
            </div>
        </section>
    <?PHP endif; ?>

    <!-- Section Intro -->
    <section class="section-white">
        <div class="container">
            <div class="row">
                <div class="col-12">
                    <h1>
                        <?PHP the_field('intro_title'); ?>
                    </h1>

                    <?PHP the_field('intro_content'); ?>
                </div>
            </div>
        </div>
    </section>

    <!-- Section New Resources: Automated -->
    <section class="section-white section-new-resources">
        <div class="container">
            <div class="row">
                <div class="col-12 row-link">
                    <h5 class="text-black">
                        New Resources
                    </h5>
                    <a href="/training/resources/" title="Click to view all resources">
                        More <span class="hidden-sm-inline">resources</span>
                        <i class="fas fa-long-arrow-alt-right"></i>
                    </a>
                </div>
                <div class="col-12">
                    <hr class="thin lt-grey" />
                </div>
            </div>
            <div class="row">

                <div class="col-12">
                    <div class="owl-carousel owl-resource-carousel">
                        <?PHP 

                            $args = array( 
                                'posts_per_page' => -1,'post_type' => 'resources','Meta_query' => array(
                                    'relation' => 'AND',array(
                                        'key' => 'status_expiration','value' => date("Y-m-d"),'compare' => '>=','type' => 'DATE'
                                    ),array(
                                        'key' => 'status','value' => 'archive','compare' => '!=','type' => 'char'
                                    )
                                ),'Meta_key' => 'status_expiration','orderby'=>'Meta_value','order' => 'DESC',); 

                            $the_query = new WP_Query( $args ); 

                            // If 3 or less exist,grab latest 5 to retain the carousel structure
                            if ( $the_query->found_posts <= 3) {
                                wp_reset_postdata();

                                $args = array( 
                                    'posts_per_page' => 5,'Meta_query' => array(
                                        'relation' => 'AND',array(
                                            'key' => 'status','type' => 'char'
                                        )
                                    ),); 

                                $the_query = new WP_Query( $args ); 
                            }

                            if ( $the_query->have_posts() ) : 

                                while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
                                    <div class="item">
                                        <div class="row">
                                            <div class="col-12">
                                                <div class="resource-card-container">

                                                    <?PHP 
                                                        $types = get_the_terms( get_the_ID(),'resource_type' );  
                                                        $slug = $types[0]->slug; 
                                                        $isExternal = get_field('opening_functionality') === 'external'; 
                                                        $isVideo = $slug == '1-video';
                                                        $extension = pathinfo(get_field('external_link') ? get_field('external_link') : get_field('file') )['extension'];

                                                        $displayNewTab = $isExternal;
                                                        $displayDatafancybox = strpos($extension,'mp4') !== false && !$isExternal || $isVideo && !$isExternal; // Any MP4 file format and not external
                                                        $displayDownload = !$isVideo && strpos($extension,'mp4') === false;
                                                    ?>

                                                    <?PHP //  if ($displayDatafancybox) { echo 'data-fancybox'; } ?>
                                                    <a href="<?PHP if ($displayDatafancybox) { echo get_permalink(); } elseif (get_field('file')) { the_field('file'); } else { the_field('external_link'); } ?>" title="Click to view <?PHP the_title(); ?>" <?PHP if ($displayNewTab) { echo 'target="_blank"'; } if ($displayDownload) { echo 'download'; } ?>>
                                                        <img src="<?PHP echo get_site_url(); ?>/wp-content/themes/jll-capforce/assets/images/<?PHP echo $slug; ?>.svg" alt="<?PHP $types[0]->name; ?> icon" />
                                                    </a>
                                
                                                    <?PHP if (!$isVideo) : ?>
                                                        <div class="filetype">
                                                            <?PHP echo $extension; ?>
                                                        </div>
                                                    <?PHP endif; ?>

                                                    <div class="tag">
                                                        <?PHP the_field('status'); ?>
                                                    </div>

                                                </div>
                                            </div>
                                            <div class="col-12">
                                                <strong><?PHP the_title(); ?></strong><br/>
                                                <?PHP if ($isVideo) : ?>
                                                    <?PHP the_field('video_length'); ?>-minutes 
                                                <?PHP else : ?>
                                                    <span class="uppercase"><?PHP echo $extension; ?></span>
                                                <?PHP endif; ?>
                                                &nbsp;&nbsp;
                                                <span class="text-grey"><i>
                                                    <?PHP if (get_field('status') == 'new') : ?>
                                                        posted on 
                                                    <?PHP else : ?>
                                                        updated on
                                                    <?PHP endif; ?>
                                                    <?PHP
                                                    echo date('M j,Y',strtotime("-31 days",strtotime(get_field('status_expiration'))))
                                                    ?>
                                                </i></span>
                                            </div>

                                            <div class="col-12 content">
                                                <?PHP the_field('description'); ?>
                                            </div>

                                            <div class="col-12">

                                                <?PHP //  if ($displayDatafancybox) { echo 'data-fancybox'; } ?>
                                                <a href="<?PHP if ($displayDatafancybox) { echo get_permalink(); } elseif (get_field('file')) { the_field('file'); } else { the_field('external_link'); } ?>" title="Click to view <?PHP the_title(); ?>" <?PHP if ($displayNewTab) { echo 'target="_blank"'; } if ($displayDownload) { echo 'download'; } ?>>
                                                    <?PHP if ($displayDatafancybox) : ?>
                                                        Watch video <i class="far fa-play-circle"></i>
                                                    <?PHP elseif ($displayDownload) : ?>
                                                        Download <span class="uppercase"><?PHP echo $extension; ?></span> <i class="far fa-arrow-alt-circle-down"></i>
                                                    <?PHP else : ?>
                                                        Launch video <i class="fas fa-external-link-square-alt"></i>
                                                    <?PHP endif; ?>
                                                
                                                </a>

                                            </div>
                                        </div>

                                    </div>

                                <?PHP endwhile; 

                            endif; ?>

                        <?PHP wp_reset_postdata(); ?>
                    </div>
                </div>

            </div>
        </div>
    </section>

    <!-- Section Callout -->
    <?PHP if( get_field('callout_text') ): ?>
        <section class="section-grey-dark">
            <div class="container">
                <div class="row">
                    <div class="col-12">
                        <h1>
                            <?PHP the_field('callout_text'); ?>
                        </h1>
                    </div>
                </div>
            </div>
        </section>
    <?PHP endif; ?>

    <!-- Featured Topic -->
    <section class="section-tan section-topic" id="featured">
        <div class="container">
            <div class="row">
                <div class="col-12 row-link">
                    <h5 class="text-black">
                        Featured Topic: <strong class="text-red"><?PHP echo get_field('featured_topic')->name; ?></strong>
                    </h5>
                    <a href="/training/resources/" title="Click to view all resources">
                        More <span class="hidden-sm-inline">training</span>
                        <i class="fas fa-long-arrow-alt-right"></i>
                    </a>
                </div>
                <div class="col-12">
                    <hr class="thin lt-grey" />
                </div>
                <?PHP
                $post_object = get_field('featured_topic_main_resource');
                if( $post_object ): 

                    $post = $post_object;
                    setup_postdata( $post ); 
                    ?>

                    <div class="col-6">
                        <?PHP 
                            $types = get_the_terms( get_the_ID(),'resource_type' );  
                            $slug = $types[0]->slug; 
                            $isExternal = get_field('opening_functionality') === 'external'; 
                            $isVideo = $slug == '1-video';
                            $extension = pathinfo(get_field('external_link') ? get_field('external_link') : get_field('file') )['extension'];

                            $displayNewTab = $isExternal;
                            $displayDatafancybox = strpos($extension,'mp4') !== false && !$isExternal || $isVideo && !$isExternal; // Any MP4 file format and not external
                            $displayDownload = !$isVideo && strpos($extension,'mp4') === false;
                        ?>

                        <?PHP //  if ($displayDatafancybox) { echo 'data-fancybox'; } ?>
                        <a class="resource-card-container" href="<?PHP if ($displayDatafancybox) { echo get_permalink(); } elseif (get_field('file')) { the_field('file'); } else { the_field('external_link'); } ?>" title="Click to view <?PHP the_title(); ?>" <?PHP if ($displayNewTab) { echo 'target="_blank"'; } if ($displayDownload) { echo 'download'; } ?>>
                            <img src="<?PHP echo get_site_url(); ?>/wp-content/themes/jll-capforce/assets/images/<?PHP echo $slug; ?>.svg" alt="<?PHP $types[0]->name; ?> icon" />
                            
                            <?PHP if (!$isVideo) : ?>
                                <div class="filetype">
                                    <?PHP echo $extension; ?>
                                </div>
                            <?PHP endif; ?>
                        </a>
                    </div>

                    <div class="col-6 content">
                        <h3 class="text-black"><?PHP the_title(); ?></h3>
                        <?PHP the_field('description'); ?>

                        <br/>

                        <?PHP //  if ($displayDatafancybox) { echo 'data-fancybox'; } ?>
                        <a href="<?PHP if ($displayDatafancybox) { echo get_permalink(); } elseif (get_field('file')) { the_field('file'); } else { the_field('external_link'); } ?>" title="Click to view <?PHP the_title(); ?>" <?PHP if ($displayNewTab) { echo 'target="_blank"'; } if ($displayDownload) { echo 'download'; } ?>>
                            <?PHP if ($displayDatafancybox) : ?>
                                Watch video <i class="far fa-play-circle"></i>
                            <?PHP elseif ($displayDownload) : ?>
                                Download <span class="uppercase"><?PHP echo $extension; ?></span> <i class="far fa-arrow-alt-circle-down"></i>
                            <?PHP else : ?>
                                Launch video <i class="fas fa-external-link-square-alt"></i>
                            <?PHP endif; ?>
                        </a>

                    </div>

                <?PHP wp_reset_postdata(); ?>
                <?PHP endif; ?>

                
                
            </div>
        </div>
    </section>

    <!-- Related Resources for Topic -->
    <section class="section-white section-featuredtopic">
        <div class="container">
            <div class="row">
                <div class="col-12">
                    <h2><span>
                        Related resources
                    </span></h2>
                </div>
            </div>
            <div class="row">
                <?PHP if( have_rows('featured_topic_related_resources') ): ?>
                    <?PHP while ( have_rows('featured_topic_related_resources') ) : the_row(); ?>
                        <?PHP
                        $post_object = get_sub_field('ft_related');
                        if( $post_object ): 

                            $post = $post_object;
                            setup_postdata( $post ); 
                            ?>

                            <div class="col-6">
                                <div class="row">
                                    <div class="col-5">
                                        <?PHP 
                                            $types = get_the_terms( get_the_ID(),'resource_type' );  
                                            $slug = $types[0]->slug; 
                                            $isExternal = get_field('opening_functionality') === 'external'; 
                                            $isVideo = $slug == '1-video';
                                            $extension = pathinfo(get_field('external_link') ? get_field('external_link') : get_field('file') )['extension'];

                                            $displayNewTab = $isExternal;
                                            $displayDatafancybox = strpos($extension,'mp4') !== false && !$isExternal || $isVideo && !$isExternal; // Any MP4 file format and not external
                                            $displayDownload = !$isVideo && strpos($extension,'mp4') === false;
                                        ?>

                                        <?PHP //  if ($displayDatafancybox) { echo 'data-fancybox'; } ?>
                                        <a class="resource-card-container" href="<?PHP if ($displayDatafancybox) { echo get_permalink(); } elseif (get_field('file')) { the_field('file'); } else { the_field('external_link'); } ?>" title="Click to view <?PHP the_title(); ?>" <?PHP if ($displayNewTab) { echo 'target="_blank"'; } if ($displayDownload) { echo 'download'; } ?>>
                                            <img src="<?PHP echo get_site_url(); ?>/wp-content/themes/jll-capforce/assets/images/<?PHP echo $slug; ?>.svg" alt="<?PHP $types[0]->name; ?> icon" />
                                            
                                            <?PHP if (!$isVideo) : ?>
                                                <div class="filetype">
                                                    <?PHP echo $extension; ?>
                                                </div>
                                            <?PHP endif; ?>
                                            
                                            <?PHP if ($displayDatafancybox) : ?>
                                                <i class="far fa-play-circle"></i>
                                            <?PHP elseif ($displayDownload) : ?>
                                                <i class="far fa-arrow-alt-circle-down"></i>
                                            <?PHP else : ?>
                                                <i class="fas fa-external-link-square-alt"></i>
                                            <?PHP endif; ?>
                                        </a>
                                            
                                    </div>
                                    <div class="col-7">
                                        <strong><?PHP the_title(); ?></strong><br/><?PHP the_field('description',false,false); ?>
                                    </div>
                                </div>
                            </div>

                            <?PHP if ($counter % 2 === 1 ) { ?>
                                </div>
                                <div class="row">
                            <?PHP } ?>

                            <?PHP $counter++; ?>

                        <?PHP wp_reset_postdata(); ?>
                        <?PHP endif; ?>
                            
                    <?PHP endwhile; ?>
                <?PHP endif; ?>
                
            </div>
        </div>
    </div>

    <hr/>

    <!-- Section Tip of the Week -->
    <section class="section-white">
        <div class="container">
            <div class="row">
                <div class="col-12">
                    <h2><span>
                        Tip of the week
                    </span></h2>
                    <?PHP if( have_rows('tips') ): ?>
                        <?PHP 
                            $count = count(get_field('tips')); 
                            $index = mt_rand(1,$count); // inclusive
                        ?>
                        <?PHP while ( have_rows('tips') ) : the_row(); ?>
                            <?PHP if (get_row_index() ==  $index): ?>
                                <br/>
                                <h4 class="text-black">
                                    <?PHP the_sub_field('tips_content'); ?>
                                </h4>

                                <div class="row">
                                    <div class="col-12 row-link">
                                        <a href="<?PHP the_sub_field('tips_link_url'); ?>" title="<?PHP the_sub_field('tips_link_text'); ?>" target="_blank">
                                            <?PHP the_sub_field('tips_link_text'); ?>
                                            <i class="fas fa-long-arrow-alt-right"></i>
                                        </a>
                                    </div>
                                </div>
                            <?PHP endif; ?>
                        <?PHP endwhile; ?>
                    <?PHP endif; ?>
                </div>
            </div>
        </div>
    </section>

    <!-- Section FAQs - Mobile -->
    <section class="section-tan show-sm">
        <div class="content">
            <div class="row">
                <div class="col-12">
                    <h2><span>FAQ</span></h2>

                    <?PHP if( have_rows('faq_featured') ): ?>
                        <?PHP 
                            $countFaq = count(get_field('faq_featured')); 
                            $indexFaq = mt_rand(1,$countFaq); // inclusive
                        ?>
                        <?PHP while ( have_rows('faq_featured') ) : the_row(); ?>
                            <?PHP if (get_row_index() ==  $indexFaq): ?>
                                <?PHP
                                $post_object = get_sub_field('faq_feature');
                                if( $post_object ): 

                                    $post = $post_object;
                                    setup_postdata( $post ); 
                                    ?>

                                    <h4>
                                        <?PHP the_title(); ?>
                                    </h4>
                                    <p>
                                        <?PHP the_content(); ?>
                                    </p>

                                <?PHP wp_reset_postdata(); ?>
                                <?PHP endif; ?>
                                
                            <?PHP endif; ?>
                        <?PHP endwhile; ?>
                    <?PHP endif; ?>

                </div>
                <?PHP if (get_field('faqs_featured_section_link_text') ) : ?>
                    <div class="row">
                        <div class="col-12 row-link">
                            <a href="<?PHP the_field('faqs_featured_section_link_url'); ?>" title="<?PHP the_field('faqs_featured_section_link_text'); ?>">
                                <?PHP the_field('faqs_featured_section_link_text'); ?>
                                <i class="fas fa-long-arrow-alt-right"></i>
                            </a>
                        </div>
                    </div>
                <?PHP endif; ?>
            </div>
        </div>
    </section>

    <!-- Section FAQ and System Updates -->
    <section class="section-grey-lighter section-collapsed section-alerts">
        <div class="container">
            <div class="col-container">
                <div class="col col-8 section-tan hidden-sm">
                    <div class="content">
                        <h2><span>FAQ</span></h2>

                        <?PHP if( have_rows('faq_featured') ): ?>
                            <?PHP 
                                $countFaq = count(get_field('faq_featured')); 
                                $indexFaq = mt_rand(1,$countFaq); // inclusive
                            ?>
                            <?PHP while ( have_rows('faq_featured') ) : the_row(); ?>
                                <?PHP if (get_row_index() ==  $indexFaq): ?>
                                    <?PHP
                                    $post_object = get_sub_field('faq_feature');
                                    if( $post_object ): 

                                        $post = $post_object;
                                        setup_postdata( $post ); 
                                        ?>

                                        <h4>
                                            <?PHP the_title(); ?>
                                        </h4>
                                        <p>
                                            <?PHP the_content(); ?>
                                        </p>

                                    <?PHP wp_reset_postdata(); ?>
                                    <?PHP endif; ?>
                                    
                                <?PHP endif; ?>
                            <?PHP endwhile; ?>
                        <?PHP endif; ?>
                        <?PHP if (get_field('faqs_featured_section_link_text') ) : ?>
                            <div class="row">
                                <div class="col-12 row-link">
                                    <a href="<?PHP the_field('faqs_featured_section_link_url'); ?>" title="<?PHP the_field('faqs_featured_section_link_text'); ?>">
                                        <?PHP the_field('faqs_featured_section_link_text'); ?>
                                        <i class="fas fa-long-arrow-alt-right"></i>
                                    </a>
                                </div>
                            </div>
                        <?PHP endif; ?>
                    </div>
                </div>
                <div class="col col-4 col-12-sm">
                    <div class="content content-right">
                        <h2 class="text-red"><span>
                            Capforce system updates
                        </span></h2>

                        <?PHP 

                        $args = array( 
                            'posts_per_page' => 2,'post_type' => 'system_updates','orderby'=>'publish_date',); 

                        $the_query = new WP_Query( $args ); 

                        if ( $the_query->have_posts() ) : 
                            while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

                                <div class="row">
                                    <div class="col-2 col-2-sm">
                                        <strong><?PHP the_time('n/j'); ?></strong>
                                    </div>
                                    <div class="col-10 col-10-sm">
                                        <?PHP the_field('alert_excerpt'); ?>
                                    </div>
                                </div>

                            <?PHP endwhile; 

                        endif; ?>

                        <?PHP wp_reset_postdata(); ?>

                        <br/>
                        <div class="row">
                            <div class="col-12 row-link">
                                <a href="/support/system-updates/" title="Click to view all system updates">
                                    See all updates
                                    <i class="fas fa-long-arrow-alt-right"></i>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    </main><!-- #main -->
</div><!-- #primary -->

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)