So, i got a custom post type applied to different posts and also a page. When i display this page, it shows some content (text), and at the bottom a link to get the list of the products related to this page (thanks to the CPT also applied to the page).
The link is called like this:
echo get_the_term_list( $post->ID, 'prod-cate', 'Products of the cateogry: ', ', ', '.' );
When i hit this link, it displays an archives page with the products but also the page i’m comming from.
The question is, how not to display this page in the archives results?
Call the link with a query argument in which you pass the current post ID.
IfThen, on the archive page exclude that post ID before the loop, using something like:get_the_term_list
returns a url address (the link href) you would need to append a argument to it.Update: I’ve looked up get_the_term_list and it seems to be a wp function that lists html-formatted term links. So you’ll need to append your query argument before the links are built. In your functions.php file add:
and in the template file where the link is added: