Tutorial :Change management in WordPress



Question:

I have a beginner question. What is the best way to address the change management issues in WordPress? I have an all-pages WordPress installation. Suppose name of some event or an entity changes from A to B, then I have to go to all the pages to make that change. Is there any better way of doing it? Like externalization or something. Or the way similar to how WordPress handle blog name using bloginfo() function. You change blog name at one place and it is reflected everywhere.

Thanks, Paras


Solution:1

If a URL on your site changes, it is always wise to leave a redirect to the new page. This will help your visitors and search engines. If you create redirects, it doesn't matter too much if you still have a link to the old address in one of your posts. There will probably be a plugin for this, but I don't know which one.

If you really want to keep all links pointing to the latest version, you could replace them with shortcodes that are evaluated to the real URL. <a href="[linkto postid=123]"> would then result in <a href="/2010/08/05/some-post">. I think this is doable, but I don't know whether a plugin already exists for this.

You can also use this technique to replace short snippets, like your company name. The Shortcode API is really easy:

// [company_name]  function replace_company_name($atts) {      return "My Awesome Company";  }  add_shortcode('company_name', 'replace_company_name');      // More generic  // [replace r='company_name']  // [replace r='company_motto']  function do_replacement($atts) {      $replacements = array(          'company_name' => 'My Awesome Company',          'company_motto' => 'A Company so Awesome even you would want to work here!',      );        return $replacements[$atts['r']];  }  add_shortcode('replace', 'do_replacement');  

You can hardcode the strings in your plugin code, or you could create a Wordpress options page where users can add and edit new shortcodes.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »