RickM 0 Report post Posted August 6 Hey Mahesh Drew and Martin, and others who might be thinking about this. Expertise is something none of us seem willing to say we have.. Fair enough too, yet we are all clever in some way, some can program, some can cobble together a little of this and that, others like me can hack away at something and MAYBE get the result wanted.. <smile>.. My point we can if we want make this something.. I am happy to work with everyone to achieve something that might integrate with WordPress and extend the reach of TNG. @Mahesh Re the marriage suggestion, what about a toggle?? If that is not something easy then a second shortcode might be fine!! Share this post Link to post Share on other sites
mahesh 0 Report post Posted August 8 Thanks a lot for headsup, @RickM . On 8/6/2022 at 7:38 AM, RickM said: @Mahesh Re the marriage suggestion, what about a toggle?? If that is not something easy then a second shortcode might be fine!! Okay, here's my first contribution of first customized shortcode, as you suggested. Having a toggle is bit too complicated for me so I have just added a column. Below are instructions which are also included inthe attachment as a pdf file. Content of TngWp_manniversariesDeceased_1.pdf TNG Shortcode Constructor FOR Wordpress. Marriage Anniversaries – Calculate years between marriage and first death. Shortcode = TngWp_manniversariesDeceased I am going to try this work flow. Let us hope that this work flow for adding and testing a new shortcode will work for us. Please shout out if there’s a better way. Rather than upgrading the version with new shortcode to test it, we can try out the new shortcode, here, we can make changes, and if it all works, it can be added to the plugin. Download the zip file, TngWp_manniversariesDeceased.zip. There are 5 files in zip file, including this PDF TngWp_manniversariesDeceased_1.pdf: This pdf file tng-shortcode-constructor.php: Replace the current file with this file in the root of the plugin. This new file registers (in line 76) the new shortcode class. ShortcodeContent.php: Replace the current file in TngWP folder with this file. The new file modifies the SQL (lines 606-612) to include ‘deathdates’ in the result. ManniversariesDeceased.php: Add this new file in TngWp/Shortcode folder. This file defines the new class (line and the name of the shortcode (line 10). Shortcode is TngWp_manniversariesDeceased manniversaries-deceased.html.php: Add this new file in the templates folder. This is the HTML file which deals with the page display and individual calculations. Table headers are from line 92-97. I have added an extra column, line 97, with header title “Years - First Death”. This displays years between marriage date and first death. Feel free to suggest changes in header titles. For test purposes, this column will display “Living” if both spouses are living. I will remove that in final version. For this column, header is defined in line 97 and data is defined in line 225. I have retained the column, Years since marriage. For this column header is defined in line 96 and data is defined in line 224. Calculations for the dates are done in lines 135 – 197. One my many weaknesses is date calculations in PHP. So if you see an error please do let me know. Feel free to experiment and make changes in this file. If it all goes pear shaped, just replace the relevant file - no worries. Let us know how you get on. Thanks. Mahesh TngWp_manniversariesDeceased.zip Share this post Link to post Share on other sites
mahesh 0 Report post Posted 10 hours ago On 8/8/2022 at 5:14 PM, mahesh said: Thanks a lot for headsup, @RickM . Okay, here's my first contribution of first customized shortcode, as you suggested. Having a toggle is bit too complicated for me so I have just added a column. Below are instructions which are also included inthe attachment as a pdf file. gWp_manniversariesDeceased.zip On reflection, the above workflow was far too convoluted to make any sense. So I am not at all surprised that there were no resposes. Let me try another way. I have uploaded the files with the new Shortcode to the repository, ( https://github.com/upavadi/TngApi_shortcodeConstructor ). This will be the developement version 1.03 dev. To test out the new Shortcode, please download the developemnet version here. Latest release version 1.02 is still avalable at https://github.com/upavadi/TngApi_shortcodeConstructor/releases/latest. Feel free to suggest changes to the shortcode, `TngWp_manniversariesDeceased`, here. if you have any other suggestions, do let me know. I am no expert but I will try to work on it. We have some great experts on this forum so if it's beyond me then, I am sure, someone else will be able to help. I would love to know if you do try this out. Thanks. Share this post Link to post Share on other sites