php - Getting a Post ID to show its content in a Popup

Im using a function to add a readmmore at the end of excerpts I dont want to link to a single-w.e.phpBecause I want to

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742275751a4413556.html

相关推荐

  • php - Getting a Post ID to show its content in a Popup

    Im using a function to add a readmmore at the end of excerpts I dont want to link to a single-w.e.phpBecause I want to

    1天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信