Skip Navigation

[Resolved] how do I generate a list of the permalinks for all custom posts.

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to use Views to create a list of permalinks and titles for a custom post type.

Solution: Use the wpv-post-title and wpv-post-url shortcodes in a loop.

This support ticket is created 4 years ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 6 replies, has 2 voices.

Last updated by davidm-13 4 years ago.

Assisted by: Christian Cox.

Author
Posts
#1888785

Hi I need a list of the permalinks and titles for all posts in a given custom post type.
How would I do this?
Thanks for your help

#1888815

Hello, if you want to display a list of post titles and permalinks on the front-end of the site, you should use Toolset Blocks or Toolset Views to create a View of this custom post type. In the loop of that View you can use the Single Fields block to display the post title, or post title with a link, or the post URL. You can insert multiple Single Field blocks in the View's loop to display more than one piece of information about each post.

Does this answer your question, or did I misunderstand what you want to achieve?

#1888927

Hi Christian,
Thanks very much for your reply.
Would it be possible to see a Views code snippet of what you describe without using Blocks .
Thanks

#1888965

Yes, if you prefer to use Views you can create a loop with the following code:

[wpv-layout-start]
[wpv-items-found]
<ul class="wpv-loop js-wpv-loop">
<!-- wpv-loop-start -->
  <ul class="wpv-loop js-wpv-loop">
    <wpv-loop>
      <li>
        [wpv-post-title], [wpv-post-url]
      </li>
    </wpv-loop>
  </ul>
  <!-- wpv-loop-end -->
</ul>
[/wpv-items-found]
[wpv-no-items-found]
[/wpv-no-items-found]
[wpv-layout-end]

You can find out more about the post title and post url shortcodes in the Views Shortcode developer documentation:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/

#1889019

Thanks for this Christian.
How do I limit this to just custom posts of type plant?
Thanks

#1889021

In the View Editor screen Content Selection panel, you should select the "Plants" post type and deselect all other post types.

#1889189

My issue is resolved now. Thank you!