Skip Navigation

[Resolved] Show download button instead of read more button in view displaying posts

This support ticket is created 3 years, 1 month 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by Marcel 3 years, 1 month ago.

Assisted by: Shane.

Author
Posts
#1973475

My client has a few posts that contain a downloadable file. With these posts, she would like to replace the "read more" button that leads to the post URL with a "download" button that leads to the download file.

So I added a custom file upload field for posts, and a category "download". Now, I want to display a download button that links to the downloadable file in the post loop, but only for the posts in the download category.

How can I do that?

#1973565

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Marcel,

Thank you for getting in touch. Can you let me know if you are using the classic view editor or if you're using the Blocks editor. Secondly do you want all this to be done with one view ?

We can make use of the conditional statements to check if a post has the taxonomy term assigned so please letme know.
Thanks,
Shane

#1973589

Hi Shane,

I use the blocks editor, and yes, I would like this this to be done with one view. I already tried to use the conditional block, but I don't see a way to set a category as a condition.

#1973655

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2021-03-03 at 10.11.49 AM.png
Screenshot 2021-03-03 at 10.11.57 AM.png

Hi Marcel,

In the conditional block you need to use the Post Taxonomies option. See My screenshot for an example of how the conditional should look.

Once you've done this just populate inside your conditional block with attributes of your post that you want to display.

Please let me know if this was able to help you achieve your desired results.

Thanks,
Shane

#1973807

Thanks Shane. I don't have the "post taxonomies" option in the dropdown, but I could get it to work with your shortcode. It does say "incomplete condition" though. When I enable debug mode, I get the following. I also need a code to hide the read more button on those categories, and I would like to have the download file open in a new tab.

Of course, you're more than welcome to login on the site.

####################
wpv-conditional attributes
####################
Array
(
[if] => ( CONTAINS( #(category), 'download' ) )
[debug] => true
)

####################
Debug information
####################
--------------------
Original expression: ( CONTAINS( #(category), 'download' ) )
--------------------
After matching 2 numeric strings into real numbers: ( CONTAINS( ARRAY('articles',77,'Articles','download','136','Download','it-services-ma','124','IT Services M&A'), 'download' ) )
Matched '77' to 77
After matching 5 numeric strings into real numbers: ( CONTAINS( ARRAY('articles',77,'Articles','download',136,'Download','it-services-ma','124','IT Services M&A'), 'download' ) )
Matched '136' to 136
After matching 8 numeric strings into real numbers: ( CONTAINS( ARRAY('articles',77,'Articles','download',136,'Download','it-services-ma',124,'IT Services M&A'), 'download' ) )
Matched '124' to 124

#1973825

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Marcel,

Would you mind allowing me to have admin access to the site so that I can take a look at this in further details for you ?

I've enabled the private fields for your next response. Also please let me know the page that you are working on as well.

Thanks,
Shane

#1974041

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Marcel,

This should now be working.
hidden link

I removed the query filter from the view just so that it can display the items for testing purposes. I had to re-do the conditional queries and it resolved the issue.

Thanks,
Shane

#1974083

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.