This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Search result to PDF

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #55215
    99projects99projects
    Participant

    Hi, I bought the Media Service Pro add on this week and am having trouble with the search result going to the (PDF) document right away. It first directs me to a page with a link to the PDF, even though I tried different settings under ‘Media Service File Access Method’. Even though I have the settings (as you pointed out in your email to me this afternoon) as “Link the results to: attachment file directly” right from the beginning.

    You can experience the problem I’m having when you search for ‘waterbeheer’. You will see a results page with a postcard type of layout.
    When clicking on the title ‘BetonInfra Factsheet Duurzaam Waterbeheer’ it takes you to this page https://betoninfra.wpcomstaging.com/bi-factsheet-duurzaam-waterbeheer/ where there is a link to the PDF. Clicking the link finally show the PDf in the browser. But I would like the link on the search results page to go directly to the PDf in the browser. Hope you can tell me what’s wrong?

    Now I must say this is an Avada themed website by clients’ request (and I hate it) so maybe there’s an issue with that? To make matters worse it’s also hosted on WordPress.com. Sorry!

    #55216
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    The results page can be tricky, it often times gets the URLs on it’s own from the stored permalinks, and in case of PDFs it’s usually the attachment page and not the direct file.

    Since you are using Avada with fusion builder, there is a nice trick to make it still work. I have used the log-in and SFTP details and did the following:

    1. On the editor, I have changed the result element link to an “Action” named asp_change_res_page_url: https://i.imgur.com/jtVwSpz.png
    2. Then to the child theme functions.php I have added this code to generate the PDF urls using that action:

    add_action('asp_change_res_page_url', function($url) {
    	global $post;
    	if ( isset($post->post_type) && $post->post_type === "attachment" ) {
    		echo $post->guid;
    	} else {
    		echo $url;
    	}
    }, 10, 1);

    Now, the code will trigger and for attachments it will return the file pointer, and for other result types the original URL.

    #55218
    99projects99projects
    Participant

    Thank you so much, Ernest! This is wonderful and also your reply was fast!

    #55221
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    #55258
    99projects99projects
    Participant

    You cannot access this content.

    #55277
    Ernest MarcinkoErnest Marcinko
    Keymaster

    The issue was that the action was removed from the search result title and was replaced with the default permalink. I have changed it back to the action. Now it’s okay.

    #55283
    99projects99projects
    Participant

    You cannot access this content.

    #55284
    99projects99projects
    Participant

    Screenshot of search results

    #55286
    99projects99projects
    Participant

    Screenshot of page when clicking on the result

    #55288
    99projects99projects
    Participant

    Ernest, never mind… I see that it’s working correctly lining to the media files… but that I presumed that the results showed the pdf’s but those were posts that were created (I’m not sure how but maybe with an import I did earlier this month).

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.