{"id":30053,"date":"2014-06-13T07:23:03","date_gmt":"2014-06-13T07:23:03","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/wp-softlinks\/"},"modified":"2014-06-13T08:56:54","modified_gmt":"2014-06-13T08:56:54","slug":"wp-softlinks","status":"publish","type":"plugin","link":"https:\/\/ne.wordpress.org\/plugins\/wp-softlinks\/","author":13862838,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0.1","stable_tag":"1.0.1","tested":"3.9.40","requires":"3.6","requires_php":"","requires_plugins":"","header_name":"WordPress Softlinks","header_author":"SwiftWeb B.V.","header_description":"","assets_banners_color":"","last_updated":"2014-06-13 08:56:54","external_support_url":"","external_repository_url":"","donate_link":"http:\/\/www.swiftweb.nl\/","header_plugin_uri":"http:\/\/www.swiftweb.nl","header_author_uri":"","rating":5,"author_block_rating":0,"active_installs":10,"downloads":1335,"num_ratings":2,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":{"1.0":"<p>Major upgrade, removed [softlink] shortcode, easier to use with data-wp-id tag.<\/p>"},"ratings":{"1":0,"2":0,"3":0,"4":0,"5":"2"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0","1.0.1"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":"931674","resolution":"1","location":"assets"},"screenshot-2.png":{"filename":"screenshot-2.png","revision":"931674","resolution":"2","location":"assets"},"screenshot-3.png":{"filename":"screenshot-3.png","revision":"931674","resolution":"3","location":"assets"},"screenshot-4.png":{"filename":"screenshot-4.png","revision":"931674","resolution":"4","location":"assets"}},"screenshots":{"1":"An example how a link works with the data-wp-id","2":"An example how an image works with the data-wp-id","3":"The image remains intact in the editor","4":"The link modal contains an ID field"},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[71036,71035,71034,1719],"plugin_category":[],"plugin_contributors":[97558],"plugin_business_model":[],"class_list":["post-30053","plugin","type-plugin","status-publish","hentry","plugin_tags-data-wp-id","plugin_tags-post-link-replacement","plugin_tags-softlink","plugin_tags-tinymce","plugin_contributors-swiftweb","plugin_committers-swiftweb"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/wp-softlinks.svg","icon_2x":false,"generated":true},"screenshots":[{"src":"https:\/\/ps.w.org\/wp-softlinks\/assets\/screenshot-1.png?rev=931674","caption":"An example how a link works with the data-wp-id"},{"src":"https:\/\/ps.w.org\/wp-softlinks\/assets\/screenshot-2.png?rev=931674","caption":"An example how an image works with the data-wp-id"},{"src":"https:\/\/ps.w.org\/wp-softlinks\/assets\/screenshot-3.png?rev=931674","caption":"The image remains intact in the editor"},{"src":"https:\/\/ps.w.org\/wp-softlinks\/assets\/screenshot-4.png?rev=931674","caption":"The link modal contains an ID field"}],"raw_content":"<!--section=description-->\n<p>We were tired to alter every link and image in posts, pages or widgets when switching from development to live environments.<\/p>\n\n<p>e.g. when you insert an image in TinyMCE on your development environment (<code>http:\/\/dev.example.com<\/code>), the image has a hard URL: <code>http:\/\/dev.example.com\/media\/2014\/06\/example.jpg<\/code>\nWhen switching to your live environment (<code>http:\/\/live.example.com<\/code>), you change your WordPress Site URL, but the image in the content is still <code>http:\/\/dev.example.com\/media\/2014\/06\/example.jpg<\/code>.\nThis is very frustrating, you have to alter each page, post, widget etcetera...<\/p>\n\n<p>This plugin solves that problem. It automatically adds a data-wp-id tag when you insert an image or link in your TinyMCE.\nThe data-wp-id tag contains a unique ID from the wp-post table in WordPress.<\/p>\n\n<p>When displaying the content on the front-end this plugin automatically recognizes the data-wp-id tag and replaces the <code>src=\"\"<\/code> and <code>href=\"\"<\/code> with the correct permalink.\nYou can use the tag anywhere you want, simply add the <code>data-wp-id=\"123\"<\/code> (where <code>123<\/code> is the ID).<\/p>\n\n<h4>So, how does it work?<\/h4>\n\n<p>The plugin automatically adds the data-wp-id when inserting an image or link in the WordPress editor.<\/p>\n\n<p><strong>Normally, when you insert an image into the WP editor, WordPress would generate image tags like this:<\/strong><\/p>\n\n<blockquote>\n  <p><code>&lt;img src=\"http:\/\/dev.example.com\/media\/2014\/05\/example-150x150.jpg\" class=\"size-thumbnail\" width=\"150\" height=\"150\" \/&gt;<\/code><\/p>\n<\/blockquote>\n\n<p><strong>But this Plugin will generate a link like this:<\/strong><\/p>\n\n<blockquote>\n  <p><code>&lt;img data-wp-id=\"123\" src=\"#\" class=\"size-thumbnail\" width=\"150\" height=\"150\" \/&gt;<\/code><\/p>\n<\/blockquote>\n\n<p><strong>... And finally on the Front-End, the Plugin will output is as:<\/strong><\/p>\n\n<blockquote>\n  <p><code>&lt;img src=\"http:\/\/live.example.com\/media\/2014\/05\/example-150x150.jpg\" class=\"size-thumbnail\" width=\"150\" height=\"150\" \/&gt;<\/code><\/p>\n<\/blockquote>\n\n<p>Another example, adding a link:<\/p>\n\n<p><strong>Normally WordPress will generate a link like this:<\/strong><\/p>\n\n<blockquote>\n  <p><code>&lt;a href=\"http:\/\/dev.example.com\/example-page\" target=\"_blank\" \/&gt;<\/code><\/p>\n<\/blockquote>\n\n<p><strong>But this Plugin will generate it like this:<\/strong><\/p>\n\n<blockquote>\n  <p><code>&lt;a data-wp-id=\"100\" href=\"#\" target=\"_blank\" \/&gt;<\/code><\/p>\n<\/blockquote>\n\n<p><strong>...And finally on the Front-End, the Plugin will output it as:<\/strong><\/p>\n\n<blockquote>\n  <p><code>&lt;a href=\"http:\/\/live.example.com\/example-page\" target=\"_blank\" \/&gt;<\/code><\/p>\n<\/blockquote>\n\n<!--section=installation-->\n<ol>\n<li>Upload the <code>wp-softlinks<\/code> folder to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<li>Place <code>data-wp-id=\"1234\"<\/code> in any HTML tag of your choice.<\/li>\n<\/ol>\n\n<!--section=faq-->\n<dl>\n<dt>How does it work?<\/dt>\n<dd><p>The plugin has a hook on the_content that parses the content. Every HTML tag that contains a data-wp-id, will be converted in a perfect link or source.<\/p><\/dd>\n<dt>How does it work under the hood?<\/dt>\n<dd><p>The plugin uses the DOMDocument Class in PHP to parse the HTML. Tags will be replaced and removed, and clean HTML will be outputted. So no Javascript or whatsoever.<\/p><\/dd>\n<dt>Do I have to add the data-wp-id tag manually?<\/dt>\n<dd><p>You can, but it will be inserted automatically by the Plugin, when inserting an Image or Link in the WordPress editor.<\/p><\/dd>\n<dt>Can you give me an example?<\/dt>\n<dd><p>Sure, you add a data-wp-id to an image: <code>&lt;img src=\"#\" data-wp-id=\"24\" class=\"size-thumbnail\" \/&gt;<\/code>, it will be converted to a clean URL: <code>&lt;img src=\"http:\/\/www.example.com\/media\/2014\/05\/example-150x150.jpg\" class=\"size-thumbnail\" \/&gt;<\/code><\/p><\/dd>\n<dt>Can I use this with HTTPS?<\/dt>\n<dd><p>Yes, because the plugin uses the WordPress Site URL to generate a link.<\/p><\/dd>\n<dt>Can I use it with any HTML tag?<\/dt>\n<dd><p>Sure, you can use any HTML tag, and it recognizes automatically if the tag needs a <code>src=\"\"<\/code> or <code>href=\"\"<\/code><\/p><\/dd>\n<dt>How does it work with image sizes?<\/dt>\n<dd><p>WordPress adds a class to any image size (e.g. size-thumbnail). The plugin recognizes this class and will return the correct link.<\/p><\/dd>\n<dt>Can I use it in my plugins and themes?<\/dt>\n<dd><p>Currently not, but we are working on that.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.0.1<\/h4>\n\n<p>Fixed screenshots, improved readme.txt<\/p>\n\n<h4>1.0<\/h4>\n\n<p>Fixed data-wp-id tag in stead of shortcode.<\/p>","raw_excerpt":"This plugin allows you to use a simple HTML tag that dynamically generates href and src tags. Easy to use, and extremely helpful.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ne.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/30053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ne.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/ne.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/ne.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=30053"}],"author":[{"embeddable":true,"href":"https:\/\/ne.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/swiftweb"}],"wp:attachment":[{"href":"https:\/\/ne.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=30053"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/ne.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=30053"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/ne.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=30053"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/ne.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=30053"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/ne.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=30053"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/ne.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=30053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}