I'm using the Relevanssi search plugin, which is basically a better version of the default search. Anyway when I search for something it displays everything I need it to, I was just wondering whether there would be a way to differentiate the search results for attachment pages from everything else, e.g. Display "Document: [name of attachment page]" instead of the just the name of the page?
1 Answer
Found out how to do it, I added the following in content.php
. I added the second elseif statement and simple put the word Document in there before it displays the title of the page.
if ( is_single() ) {
the_title( '<h1 class="entry-title">', '</h1>' );
}
elseif (get_post_type() == 'attachment' ) {
the_title( '<h1 class="entry-title">Document: <a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
}
else {
the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
}