2016-09-14 69 views
0

內VC頁面構建代碼顯示WordPress的頁面外環線我使用WordPress一個外部網站 (與require_once($_SERVER['DOCUMENT_ROOT'] . '/wp-load.php');與內容

我想加載一個特定的頁面,並顯示裏面的內容。

$post = get_post(467, OBJECT); 

$content = $post->post_content; 
$content = apply_filters('wpautop', $content); 
$content = str_replace(']]>', ']]>', $content); 
setup_postdata($post); 

...

<article id="post-<?php the_ID(); ?>"> 
    <div class="entry-content"> 
    <?php echo $content; ?> 
    <?php wp_link_pages(array(
         'before' => '<div class="page-links">' . esc_html__('Pages:', 'tm-polygon'), 
         'after' => '</div>', 
         )); 
    ?> 
    </div> <!-- .entry-content --> 
</article><!-- #post-## --> 

...

的問題是:該網頁內容是通過視覺作曲家頁面構建插件構建和輸出是普通的vc代碼,而不是呈現內容。

像:[vc_row full_width="stretch_row" css=".vc_custom_1472216323117{margin-top: 0px !important;margin-bottom: 50px !important;padding-top: 170px !important;padding-bottom: 165px !important;background-image: url(http://wp.netzexperten.org/wp-content/uploads/2015/09/section14.jpg?id=469) !important;background-position: center !important;background-repeat: no-repeat !important;background-size: cover !important;}"][vc_column][vc_column_text el_class="section-title" css=".vc_custom_1443428582908{margin-top: -25px !important;margin-bottom: 0px !important;}"]

我希望你能幫助我,克里斯

回答

1

請嘗試這個

<?php echo do_shortcode($post->post_content); ?> 

OR

<?php echo do_shortcode(get_post_field('post_content', $yourpostid)); ?> 
+0

THX您的快速反應。但是,這將輸出相同的不渲染的視覺作曲家代碼 – chrisdapos

+0

我通過functions.php創建一個新的短代碼,並將新的短代碼添加到頁面。新的簡碼將被正確渲染。只有vc簡碼保持純文本。 – chrisdapos

0

得到它的工作:

WPBMap::addAllMappedShortcodes(); 
echo apply_filters('the_content', $post->post_content); 

要註冊的VC簡碼以下必須調用:

WPBMap::addAllMappedShortcodes();