In a project I’m working on, I am attempting to use different post types for the type of data we are categorizing. But we have instances where the same title may appear in two different post types, and this confuses Interlinks.
A good example is on a music site. An album may have a title of Something Good, and one of the cuts on the album may also be “Something Good.” As Interlinks looks at the page title, you can see where disambiguation comes into play. Using my two post types, I have URLs like this:
The URLs work great, but the plugin only picks up one of the two. (In my test case, it is picking up /song/something-good all the time.)
I had a couple of thoughts to dealing with that behavior. I’m wondering if we could base the interlink on the slug/permalink (which I’m guessing would only be a minor code change), or I custom modify the plugin (or just duplicate it) to use the brackets as a shortcode for songs, and perhaps double curly braces for albums (which would likely be a small change to the regex). The only problem I’ve found there is that the database query does nothing to differentiate between a custom post type–it just pulls in the first page title it finds. And given how revisions are stored in the database, it will take a lot more complicated query and/or PHP code processing to find out exactly what the page type is.
Any ideas? I’ve been mucking about in the code but haven’t gotten over the query hurdle yet.