/* These functions are exact duplicates of what you will find in the original WordPress versions, except they add nofollow and get options for your theme's attachment.php file (that you can assign to a variable, rather than forcing it to echo */ function nofollow_next_posts_link($label='Next Page »', $max_page=0) { global $paged, $wp_query; if ( !$max_page ) { $max_page = $wp_query->max_num_pages; } if ( !$paged ) $paged = 1; $nextpage = intval($paged) + 1; if ( (! is_single()) && (empty($paged) || $nextpage <= $max_page) ) { echo ''. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .''; } } function nofollow_previous_posts_link($label='« Previous Page') { global $paged; if ( (!is_single()) && ($paged > 1) ) { $prevpage = intval($paged) - 1; echo ''. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .''; } } function nofollow_post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) { $url = get_post_comments_feed_link($post_id, $feed); if ( empty($link_text) ) $link_text = __('Comments Feed'); echo "$link_text"; } function nofollow_comments_popup_link( $zero = 'No Comments', $one = '1 Comment', $more = '% Comments', $css_class = '', $none = 'Comments Off', $nofollow = true ) { global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post; if ( is_single() || is_page() ) return; $number = get_comments_number( $id ); if ( 0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status ) { echo '' . $none . ''; return; } if ( !empty($post->post_password) ) { // if there's a password if ( !isset($_COOKIE['wp-postpass_' . COOKIEHASH]) || $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) { // and it doesn't match the cookie echo __('Enter your password to view comments'); return; } } echo ''; comments_number( $zero, $one, $more, $number ); echo ''; } // get_ Updates for your theme's attachment.php file function get_adjacent_image_link($prev = true) { global $post; $post = get_post($post); $attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') )); foreach ( $attachments as $k => $attachment ) if ( $attachment->ID == $post->ID ) break; $k = $prev ? $k - 1 : $k + 1; if ( isset($attachments[$k]) ) return wp_get_attachment_link($attachments[$k]->ID, 'thumbnail', true); } function get_previous_image_link() { return get_adjacent_image_link(true); } function get_next_image_link() { return get_adjacent_image_link(false); } function nofollow_get_the_category_list( $separator = '', $parents='', $post_id = false ) { global $wp_rewrite; $categories = get_the_category( $post_id ); if ( empty( $categories ) ) return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents ); $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag nofollow"' : 'rel="category nofollow"'; $thelist = ''; if ( '' == $separator ) { $thelist .= '