admin管理员组文章数量:1333187
Im using a function to add a readmmore at the end of excerpts I dont want to link to a single-w.e.php
Because I want to popup the page and the only way ive found to do this is to add the page to the popup with the shorcode api
Now my issue is How Do I Display just that Custom Post type Items Content When clicking the readmore
function new_excerpt_more( $excerpt ) {
return $excerpt. '... <a class="more-link popmake-content-popup" href="'. get_permalink( get_the_ID() ) . '">' . __('READ MORE') . ' </a>';
}
add_filter( 'get_the_excerpt', 'new_excerpt_more' );
<?php
get_header();
?>
<?php
$review = new WP_Query(array('post_type' => 'review', 'posts_per_page'=>'1', 'order_by' => 'post_date', 'order' => 'ASC'));
if($review->have_posts()) : while ($review->have_posts()) : $review->the_post();
?>
<div class="container mg-top-m service-content">
<?php the_content();?>
</div>
<?php endwhile; endif; wp_reset_postdata(); ?>
<?php
get_footer();
?>
So I have a review (I Click readmore) -> Popup shows up -> Shows That reviews full content I know you can fetch a single post using
$mypost = get_post(244);
echo apply_filters('the_content',$mypost->post_content);
something like that but how do I get it to populate the ID dynamically
Clarifying:
I have. Custom post type called - Reviews
I have archive page where i Show all these reviews, Now Because of the design some of these are to long to display all the way So i Shorten them to a excerpt then add a readmore to the end of that with the function new_excerpt_more
Now usually
That Read more would go to Single-review.php But I dont want that I want to display it using a popup
Im using A PLugin called Popup Maker which uses a Block editor to show popups then adding a class to a link activates the popup thus the popmake-content-popup
Class name on my links
But I dont know how to display the content of the Link(Post) the user clicks in that popup
I suspect I would have to pass the ID i get from the Function new_excerpt_more
to the Popup "Page" Then read it there into a Query to get the data and show the content But I dont know how to do that either
本文标签: phpGetting a Post ID to show its content in a Popup
版权声明:本文标题:php - Getting a Post ID to show its content in a Popup 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742275751a2445163.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论