TNG Shortcode Constructor

TNG SHORTCODE CONSTRUCTOR V 1.05A FOR WORDPRESS

TNG SHORTCODE CONSTRUCTOR is a standalone plugin. (Please note that this website does not use WordPress integration)
It works with or without WordPress-TNG integration.
I have added shortcodes from TngApi plugin for WordPress and some of the shortcodes from TngApi-Custom. AS this does not change any data in the TNG database, it should be easy enough to maintain.

Shortcodes In This Release

  • TngWp_birthdays List birthdays for the selected month. View
  • TngWp_danniversaries List death anniversaries for the selected month. View
  • TngWp_familyuser A reconstructed family page from my TngApi plugin. View
  • TngWp_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) View
  • TngWp_LandingPage This is similar to ‘TngWp_gone’ but has user name, birthdays, marriage anniversaries and death anniversaries added. View  
  • TngWp_manniversaries List of marriage anniversaries for the selected month. View
  • TngWp_manniversariesDeceasedwhich Calculates years between marriage and first death. View
  • TngWp_RandomMedia displays random default photo ( of deceased) OR headstones or link to a document View
  • TngWp_RandomPhoto default photo ( of deceased ) OR Image set as Always ON View
  • TngWp_MyShortcode Template for adding your own shortcode
  • TngWp_submitImage Upload images from WordPress. Image will be stored in a TNG Media Collection specified by you. View

TNG Names Search search widget
The widget requires a WordPress page to display search results. To create the page, navigate to Settings>TNG Shortcodes and enter a page name (slug). A WordPress page will be created when changes are saved.
Widget will only be activate if a WordPress page for the widget is created.

Setup
* Plugin should work with all versions of TNG as it obtains its credentials from TNG setup.
* Plugin shares it’s variables with TngApi.

WordPress Integration
This Beta test site does not use WP Integration.

My WordPress Plugins
* TNG API
* TNG Shortcode Costructor and
* WordPress – TNG Login Widget
would work with or without WordPress – TNG integration.

You may download latest version, V 1.05A, here.
The code is licenced under the MIT licence

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

Shortcodes In This Release

  • TngWp_birthdays List birthdays for the selected month. View
  • TngWp_danniversaries List death anniversaries for the selected month. View
  • TngWp_familyuser A reconstructed family page from my TngApi plugin. View
  • TngWp_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) View
  • TngWp_LandingPage This is similar to ‘TngWp_gone’ but has user name, birthdays, marriage anniversaries and death anniversaries added. View  
  • TngWp_manniversaries List of marriage anniversaries for the selected month. View
  • TngWp_manniversariesDeceasedwhich Calculates years between marriage and first death. View
  • TngWp_RandomMedia displays random default photo ( of deceased) OR headstones or link to a document View
  • TngWp_RandomPhoto default photo ( of deceased ) OR Image set as Always ON View
  • TngWp_MyShortcode Template for adding your own shortcode
  • TngWp_submitImage Upload 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