Skip Navigation

[Resolved] Set pagination anchor text to be post/term title

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by davidS-53 2 years, 4 months ago.

Assigned support staff: Waqar.

Author
Posts
#1272203

As above.

Is it possible to set the "anchor_text" attribute of [wpv-pager-nav-links] to the post/term title?

I've tried setting it up like this: [wpv-pager-nav-links output="bootstrap" anchor_text="[wpv-taxonomy-title]"]

But then all 4 pager links are the taxonomy-title of the current slide- see hidden link

Is this possible to achieve? I couldn't find anything relevant in the docs.

#1272317

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi David,

Thank you for waiting, while I performed some tests.

I'm afraid, the "wpv-pager-nav-links" shortcode ( ref: https://toolset.com/documentation/user-guides/views-shortcodes/#vf-344030 ) doesn't support inclusion of post/term titles for the pagination links, but you're welcome to submit a feature request for this at:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

As a workaround, you can use a duplicate of your existing view, to generate the pagination links with the term titles, manually.

1. Please create a duplicate of your existing taxonomy view and in the duplicate, add the following changes:

- Select "No pagination" in "Pagination and Sliders Settings".

- Remove any extra HTML from the view's "Loop Editor" section, inside the "wpv-loop" tag, so that it is only loading the content template:

Example:


<wpv-loop>
[wpv-post-body view_template="loop-item-in-DUPLICATED-VIEW"]
</wpv-loop>

Note: "DUPLICATED-VIEW" will need to be replaced with the actual slug of your website's duplicate view.

- The content template can use the following code to generate the individual pagination link with the title:


<li class="wpv-pagination-nav-links-item js-wpv-pagination-nav-links-item page-item wpv-page-link js-wpv-page-link">
<a class="wpv-filter-pagination-link js-wpv-pagination-link page-link" title="[wpv-loop-index]" href="URL-OF-PAGE-WHERE-THE-VIEW-IS-BEING-USED/?wpv_view_count=12345&wpv_paged=[wpv-loop-index]" data-viewnumber="12345" data-page="[wpv-loop-index]">[wpv-taxonomy-title]</a>
</li>

Note: Please replace "URL-OF-PAGE-WHERE-THE-VIEW-IS-BEING-USED" with the actual URL and both instances of "12345" with the ID of the actual/original taxonomy view.

- Remove the shortcode "[wpv-filter-meta-html]" from this "Output Editor" section and also check the option "Disable the wrapping DIV around the View", right above it.

2. Next, get back to the actual/original view and insert this new view's shortcode, in place of "wpv-pager-nav-links" shortcode, like this:


<ul class="wpv-pagination-nav-links-container js-wpv-pagination-nav-links-container pagination">
[wpv-view name="SLUG-OF-THE-DUPLICATE-VIEW"]
</ul>

Note: You'll replace "SLUG-OF-THE-DUPLICATE-VIEW" with the actual slug of the new duplicate view.

To make this custom pagination links update with the automatic transition, you'll need to add some custom script that can detect the change and update the active link, accordingly.

I hope this helps and for more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/

regards,
Waqar

#1273081

No worries, I've submitted a feature request. I thought I may have been overlooking something simple but this should work fine.