This topic contains 3 replies, has 2 voices, and was last updated by
- January 29, 2020 at 10:14 am #25549Participant
I’m developing a website for my client. I have run into a problem with ASP and searching attachments.
First of all, the email address for the account is my clients so I will only see support request updates through your website unless you can let me know at [email protected]
The search works perfectly but when clicking on a search result for an attachment the “attachment parent post” will not be displayed. Only the attachment JPG is displayed. I have of course set up the plugin to return attachments in the parent post.
Search form “Website search”
So, here’s an example:
Search for “Braunton Church Medieval”
Result: at the bottom of the search results you will two pictures of churches which are attachments with the search term. Clicking on either of these results in:
What should be returned is this:
it’s critical that this works because this is one of the main reasons why we purchased the plugin.
Can you take a look please and let me know what the solution is.
In advance, thank you.
Rees Kenyon – web dev and designerJanuary 30, 2020 at 10:05 am #25561Keymaster
Thank you for all the details, it helps us a lot.
Okay, so I checked the given posts and their attachments, and I see the problem. The given images are not actually attached to that post, but only used in their contents. You can check that this way:
– Open the post editor and click “Add Media”: https://i.imgur.com/MKESsrz.png
– Click the Media library: https://i.imgur.com/GgjOGvj.png
– Change “Uploaded to this”: https://i.imgur.com/ZkMVhlx.png
As you can see, there is only one image attached to the post, when searching that image name, the post is returned as it should.
When the plugin indexes the attachments, it checks the database for the attachment parents, but in this case their parents are not defined in the database, because they are not attached to any post, but simply uploaded as images (or the parent was deleted).
Unfortunately currently there is no way of getting in which post was the attachment image used, as the post contents does not contain a connection between the image object, only the image URL.
I am not sure if there is a way to natively change the attachment parent IDs via editor, but there might be plugins out there for this purpose.Best,
If you like my products, don't forget to rate them on codecanyon :)
January 30, 2020 at 11:46 am #25563Participant
Thank you for taking the time to explain why the attachments aren’t recognised in the page or post.
I have found a workaround which might be really useful for you to use as a future suggestion for others.
I’m using themify builder and like many other visual composition software it breaks out of the usual WordPress publishing methodology.
My trick is to add a text box (builder component) at the bottom of the post and add all the media attachments used in the this post. I then add a <noscript> at the beginning of these attachments and a </noscript> at the end in the tinymce text view option. This in turn attaches all the images to the post but of course doesn’t display or load them so they have no effect on page load, the DOM, page rendering and probably more importantly load balancing.
You can see how I did this here if you want to take a look:
Rees.January 30, 2020 at 2:42 pm #25564
You must be logged in to reply to this topic.