Make CPT archive editable and integrate Thrive Architect

时间:2019-04-17 02:32:11

标签: php css wordpress custom-post-type

Just bumped into this issue regarding CPT Archive pages, is there a way to make it like a page/post that you can edit and add content on it?

Currently my method is to make an ordinary page and layout the page with thrive architect then save

Then on the CPT archive page, i just add in a query to pull the contents of that page I just created

$the_query = new WP_Query( 'page_id=9755' );
while ( $the_query->have_posts() ) :
$the_query->the_post();
the_content();
endwhile;
wp_reset_postdata();

NOW THE CONTENT SHOWS ON MY CPT ARCHIVE, the problem now is that the styling is different, I think its related to the thrive architects ID usage which is not present in the CTP archive

enter image description here

so meaning I got the content working but the layout is not working

the

<style class="tve_custom_style"></style> 

is different on both, so how do I get the stylesheet on that page to my CPT archive page

1 个答案:

答案 0 :(得分:0)

我刚刚解决了自己的问题,这是我的解决方法

我在CPT存档中执行此操作

$the_query = new WP_Query( 'page_id=9755' );
while ( $the_query->have_posts() ) :
$the_query->the_post();
the_content();
endwhile;
wp_reset_postdata();

从原始页面到我的CPT存档,css布局没有遵循

解决方案是

<?php 
$custom_css = trim( tve_get_post_meta( 9755, 'tve_custom_css', true ) . tve_get_post_meta( 9755, 'tve_user_custom_css', true ) );
echo '<style>';
echo $custom_css;
echo '</style>';
?>

以便tve_get_post_meta()将样式表从该页面拖到我的CPT存档中

一切都很好...