TNG SHORTCODE CONSTRUCTOR V 1.05A FOR WORDPRESS
TNG SHORTCODE CONSTRUCTOR is a standalone plugin. I have added shortcodes from TngApi plugin for WordPress and some of the shortcodes from TngApi-Custom and as it does not change any data in the TNG database, it should be easy enough to maintain.
Download: You may download latest version, V 1.05A, here.
License: The code is licenced under the MIT licence
This allows you to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so.
Introduction
TNG Shortcode Constructor is a stripped down version of The TngApi V3.3 plugin for WordPress.
TngApi V3.3, a stand-alone plugin, was published in 2015. It integrates smoothly with TNG (The Next Generation of Genealogy Sitebuilding) to display genealogy data in WordPress pages. It’s main attraction was the ability of the user to add / amend family data and ability of the administrator to perform one-click transfer of this data to tng database. With changes to MySQL and TNG database structure, I have found it virtually imposible to support this feature.
I understand that, now, a TNG mod, the Family Group Worksheet , has the facility for administrators to merge data in to TNG database.
Plan is to have the TNG Shortcode Constructor do everything the TngApi did, except update TNG data.
- It implements Privacy Credentials in the TNG General SetUp>Privacy
- Require Login:
- Show Living Data:
- Show Names for Living:
- Show Names for Private:
- I may implement the following in the next update
- Show LDS Data: Current shortcodes do not show LDS data, as do not have LDS data my database.
- Restrict access to assigned tree. As I only have one tree,
- I have not implemented this. Perhaps on next version.
- It implements Privacy Credentials for the User
- Allow User to view information for living individuals
- Allow User to view information for private individuals
- I may implement the following in the next update
- Allow User to view LDS information
- Restrict User access to specific trees and branches.
Setup
The plugin should work with all versions of TNG.
-
Plugin obtains it’s credentials from TNG setup.
-
Plugin shares it’s variables with TngApi
-
Plugin Settings are in WordPress Admin>Settings
-
The variables are
- TNG Root Path: TNG Root Path is the absolute path to TNG. You may look this up from TNG Admin Setup or config.php ($rootpath) in TNG folder.
- URL to TNG Folder: TNG URL is path to TNG (http://www.mysite.com/tng). You may look this up from TNG Admin Setup or config.php ($tngdomain) in TNG folder.
- TNG Photo Folder: Name of TNG Photo Folder. Derived from TNG setup.
- TNG Integration Path Enter TNG folder name here. If you are using WordPress Integration by Mark Barnes, enter the name of the page you have specified to display TNG pages within WordPress container. Otherwise enter name of TNG folder.
- TNG Collection ID for Photo Uploads: User images are uploaded in to one of TNG folders with the collection name specified by you in the admin set up. Enter the name for the collection you have set up in TNG admin > media. Mine is called “My Uploads”.
Important Variable is the TNG Root Path. If it can not find the TNG file it will complain, bitterly.
Tested on
- WordPress platform: 6.xx
- PHP version 7.xx and 8.01
- WP-TNG Integration
- Mike Barnes Method using a Stripped Down tng.php
- Kloosterman method
- Alongside my plugins, TngApi V3.3.2 and tng-wp-login v3.1.3.beta
Shortcodes In This Release
TngWp_birthdaysList birthdays for the selected month. ViewTngWp_danniversariesList death anniversaries for the selected month. ViewTngWp_familyuserA reconstructed family page from my TngApi plugin. ViewTngWp_gone(Gone But Not Forgotten). Gives birth dates and deat hdates for yesterday, today and tomorrow. It is encapsulated in a DIV and it may be possible to include that in your content. ( I have used similar in my Home Page) ViewTngWp_LandingPageThis is similar to ‘TngWp_gone’ but has user name, birthdays, marriage anniversaries and death anniversaries added. ViewTngWp_manniversariesList of marriage anniversaries for the selected month. ViewTngWp_manniversariesDeceasedwhich Calculates years between marriage and first death. ViewTngWp_RandomMediadisplays random default photo ( of deceased) OR headstones or link to a document ViewTngWp_RandomPhotodefault photo ( of deceased ) OR Image set as Always ON ViewTngWp_MyShortcodeTemplate for adding your own shortcode
TngWp_submitImageUpload images from WordPress. Image will be stored in a TNG Media Collection specified by you. View
Search Widget
Added Legacy Widget, TngWp_search which searches names in TNG database.
- The widget requires a WordPress page to display search results.
- Page Name, “TNG Name Search”, which is same as Widget name, is defined in /widget/TngSearch.php
- The widget obeys credentials setup in TNG admin.
- To create the WordPress page, navigate to Settings>TNG Shortcodes and enter a page name (slug) such as tng-search. Do not leave blanks
- A WordPress page will be created, with shortcode as content, when changes are saved.
- Do not leave space between words such as “tng search”
- Avoid using “search” as page name as this may clash with the widget in TngApi.
- Widget will only be activate if a WordPress page for the widget is created and page name is shown in the Plugin Paths.
- Note: I use a WordPress Classic Widget Plugin to work in the Widget area. Makes it very easy to work with Legacy Widgets.
Add Your Own Shortcode
- Create a file for your page. (e.g. myShortcode.html.php)
- Create a file with the class for the shortcode (e.g. myShortcode.php)
class TngWp_Shortcode_MyShortcode extends TngWp_Shortcode_AbstractShortcode
{
const SHORTCODE = 'TngWp_MyShortcode'; //This is your shortcode name
public function show()
{
// This may best place to define general variables.
//Array $conext will be available in your page.
$context = array(
);
//This html file will show your page
return $this->templates->render('myshortcode.html', $context);
}
}
-
Add Short code class in the plugin file tng-shortode-constructop.php
$content->addShortcode(new TngWp_Shortcode_MyShortcode()); -
Hopefully, that Should work
Patches & contributions
This is very much a project that can evolve so please feel free to fork and submit pull requests.
I would really love to have your feedback, so if you download, let me know. Thanks.