ryelle / Foxhound

A text-focused blog theme for WordPress (in React)
https://themes.redradar.net/foxhound
349 stars 39 forks source link

Attachment URL #118

Open spacedmonkey opened 7 years ago

spacedmonkey commented 7 years ago

Currently the url pattern of /attachment/<:id> is supported. However attached uploaded to posts generate urls like this /<:year:>/<:month:>/<:slug:>/ . This pattern doesn't have route and 404s

ryelle commented 7 years ago

All attachments (including uploads) should be redirecting to the /attachment/:id page if loaded from the server (code), and attachment links in the JS-rendered content should also be caught by a JS click handler to generate and load the /attachment/:id route (code).

Is one of these two not working for you? Can you share a link to a test site, or even just a screen recording, of it not working? Thanks!

spacedmonkey commented 7 years ago

I can't as I was only testing it on my VVV install. But here is a screenshot. It is in galleries that there is an issue.

screenshot from 2017-09-09 21-59-10

I dont have jetpack installed on my VVV install.

spacedmonkey commented 7 years ago

Added the following to permalink file.

add_filter( 'attachment_link', array( $this, 'attachment_link' ), 10, 2 );
    }

    function attachment_link($link, $post_id) {

        return home_url( '/attachment/' . $post_id );
    }