Jump to content
TNG Community

Integrating Wordpress with TNG (other than mod or Kloosterman method)


Mike H

Recommended Posts

I have been a TNG user for many years along with Wordpress, in the past I have used the TNG Wordpress mod before it was a mod and I have used the Kloosterman method for integration.

It had been at least ten years that I have used the same WP/TNG design. After I had upgraded to TNG 14 from TNG 9 and I saw some great TNG themes had been added, I decided to look for a way to integrated WP into TNG rather than trying to fit TNG into WP.

 Now because of the ease of adding new pages to TNG, I only needed WP to display posts. After some searching I found an easy method to display my WP posts in a TNG theme. I’ll explain that later.

While it may not have been necessary, I did a clean install of the latest version of TNG. I added 3 folders to my TNG installation, one: I called “blog” but it could be named anything. I installed a new copy of Wordpress into the /blog folder. I only imported my prior posts into my new WP install but no longer needed pages or media. The second folder was called “mypages” and the third was called “myphotos”.  After I uploaded my Gedcom and media, I began making all the pages I wanted and placed them in “mypages” folder. The images I used for my new pages were placed in the “myphotos” folder. Template 21 is a great design has many areas to add links and photos, though any template can be used. I used it to add the appropriate links and page names to the template setup.

All the new pages I created were made using the file historytemplate.php located in the root TNG folder. I used one of those pages to import WP posts to my TNG site. While I could have added the WP posts to any page I chose to set up a page called articles.

To add Wordpress to TNG do the following.

At the top of any page you choose after:

$cms['tngpath'] = "../";

include( "../tng_begin.php");

if( !$cms['support'] )

$cms['tngpath'] = "../";

Enter the following:

define('WP_USE_THEMES', false);

require('../Your wp Folder/wp-blog-header.php');   

In the body where you would normally add text add the following:

<?php

$posts = get_posts('numberposts=10&order=DSC&orderby=post_date');

foreach ($posts as $post) : setup_postdata( $post ); ?>

<?php  echo "<span>".$recent_post['post_date']."</span> <br>";?>

<?php the_date(); echo "<br />"; ?>

<?php the_post_thumbnail(); ?>

 

I added some additional styling and layout using CSS in mytngstyle.css

I feel the advantage of adding Wordpress with this method is TNG is driving the design not a Wordpress theme.

All the above WP integration information is available on https://codex.wordpress.org/Integrating_WordPress_with_Your_Website 

 

Mike H

https://hartfamilyhistory.com

 

Link to comment
Share on other sites

Hi Mike,

Thanks for the effort and for sharing.

I'm not a WP user myself but it might benefit other TNG users.

Can WP plugin's still be used or do we need TNG mods?

Will TNG mods conflict?

Link to comment
Share on other sites

17 hours ago, Rob Severijns said:

Hi Mike,

Thanks for the effort and for sharing.

I'm not a WP user myself but it might benefit other TNG users.

Can WP plugin's still be used or do we need TNG mods?

Will TNG mods conflict?

The above procedure does not effect wp plugin's or TNG mods

 

Link to comment
Share on other sites

  • 11 months later...

I really like this idea!   I am the newly appointed web master for a family association site.  They would like to add more content to the home page and some of the nice stories as part of the website.   Once I get my bearings I will give this a try and see if I have any questions - great idea!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...