Skip Navigation

[Resolved] Post type archive display

This support ticket is created 5 years, 2 months 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)

Author
Posts
#1550651
Edit Voice Newsletter ‹ St  Lucie Classroom Teachers Association — WordPress.png

Tell us what you are trying to do? Trying to show a current results of custom post with an archive.
hidden link is the example. Want to include the pdf media as well in the blog style display of the newsletters. Want to include the title and the pdf that is uploaded as media in the custom post type pdf section.

Is there any documentation that you are following? Using shortcode guide but not sure thats best method to attain desired outcome of show title and the media (example info below)

Is there a similar example that we can see? hidden link

What is the link to your site? hidden link

#1551309

Hello, it looks like you have a WordPress Archive set up to display your custom post type Voice Newsletters. I can see that archive here: hidden link
For each Voice Newsletter post in the archive, you would like to include the post title (I assume you would like this to function as a link to the post), and a link to download a PDF file that is saved as a custom field in the Voice Newsletter post. Is that correct? If so, then you can use Views and Types shortcodes to display both of these items in the archive.

I would use the wpv-post-link shortcode to display the post title as a link.

To display a button like the example site, you must create the button using HTML then use the Types field shortcode to set the link href attribute. Use output="raw" to output only the PDF URL here:

<a href="[types field='pdf-file-slug' output='raw'][/types]">[wpv-post-title]</a>

Notice that I used the wpv-post-title shortcode for the text inside the button. In the Types file field shortcode, there is not a built-in way to get the PDF filename without the full URL. I have a custom shortcode available that can be used to display just the file name:

// CUSTOM SHORTCODE TO GET FILE NAME FROM PATH
// example: [my_file_name file_url="[types field='field-slug' output='raw'][/types]"]
add_shortcode( 'my_file_name', 'my_file_name_func');
function my_file_name_func($atts)
{
  $urls = $atts['file_url'];
  $fileparts = explode('/', $urls);
  return end($fileparts);
}

You would use it like so:

[my_file_name file_url="[types field='field-slug' output='raw'][/types]"]

Replace field-slug with the actual field slug of the PDF field.

Let me know if you have questions about this, or if I misunderstood what you want to accomplish.