文章内引用信息

更新 2020年5月1日 发布 2019年8月15日  WP & Websites
                $reference_all = rwmb_meta( 'reference-all' );
                $reference_part = rwmb_meta( 'reference-part' );
                
                if ( !empty($reference_all[0]['title']) ||  !empty($reference_all[0]['author']) || !empty($reference_all[0]['source']) ){
                    echo '<div class="reference"><h2>原文</h2>';
                    foreach($reference_all as $reference_a) {
                        echo '<div class="source">';
                        if( !empty($reference_a['title']) ){
                            echo '<p>标题:' . $reference_a['title'];
                        }
                        if ( !empty($reference_a['author']) ){
                           echo '<p>作者:' . $reference_a['author'];
                        }
                        if ( !empty($reference_a['source']) ){
                           echo '<p>地址:' . $reference_a['source'];
                        }
                        echo '</div>';
                    }
                    echo '</div>';
                }
                    
                if ( !empty($reference_part[0]['title']) ||  !empty($reference_part[0]['author']) || !empty($reference_part[0]['source']) ){
                    echo '<div class="reference"><h2>参考</h2>';
                    foreach($reference_part as $reference_p) {
                        echo '<div class="source">';
                        if( !empty($reference_p['title']) ){
                            echo '<p>标题:' . $reference_p['title'];
                        }
                        if ( !empty($reference_p['author']) ){
                           echo '<p>作者:' . $reference_p['author'];
                        }
                        if ( !empty($reference_p['source']) ){
                           echo '<p>地址:' . $reference_p['source'];
                        }
                        echo '</div>';
                    }
                    echo '</div>';
                }