- This topic has 4 replies, 2 voices, and was last updated 6 years, 4 months ago by
Tom.
-
AuthorPosts
-
December 9, 2019 at 12:34 pm #1099121
Jean-Pol
On a specific page that lists a series of posts from a request (title + thumbnail + excerpt), I want to add as a GET parameter at the end of the URL to the full article (a string with the list of article IDs present on the page).
At the end of get_the_permalink I can add my settings.On the other hand, get_the_excerpt automatically generates the “More” button, and there, I do not see how to add my parameter behind the permalink …
I tried to add a filter found on the codex, but it does not change anything …
I need your help here …
December 9, 2019 at 7:57 pm #1099392Tom
Lead DeveloperLead DeveloperHi there,
I’m not sure I fully understand. Can you explain a bit more?
Are you wanting to edit the read more link only when the GET parameter is present? Would you be removing it or only tweaking it?
Let me know 🙂
December 10, 2019 at 12:51 am #1099532Jean-Pol
Here is my current code, very cleaned. I use the Search & Filter Pro plugin, and I try to modify the display results template.
On a page, I have in a column my search form and on the right the result of the query created by selecting checkboxes in the search form.
When my request selects for example 3 posts, I wish, by clicking on the title or more button to open the complete post on a page, with in a column a list containing the 3 titles of the posts of my selection. This allows to navigate in the result of my selection …
I was wondering how to move the list of posts from my selection from one page to another … I imagined by a variable GET, but there is perhaps a better solution, simpler, or more elegant …<?php /** * Search & Filter Pro template */ // GET ALL THE IDS OF THE SEARCH RESULT if ($query->max_num_pages == 1) { $idsurl = '?ids='; while ($query->have_posts()) { $query->the_post(); $idsurl .= get_the_ID() . ','; } $idsurl = rtrim($idsurl, ','); } // DISPLAY THE SEARCH RESULT AND PASS ALL THE IDS TO THE SINGLE POST PAGE IN GET URL ATTRIBUTE if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); ?> <div> <h2><a href="<?php the_permalink(); // ADD HERE THE IDS IN THE URL echo $idsurl; ?>"><?php the_title();?></a></h2> <p><?php the_excerpt(); // HOW ADD THE IDS IN THE MORE BUTTON URL ???? ?> </p> </div> <?php } ?>December 10, 2019 at 2:03 pm #1100341Jean-Pol
I found a solution using $_SESSION (and the WP session manager plugin), instead of $_GET.
December 10, 2019 at 5:28 pm #1100438Tom
Lead DeveloperLead DeveloperAwesome! Glad you got something working 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.