Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #274873

    Hey There,
    The attachment page created when I upload PDFs into the media manager, has an odd breadcrumb structure. I attached to media file to the page “geologic maps” which has the breadcrumb home/maps&publications/maps/geologicmaps/. But when I click on the file attachment from the search results and it opens up the attachment page, the breadcrumb shows: home/Test-Page Elizabeth/maps&publications/maps/geologicmaps/

    I have two questions for resolution:

    1: How can I have the attachment page match the actual structure of the page the attachment is attached to rather than adding the random “Test-page elizabeth” page in the breadcrumb?

    2: How can I have the attachment link in the search results open up into the file url when I click on it instead of the attachment page that is automatically created? (i.e. when I click on the pdf file in the results it opens the pdf rather than the page with a link to the pdf?)

    if it helps I am using the enfold theme with the SearchWP plugin. I am using the add from server plugin in for adding my media files (primarily PDFs).

    #275009

    Hi tonblam!

    1) I did a quick test on my test server and the breadcrumb displays the page the attachment is attached to. Please create me an admin account and I’ll check why this “Test-page elizabeth” page pops up in the breadcrumb.

    2) Open up wp-content\themes\enfold\includes\loop-search.php and replace:

    
    echo "<h2 class='post-title entry-title'><a title='".the_title_attribute('echo=0')."' href='".get_permalink()."' $markup>".get_the_title()."</a></h2>";
    

    with

    
    $link = (is_attachment($the_id)) ? wp_get_attachment_url($the_id) : get_permalink($the_id);
    echo "<h2 class='post-title entry-title'><a title='".the_title_attribute('echo=0')."' href='$link' $markup>".get_the_title()."</a></h2>";
    

    You can copy the modified loop-search.php into your child theme folder (enfold-child\includes\loop-search.php).

    Cheers!
    Peter

    #279743

    Unfortunately access to the site is restricted to our network only and as I do not have administrative priveleges I am unable to create an admin, but for anyone else with a similar issue I was able to create an attachment.php file that I added into the enfold theme’s folder that redirects all of the attachment pages to the actual file URL so upon clicking it opens up the PDFs on the site instead of opening up a page that has a link to the pdf. Here is the code I used.
    <?php wp_redirect( wp_get_attachment_url() ); exit; ?>

    As for the weird breadcrumb on the attachment page we just figured we wouldn’t worry about it since with the redirect nobody will ever see those attachment pages anyways. Thank you for your help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Attachment Page Breadcrumb’ is closed to new replies.