Title: DannyWeeks's Replies | WordPress.org

---

# DannyWeeks

  [  ](https://wordpress.org/support/users/dannyweeks/)

 *   [Profile](https://wordpress.org/support/users/dannyweeks/)
 *   [Topics Started](https://wordpress.org/support/users/dannyweeks/topics/)
 *   [Replies Created](https://wordpress.org/support/users/dannyweeks/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/dannyweeks/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/dannyweeks/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/dannyweeks/engagements/)
 *   [Favorites](https://wordpress.org/support/users/dannyweeks/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 25 total)

1 [2](https://wordpress.org/support/users/dannyweeks/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/dannyweeks/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Website Data] Adding HTML](https://wordpress.org/support/topic/adding-html-3/)
 *  Plugin Author [DannyWeeks](https://wordpress.org/support/users/dannyweeks/)
 * (@dannyweeks)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/adding-html-3/#post-6586724)
 * Hey,
 * Sorry haven’t got back to you John. I support this plugin in my spare time and
   have had quite a packed schedule for a few weeks now. I couldn’t take any money
   from you as I no longer do client work. I assumed by only needed two images stored
   the solution I suggested should be appropriate. It does depend heavily on the
   implementation of the other features you have such as the tables. That said, 
   I would suggest you take a look at a plugin called [Advanced Custom Fields](http://www.advancedcustomfields.com/)
   as it might prove very useful to you! A feature you may find useful is [Repeater fields](http://www.advancedcustomfields.com/resources/repeater/).
 * Danny
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Website Data] insert unique refrence](https://wordpress.org/support/topic/insert-unique-refrence/)
 *  Plugin Author [DannyWeeks](https://wordpress.org/support/users/dannyweeks/)
 * (@dannyweeks)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/insert-unique-refrence/#post-6693676)
 * Hi,
 * I have updated the plugin to give this functionality as I do think the user should
   explicitly say they want to edit an existing record.
 * After updating to version 2.2 it should work the way you wanted to.
 * Thanks
    Danny
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Website Data] Adding HTML](https://wordpress.org/support/topic/adding-html-3/)
 *  Plugin Author [DannyWeeks](https://wordpress.org/support/users/dannyweeks/)
 * (@dannyweeks)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/adding-html-3/#post-6586705)
 * Oh JMT007 you have found a bug!
 * When I first created this plugin I didn’t intend for so much data to be stored
   in one record. The database table where all the records are stored can only contain
   225 data characters which explains the cut off.
 * We will have to tackle your problem in a different way until I can release a 
   fix for this.
 * OK, lets store each image in its own record with the reference prefixed with 
   image.
 * For example if we wanted to store an image called _ten_ the reference would be**
   image-ten** and the data would be an array similar to have done previously:
 *     ```
       url=http://placehold.it/10
       alt=ten
       ```
   
 * So the new record would look like this: [https://gyazo.com/36692d3543a2c7e1f00abc701d41e117](https://gyazo.com/36692d3543a2c7e1f00abc701d41e117)
 * We need to replace the previous function we added to the functions.php file with
   this one
 *     ```
       function get_image_element($atts) {
           $imageName = !empty($atts['name']) ? $atts['name'] : null;
           $url = '';
           $alt = '';
   
           if($imageName && function_exists('cwd_getThe')) {
               $img = cwd_getThe('image-' . $imageName);
               if(!empty($img)) {
                   $url = $img['url'];
                   $alt = $img['alt'];
               }
           }
   
           $optionalAttribues = '';
   
           if (!empty($atts['width'])) {
               $optionalAttribues .= sprintf(' width="%s" ', $atts['width']);
           }
           if (!empty($atts['height'])) {
               $optionalAttribues .= sprintf(' height="%s" ', $atts['height']);
           }
   
           $format = "<img src=\"%s\" alt=\"%s\" %s>";
           if(!empty($url)) {
               return sprintf($format, $url, $alt, $optionalAttribues);
           }
   
           return null;
       }
   
       add_shortcode('image', 'get_image_element');
       ```
   
 * The shortcode remains the same so with this example we could use `[image name
   ="ten"]` or [image name=”ten” width=”100″]
 * That should hopefully work well for you! Let me know how that goes 🙂
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Website Data] Adding HTML](https://wordpress.org/support/topic/adding-html-3/)
 *  Plugin Author [DannyWeeks](https://wordpress.org/support/users/dannyweeks/)
 * (@dannyweeks)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/adding-html-3/#post-6586703)
 * Hey,
 * It could be a syntax error in the json causing that issue try to [validate](http://jsonlint.com/)
   it. If not try creating it as a new record and see if that works.
 * Regarding the adding of width and height you can just have optional parameters
   on your shortcode, something like this:
 *     ```
       function get_image_element($atts) {
           $imageName = !empty($atts['name']) ? $atts['name'] : null;
           $url = '';
           $alt = '';
   
           if($imageName && function_exists('cwd_getThe')) {
               $img = cwd_getThe('images');
               if(!empty($img[$imageName])) {
                   $url = $img[$imageName]['url'];
                   $alt = $img[$imageName]['alt'];
               }
           }
   
           $optionalAttribues = '';
   
           if (!empty($atts['width'])) {
               $optionalAttribues .= sprintf('width="%s"', $atts['width']);
           }
           if (!empty($atts['height'])) {
               $optionalAttribues .= sprintf('height="%s"', $atts['height']);
           }
   
           $format = "<img src=\"%s\" alt=\"%s\" %s>";
           if(!empty($url)) {
               return sprintf($format, $url, $alt, $optionalAttribues);
           }
   
           return null;
       }
   
       add_shortcode('image', 'get_image_element');
       ```
   
 * I haven’t tested it but it should be fine to use [image name=”hundred” width=”
   100″ height=”auto”] . You can leave off width and/or height and it will just 
   act as it currently does.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Website Data] Escape the equals char](https://wordpress.org/support/topic/escape-the-equals-char/)
 *  Plugin Author [DannyWeeks](https://wordpress.org/support/users/dannyweeks/)
 * (@dannyweeks)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/escape-the-equals-char/#post-6665141)
 * Good stuff mate, any other problems just give me a shout!
 * Danny
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Website Data] Escape the equals char](https://wordpress.org/support/topic/escape-the-equals-char/)
 *  Plugin Author [DannyWeeks](https://wordpress.org/support/users/dannyweeks/)
 * (@dannyweeks)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/escape-the-equals-char/#post-6665056)
 * Hi Stuart,
 * Im glad you like the plugin! It isn’t really possible to store HTML to protect
   against [XSS attacks](https://en.wikipedia.org/wiki/Cross-site_scripting). There
   is however other ways to do it using CWD and customising your theme a little.
 * Similarly to how I have helped [somebody else recently](https://wordpress.org/support/topic/adding-html-3?replies=8)
   you can store the data in CWD and create your own function/shortcode to take 
   advantage of both.
 * If you can give me some specifics about what you plan to do I can help you out
   no problem but the basic premise is:
 * Create a function in your theme’s functions.php file and register it as shortcode
   if you plan to use it as shortcode too. In that function using the CWD functions
   as you wish; just be careful to wrap it in an if statement incase CWD is disabled`
   if (function_exists('cwd_getThe') {}`
 * Danny
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Website Data] Mass deletion?](https://wordpress.org/support/topic/mass-deletion/)
 *  Plugin Author [DannyWeeks](https://wordpress.org/support/users/dannyweeks/)
 * (@dannyweeks)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/mass-deletion/#post-6625547)
 * Out of the box it isn’t possible to mass delete at the moment sorry.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Website Data] Adding HTML](https://wordpress.org/support/topic/adding-html-3/)
 *  Plugin Author [DannyWeeks](https://wordpress.org/support/users/dannyweeks/)
 * (@dannyweeks)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/adding-html-3/#post-6586696)
 * Sorry buddy I have been all over the place the last few weeks!
 * Hopefully this solution will help!
 * Create a new record with a reference of ‘images’ and add the below in the data
   field (just some example data!).
 *     ```
       {
           "hundred": {
               "url": "http://placehold.it/100",
               "alt": "one hundred"
           },
           "thousand": {
               "url": "http://placehold.it/1000",
               "alt": "one thousand"
           }
       }
       ```
   
 * Add the below code to the bottom of your theme’s functions.php file.
 *     ```
       function get_image_element($atts) {
           $imageName = !empty($atts['name']) ? $atts['name'] : null;
           $url = '';
           $alt = '';
   
           if($imageName && function_exists('cwd_getThe')) {
               $img = cwd_getThe('images');
               if(!empty($img[$imageName])) {
                   $url = $img[$imageName]['url'];
                   $alt = $img[$imageName]['alt'];
               }
           }
   
           $format = "<img src=\"%s\" alt=\"%s\">";
           if(!empty($url)) {
               return sprintf($format, $url, $alt);
           }
   
           return null;
       }
   
       add_shortcode('image', 'get_image_element');
       ```
   
 * You should be able to use the new shortcode to output the images.
 * Using the test data you could use `[image name="hundred"]` or `[image name="thousand"]`
 * Any problems mate just let me know and I’ll work through them with you!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Website Data] Adding HTML](https://wordpress.org/support/topic/adding-html-3/)
 *  Plugin Author [DannyWeeks](https://wordpress.org/support/users/dannyweeks/)
 * (@dannyweeks)
 * [11 years ago](https://wordpress.org/support/topic/adding-html-3/#post-6586554)
 * ok no problem, do you need to access them through the php function or a shortcode?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Website Data] Adding HTML](https://wordpress.org/support/topic/adding-html-3/)
 *  Plugin Author [DannyWeeks](https://wordpress.org/support/users/dannyweeks/)
 * (@dannyweeks)
 * [11 years ago](https://wordpress.org/support/topic/adding-html-3/#post-6586538)
 * Can you give an example of the code of what you want to store/display please.
   It might be possible to do it with the current functionality, if not it should
   be possible with a small function.
 * Danny
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Website Data] Namespace problem](https://wordpress.org/support/topic/namespace-problem/)
 *  Plugin Author [DannyWeeks](https://wordpress.org/support/users/dannyweeks/)
 * (@dannyweeks)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/namespace-problem/#post-5873338)
 * Hi miwalter,
 * I have released version 2.1 which no longer uses namespaces. Sorry this has taken
   so long Ive been smashed in work recently!
 * Regarding the session not being able to save I would contact your host as it’s
   very strange that you can’t save to the temp folder. Does this cause issues when
   uploading files?
 * Thanks
    Danny
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Website Data] Namespace problem](https://wordpress.org/support/topic/namespace-problem/)
 *  Plugin Author [DannyWeeks](https://wordpress.org/support/users/dannyweeks/)
 * (@dannyweeks)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/namespace-problem/#post-5872978)
 * Hi Micro,
 * Thank you very much for your interest in CWD. I will do my best to get it working
   for you!
 * This issue has recently came to my attention and I do intend to update CWD to
   support php 5.2.4+ as this is what WordPress supports.
 * Are you able to test a dev version of CWD to ensure it runs smoothly after I’ve
   updated it?
 * Thanks
    Danny
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Website Data] Just installed the plugin and getting "you do not have sufficient privilege…"](https://wordpress.org/support/topic/just-installed-the-plugin-and-getting-you-do-not-have-sufficient-privilege/)
 *  Plugin Author [DannyWeeks](https://wordpress.org/support/users/dannyweeks/)
 * (@dannyweeks)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/just-installed-the-plugin-and-getting-you-do-not-have-sufficient-privilege/#post-5617411)
 * Hey, are you using an administrator account?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Website Data] Error on activation](https://wordpress.org/support/topic/error-activating-plugin-16/)
 *  Plugin Author [DannyWeeks](https://wordpress.org/support/users/dannyweeks/)
 * (@dannyweeks)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/error-activating-plugin-16/#post-5591113)
 * I have released version 2.0.3 which addresses this issue! Let me know if you 
   have any other problems!
 * Danny
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Custom Website Data] Error on activation](https://wordpress.org/support/topic/error-activating-plugin-16/)
 *  Plugin Author [DannyWeeks](https://wordpress.org/support/users/dannyweeks/)
 * (@dannyweeks)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/error-activating-plugin-16/#post-5591006)
 * Hey cancrexo,
 * I’m glad to hear you’ve found the plugin useful on your local server; shame about
   the remote server issue! I have had a look into it and it is a strange one as
   I haven’t come across this before but it is easily fixed. I will put a patch 
   out tomorrow morning which will address this issue and should avoid it entirely.
 * Thanks
    Danny

Viewing 15 replies - 1 through 15 (of 25 total)

1 [2](https://wordpress.org/support/users/dannyweeks/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/dannyweeks/replies/page/2/?output_format=md)