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' );

     $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();?>

<?php endwhile; endif; wp_reset_postdata(); ?>

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


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

  • is this what you're looking for? developer.wordpress.org/reference/functions/get_the_id – mozboz Jul 10 at 11:32
  • I have tried that SO essentially IM using a plugin called popup maker Which uses a block editor to display popups now I have a Post type called reviews, Im displaying all reviews I have the above script to open that Review threw a readmore BUt now instead of goinge to Sinngle-review.php I want to show the popup and then I cant add php to the block editor of the Popup maker to get the current ID and then display the content so im trying to figure out how to display that content threw a Toolset view/ Or another page by using Page insert – Someguy Jul 10 at 11:40
  • That was a lot of information. I don't fully understand, but maybe it's worth adding it to your questions if it's important context – mozboz Jul 10 at 11:43
  • updated my qeustion maybe thats better – Someguy Jul 10 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.