DannyWeeks
Forum Replies Created
-
Forum: Plugins
In reply to: [Custom Website Data] Adding HTMLHey,
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 as it might prove very useful to you! A feature you may find useful is Repeater fields.
Danny
Forum: Plugins
In reply to: [Custom Website Data] insert unique refrenceHi,
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
DannyForum: Plugins
In reply to: [Custom Website Data] Adding HTMLOh 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=https://placehold.it/10 alt=ten
So the new record would look like this: 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
In reply to: [Custom Website Data] Adding HTMLHey,
It could be a syntax error in the json causing that issue try to validate 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
In reply to: [Custom Website Data] Escape the equals charGood stuff mate, any other problems just give me a shout!
Danny
Forum: Plugins
In reply to: [Custom Website Data] Escape the equals charHi Stuart,
Im glad you like the plugin! It isn’t really possible to store HTML to protect against XSS attacks. 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 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
In reply to: [Custom Website Data] Mass deletion?Out of the box it isn’t possible to mass delete at the moment sorry.
Forum: Plugins
In reply to: [Custom Website Data] Adding HTMLSorry 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": "https://placehold.it/100", "alt": "one hundred" }, "thousand": { "url": "https://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
In reply to: [Custom Website Data] Adding HTMLok no problem, do you need to access them through the php function or a shortcode?
Forum: Plugins
In reply to: [Custom Website Data] Adding HTMLCan 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
In reply to: [Custom Website Data] Namespace problemHi 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
DannyForum: Plugins
In reply to: [Custom Website Data] Namespace problemHi 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
DannyHey, are you using an administrator account?
Forum: Plugins
In reply to: [Custom Website Data] Error on activationI have released version 2.0.3 which addresses this issue! Let me know if you have any other problems!
Danny
Forum: Plugins
In reply to: [Custom Website Data] Error on activationHey 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