Created
March 27, 2015 13:49
-
-
Save scottwyden/9555926ae344d3e8f512 to your computer and use it in GitHub Desktop.
Photocrati Theme Attachment Page Mods in Functions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Attachement Page Modifications | |
add_action('generate_rewrite_rules', 'attachment_rewrite_rule_14924'); | |
function attachment_rewrite_rule_14924($wp_rewrite){ | |
$new_rules = array(); | |
$new_rules['attachment/(\d*)$'] = 'index.php?attachment_id=$matches[1]'; | |
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules; | |
} | |
add_action( '__after_content' ,'my_attachment_description' ); | |
function my_attachment_description() { | |
global $post; | |
if ( ( isset($post) && 'attachment' != $post -> post_type) || !is_singular() || empty( $post->post_content ) ) | |
return; | |
?> | |
<section> | |
<p class="text-center muted"> | |
<?php echo strip_tags(apply_filters ('the_excerpt', $post->post_content)) ?> | |
</p> | |
</section> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment