Community Forums › Forums › Archived Forums › General Discussion › Can I set/edit a default link for an image in media lib?
Tagged: image link
- This topic has 9 replies, 3 voices, and was last updated 10 years ago by essaysnark.
-
AuthorPosts
-
April 26, 2014 at 10:08 am #102439devParticipant
I uploaded to Media Library a plain old Amazon "buy" button.
I did not set a 'custom link' at that time. I set it to 'none.'
I inserted the button on a bunch of pages... a lot of them... and set the link to the page on Amazon I want to go to if clicked.
Now I find I have to change the link and the only way I know is to go to EVERY page and edit that button-image.
Is there any way to set a 'default' link to an image button... set it once globally?
A plugin or PHP code in functions?
It would save me a ton of time?
Thanks.
April 26, 2014 at 11:01 am #102453AnitaKeymasterApril 26, 2014 at 11:32 am #102470devParticipantThe plugin only works with a gallery, as I understand it. And with 3.9 who knows were galleries have gone to?
I have these Amazon buttons insered in lots of pages and sidebars (at bottom) and if I throw in a [gallery] shortcode it works but it kind of throws off the spacing and I think I'd have to put in a ton of CSS to align it right. And besides, I would have to put in the short code on every page. If I'm going to do that I may as well just edit each Amazon button!
Do you have stronger magic for me?
Thanks.
April 26, 2014 at 11:35 am #102471AnitaKeymasterI've used that on individual images. So I am not sure what you read - but if you install it and then look at an individual image - you will see "Gallery Image" and where to place the URL. You don't have to have a gallery for that to work. They probably should change that name on there.
That's about all I have. Maybe someone else has a better way.
Love coffee, chocolate and my Bella!
April 26, 2014 at 12:50 pm #102489devParticipantI don't think it works with 3.9 (at least not with the old Agency theme)
I edit the image in Media Lib. and add the Gallery Link.
Using Insert Media I put the pix into my page.
When I go to 'edit' pix, none of the plugin add-on areas are shown (under advanced)
I think it has something to do with the new media editing stuff that WP put in for 3.9.
It only works if I put in a [gallery] shortcode in the page... which is what I don't want to do.
Thanks anyway.
April 27, 2014 at 8:31 am #102586essaysnarkParticipantThis is definitely stronger magic:
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
April 27, 2014 at 1:55 pm #102637devParticipantThis is a well-known tool and I use it when migrating WP sites from one domain to another.
But if you have a image button (i.e. Buy from Amazon) on the site now and it is NOT linked... what would you search and replace?
I've looked high and low and can't find a solution. I'm going to have to go into every page and change (edit) each button with the link to the Amazon page. It's not that big a deal... but I was hoping to find a better solution.
April 27, 2014 at 2:07 pm #102638essaysnarkParticipantWhy can't you search/replace the entire img src block? If it's not linked now, then just add the full anchor tag in the 'replace' part. Not seeing why that wouldn't work.
April 27, 2014 at 2:24 pm #102639devParticipantI dumped the database and did a search on "amazon'. Here is a slice of the output:
sed.\r\n\r\n \r\n\r\n<img src="http://buildwealthandspenditall.com/wp/wp-content/uploads/smashword.png" alt="smashword" width="126" height="40" />\r\n\r\n<img src="http://buildwealthandspenditall.com/wp/wp-content/uploads/amazon.png" alt="amazon" width="120" height="42" />','default-sidebar','','inherit','open','open','','58-revision-v1','','','2014-04-26 05:40:35','2014-04-26
perhpas if I replaced:
src=\"http://buildwealthandspenditall.com/wp/wp-content/uploads/amazon.png
and put an href in there...
it might work. Or I'd screw up the database! (Yeah, keep a copy!)
The way that WP serializes it's data in the database, you are just asking for problems messing with it externally.
April 27, 2014 at 2:42 pm #102640essaysnarkParticipantThe way that WP serializes it’s data in the database, you are just asking for problems messing with it externally.
Which is the whole point of that tool that I linked to.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.