Forum Replies Created

Viewing 1 replies (of 1 total)
  • Let me see if I understand what you’re trying to do. . . are you trying to remove the link to the attachment page when you post (an) image(s) with the gallery feature?

    If so, I had the same irritation, and so I went to the post-template.php (it’s in the wp-includes folder), edited this piece of code :

    // get an attachment page link using an image or icon if possible
    function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false) {
    	$_post = & get_post( intval($id) );
    
    	if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
    		return __('Missing Attachment');
    
    	if ( $permalink )
    		$url = get_attachment_link($_post->ID);
    
    	$post_title = attribute_escape($_post->post_title);
    
    	$link_text = wp_get_attachment_image($id, $size, $icon);
    	if ( !$link_text )
    		$link_text = $_post->post_title;
    
    	return "<a href='$url' title='$post_title'>$link_text</a>";
    
    }

    All you have to do is remove the url tags surrounding “$link_text” (in the “return” line of code”). However, if you ever want to link to an attachment page in the future, I would advise you not to do this, because it removes the link to attachment pages from ALL attachments.

    (Disclaimer : I am not a php pro, so I can’t guarantee it won’t create some other type of issue, but it worked wonderfully for me.)

Viewing 1 replies (of 1 total)