Wordpresss modification question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rogueteens
    So fucking bland
    • Jul 2006
    • 8005

    #1

    Wordpresss modification question

    When I add media I have the option to link the attachment to a variety of options (custom url, media file, that type of thing) but where in the WP back end can I find the code that controls this? I want to make it so that clicking on the image opens in a new window.

    Cheers
    Free traffic and backlinks from one of the fastest growing adult pinsites on the net - SAUCY PICTURES!
    Easily my best performing webcam sponsor - CLICK HERE!!
  • purecane
    Annakin Skywalker
    • Jan 2013
    • 1324

    #2
    on mine when you add the custom url, it has a box to check for either new window or same page....
    [email protected]

    Comment

    • rogueteens
      So fucking bland
      • Jul 2006
      • 8005

      #3
      Originally posted by purecane73
      on mine when you add the custom url, it has a box to check for either new window or same page....
      I don't think you do from the "Insert Media" > "Upload Files" > "Attachment Display Settings" page, which is what I want to modify.
      Free traffic and backlinks from one of the fastest growing adult pinsites on the net - SAUCY PICTURES!
      Easily my best performing webcam sponsor - CLICK HERE!!

      Comment

      • purecane
        Annakin Skywalker
        • Jan 2013
        • 1324

        #4
        yep, you're right...i see now.
        [email protected]

        Comment

        • TrashyGirl
          Confirmed User
          • Apr 2010
          • 1401

          #5
          You used to be able to do this by clicking on the image in "Edit Media" and then clicking on the "Advanced Settings" and clicking a box for Target - Open in a New Window. But I don't see this feature w/ the new WP update that changed image handling. I think it can be done for galleries using NextGen Gallery plugin.

          The coding issue would be that the images set in each post are specific content to each post as far as how I understand WP. So maybe Fris or someone else can advise you the code to insert to loop thru the posts, use regex to grab the images and code them to open t\ blank ???

          Comment

          • Fetish Gimp
            Confirmed User
            • Feb 2005
            • 1699

            #6
            Originally posted by rogueteens
            When I add media I have the option to link the attachment to a variety of options (custom url, media file, that type of thing) but where in the WP back end can I find the code that controls this? I want to make it so that clicking on the image opens in a new window.

            Cheers
            Haven't tried this myself, but looks like it might do what you want
            http://wordpress.org/extend/plugins/...-custom-links/
            Strapon Seduction - femdom blog | Twitter

            Comment

            • rogueteens
              So fucking bland
              • Jul 2006
              • 8005

              #7
              I don't think that'll work.
              I really did think it would just be a simple line modification in one of the files?
              Free traffic and backlinks from one of the fastest growing adult pinsites on the net - SAUCY PICTURES!
              Easily my best performing webcam sponsor - CLICK HERE!!

              Comment

              • iwantchixx
                Too lazy to set a custom title
                • Oct 2002
                • 12860

                #8
                Do you want all pics to act like this, if so why not just use a lightbox?

                Comment

                • harvey
                  Confirmed User
                  • Jul 2001
                  • 9266

                  #9
                  Originally posted by iwantchixx
                  Do you want all pics to act like this, if so why not just use a lightbox?
                  this

                  anyway, you could also use http://wordpress.org/extend/plugins/...window-plugin/
                  This post is endorsed by CIA, KGB, MI6, the Mafia, Illuminati, Kim Jong Il, Worldwide Ninjas Association, Klingon Empire and lolcats. Don't mess around with it, just accept it and embrace the truth

                  Comment

                  • rogueteens
                    So fucking bland
                    • Jul 2006
                    • 8005

                    #10
                    Originally posted by iwantchixx
                    Do you want all pics to act like this, if so why not just use a lightbox?
                    It doesn't work with the theme i'm using. it shows the pictures full size and I have them clickable to go to sponsors and I want the click to open in a new window.

                    Originally posted by harvey
                    that seems like a heck of a lot of mucking around just to get the image opening in a new window, I think it might muck up other stuff I have on my blog too but thanks anyway.
                    Free traffic and backlinks from one of the fastest growing adult pinsites on the net - SAUCY PICTURES!
                    Easily my best performing webcam sponsor - CLICK HERE!!

                    Comment

                    • Colmike9
                      (>^_^)b
                      • Dec 2011
                      • 7230

                      #11
                      Code:
                      <?php
                      /* Plugin Name: (#50911) Open gallery img in new window/tab */
                      
                      add_action( 'after_setup_theme', 'wpse50911_replace_img_shortcodes' );
                      function wpse50911_replace_img_shortcodes()
                      {
                          remove_shortcode( 'gallery', 'gallery_shortcode' );
                          add_shortcode( 'gallery', 'wpse50911_gallery_shortcode' );
                      
                          remove_shortcode( 'caption', 'img_caption_shortcode' );
                          add_shortcode( 'caption', 'wpse50911_caption_shortcode' );
                      
                          remove_shortcode( 'wp_caption', 'img_caption_shortcode' );
                          add_shortcode( 'wp_caption', 'wpse50911_caption_shortcode' );
                      }
                      function wpse50911_gallery_shortcode( $attr )
                      {
                          return links_add_target( gallery_shortcode( $attr ) );
                      }
                      function wpse50911_caption_shortcode( $attr, $content = null)
                      {
                          return img_caption_shortcode( $attr, links_add_target( $content ) );
                      }
                      ?>
                      Join the BEST cam affiliate program on the internet!
                      I've referred over $1.7mil in spending this past year, you should join in.
                      I make a lot more money in the medical field in a lab now, fuck you guys. Don't ask me to come back, but do join Chaturbate in my sig, it still makes bank without me touching shit for years..

                      Comment

                      • duk75
                        Confirmed User
                        • Feb 2012
                        • 741

                        #12
                        TARGET="_blank"
                        ...Nice.

                        Comment

                        • rogueteens
                          So fucking bland
                          • Jul 2006
                          • 8005

                          #13
                          Originally posted by Colmike7
                          Code:
                          <?php
                          /* Plugin Name: (#50911) Open gallery img in new window/tab */
                          
                          add_action( 'after_setup_theme', 'wpse50911_replace_img_shortcodes' );
                          function wpse50911_replace_img_shortcodes()
                          {
                              remove_shortcode( 'gallery', 'gallery_shortcode' );
                              add_shortcode( 'gallery', 'wpse50911_gallery_shortcode' );
                          
                              remove_shortcode( 'caption', 'img_caption_shortcode' );
                              add_shortcode( 'caption', 'wpse50911_caption_shortcode' );
                          
                              remove_shortcode( 'wp_caption', 'img_caption_shortcode' );
                              add_shortcode( 'wp_caption', 'wpse50911_caption_shortcode' );
                          }
                          function wpse50911_gallery_shortcode( $attr )
                          {
                              return links_add_target( gallery_shortcode( $attr ) );
                          }
                          function wpse50911_caption_shortcode( $attr, $content = null)
                          {
                              return img_caption_shortcode( $attr, links_add_target( $content ) );
                          }
                          ?>
                          thank you very much
                          Free traffic and backlinks from one of the fastest growing adult pinsites on the net - SAUCY PICTURES!
                          Easily my best performing webcam sponsor - CLICK HERE!!

                          Comment

                          • fris
                            Too lazy to set a custom title
                            • Aug 2002
                            • 55679

                            #14
                            you can make it default to the url of the image

                            Code:
                            add_filter( 'attachment_link', 'direct_image_urls_for_galleries', 10, 2 );
                            
                            function direct_image_urls_for_galleries( $link, $id ) {
                            	if ( is_admin() ) return $link;
                            
                            	$mimetypes = array( 'image/jpeg', 'image/png', 'image/gif' );
                            
                            	$post = get_post( $id );
                            
                            	if ( in_array( $post->post_mime_type, $mimetypes ) )
                            		return wp_get_attachment_url( $id );
                            	else
                            		return $link;
                            }
                            not sure if thats what you want.
                            Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                            Comment

                            Working...