fluffy82 0 Report post Posted March 6, 2019 Here I am again, looking for your advise trying to realise my extensive TNG/Wordpress mix... As I mentioned in another thread, I got sick and tired of overruling some CSS lines 15 times. My OCD was playing up seeing all those scratched out references. It was also a gamble each time to see which rule would overrule which. The goal was to make the TNG pages look like they come from my WordPress theme (which I use with the Kloosterman method, by the way). The best, easiest and cleanest way to do that, I discovered, is to empty the genstyle and mytngstyle files. Changing things within the (online) WordPress customizer has an effect on the TNG pages, so I figured that if there's nothing in the native TNG style sheets, they would take everything from WordPress. That works wonderfully well. The only thing I had to do, is add the missing references (for ID's and div's that are only in TNG) into the customizer. The greatest advantage is that I can do it all in realtime, online, from whatever computer. I don't need to install Filezilla, download the style sheet, change something, upload it, refresh the page, and see if it works. The other advantage is that there is minimal overruling. Every element has only one style to listen to. Yay. Now the problem. Apparently, while the TNG pages take over the WordPress style sheet perfectly, the admin part of TNG doesn't... I tried adding the admin specific lines into the WordPress customizer, but that didn't help. When I added the lines (only these admin lines) to mytngstyle, it had an effect. The problem is that the admin pages also use style code that's meant for "normal" user pages so only copying the admin specific lines isn't sufficient. I also need "general" code to be included there. At first I thought that - once the site styling finished - I could copy the code I added in the WP customizer into mytngstyle (or genstyle). That works for the admin pages and the TNG pages on the website, but the problem is that the non-TNG pages in WP don't use that so all changes there are lost. There are two solutions, one of which I don't like, the other I don't know if it's possible... 1) the one I don't like: copy the code into genstyle AND keep it in the customizer; that will make the 3 parts of the site work (WP, TNG, admin), but results in dozens of lines overruling other lines which, in fact, are exactly the same. 2) my preferred solution, but I don't know if it's possible: make TNG admin use the WP style sheet rather than genstyle/mytngstyle. It would then be sufficient to add the admin specific lines into the customizer to make it work. I know you can choose the style sheet for tabs, but I don't see that option for the general css. I had a look, and I think it should be possible to just change adminlib.php to achieve this, but before I do that I want someone else's opinion on it... Though the MOD manager can revert any changes and I always keep a backup of the file I change before doing so, I really don't want to do something that could break my site.In adminlib.php, would it be sufficient to change {$cms['tngpath']}css/genstyle.css?v=$tng_version into the path to my WordPress css? And the same for mytngstyle into the customized css file? Thanks for any hints! Tom Share this post Link to post Share on other sites
KevyNC 0 Report post Posted March 21, 2019 Thanks for asking this question -- I have a similar scenario but have not yet explored the Wordpress Customizer. Hopefully someone replies with a solution. Have you found a solution yet? Thanks, Kevin Share this post Link to post Share on other sites
fluffy82 0 Report post Posted March 21, 2019 2 hours ago, KevyNC said: Thanks for asking this question -- I have a similar scenario but have not yet explored the Wordpress Customizer. Hopefully someone replies with a solution. Have you found a solution yet? Thanks, Kevin The customizer works like a charm. I still do it the way I explained: I emptied the genstyle.css and mytngstyle.css (apart from the parts used by MODS as otherwise they will show as "partially installed") and the website automatically uses the WP theme's stylesheet and the modifications through the customizer. Some lines specific to TNG must be added manually, but once that's done you're off. I don't have a solution yet for the admin pages, I'm too afraid of making the changes mentioned above and breaking the site. I don't often use the admin part anyway. It serves for uploading my gedcom, and maybe geolocate some new places, and that's it. What I do now, is copy the content of the original genstyle.css into a file I called "mytngstyle_admin.css", which remains on my server. Whenever I need to work in the admin part, I change the name temporarily to mytngstyle.css to make it work, I do my thing, and revert it to mytngstyle_admin.css It's maybe not the most elegant solution, but it works for now. Share this post Link to post Share on other sites
KevyNC 0 Report post Posted March 21, 2019 I am still trying to figure what is the best solution to what I want to accomplish. I may need to implement some of your solutions. I like the way you have the "lists" working. https://huygens-vandemoortel-ancestry.be/ Also the birthdays and deaths. I was not able to get more than one working. I do not want multiples displaying in same side widget. I think I need to refer back to other posts where you describe this. My site still has not gone live because of some of these remaining issues. Mostly related to the main/home/landing WordPress pages. I have hidden the 404 errors when navigating to the TNG areas, but for SEO it would be better if could be tracked as intended. You seem to have struggled, but yet got most things working the way you want (even if it has taken awhile). Kevin Share this post Link to post Share on other sites
fluffy82 0 Report post Posted March 22, 2019 4 hours ago, KevyNC said: I am still trying to figure what is the best solution to what I want to accomplish. I may need to implement some of your solutions. I like the way you have the "lists" working. https://huygens-vandemoortel-ancestry.be/ Also the birthdays and deaths. I was not able to get more than one working. I do not want multiples displaying in same side widget. I think I need to refer back to other posts where you describe this. My site still has not gone live because of some of these remaining issues. Mostly related to the main/home/landing WordPress pages. I have hidden the 404 errors when navigating to the TNG areas, but for SEO it would be better if could be tracked as intended. You seem to have struggled, but yet got most things working the way you want (even if it has taken awhile). Kevin I'd be happy to share my code if you'd want it. Mind you, the "title", the list and the table take their make-up from my theme, so they might turn out looking quite different on your website. You'll have to play around with the html part of it. For the birthdays, I'm using the plugin that was once provided by Heather but seems to have become unavailable... The scripts (written by Roger?) never worked on my page. If I remember correctly, the births worked, but not the marriage anniversaries or deaths. So sadly I can't help you with that. Share this post Link to post Share on other sites
KevyNC 0 Report post Posted March 22, 2019 17 minutes ago, fluffy82 said: 'd be happy to share my code if you'd want it. Mind you, the "title", the list and the table take their make-up from my theme, so they might turn out looking quite different on your website. You'll have to play around with the html part of it. For the birthdays, I'm using the plugin that was once provided by Heather but seems to have become unavailable... The scripts (written by Roger?) never worked on my page. If I remember correctly, the births worked, but not the marriage anniversaries or deaths. So sadly I can't help you with that. That would be great. I tried to find Heather's code, but it appears she either removed the code or a website update has made it unavailable and I could not locate it elsewhere. Yes, I also tried getting Roget's code to work....after some playing I believe I was able to get each functioning individually but not all 3 on same page at same time. I believe I should be able to manipulate the HTML code to get the desired look for my site. You can either share here or message me. Thanks again Kevin Share this post Link to post Share on other sites
theKiwi 0 Report post Posted March 22, 2019 51 minutes ago, KevyNC said: That would be great. I tried to find Heather's code, but it appears she either removed the code or a website update has made it unavailable and I could not locate it elsewhere. Yes, I also tried getting Roget's code to work....after some playing I believe I was able to get each functioning individually but not all 3 on same page at same time. I believe I should be able to manipulate the HTML code to get the desired look for my site. You can either share here or message me. Thanks again Let me preface this by saying that I'm using the TNG-WordPress plugin... On both my sites (one is WordPress 4.9.10, the other is now on 5.2beta) all of the scripts will run if they are called in succession in a single Enhanced Text Widget, but I have never been able to figure out why you can't have more than one widget with the scripts in - it's something about accessing the WordPress database interspersed with accessing the TNG database, but I've never figured out exactly what the problem is. I have not tried using a single database for both TNG and WordPress - I don't know if that would make a difference or not. Also I don't really know if the plugin causes a different behaviour than using the Kloosterman method does in terms of interactions between scripts and database(s) - it shouldn't because the plugin isn't directly involved in displaying a non-TNG page where the widgets are display, but the plugin is in play somehow because the functions that start with "mbtng_" are only defined in the plugin code. Roger Share this post Link to post Share on other sites
KevyNC 0 Report post Posted March 22, 2019 FWIW -- I am running Wordpress 5.1.1 and PHP 7.2.16. Also MySQL 10.1.38. It did not appear I was successful in getting the Plugin to work when I tried in the past. Also I use the Woody Plugin (which I believe is newer). Curious if a single database would make a difference. My knowledge is very limited so I can only speculate and/or ask questions. not sure if Functions would have anything to do with it. I might also be confused on sites that I have seen and not understand which method they have used when I viewed them. Roger, Thanks for the info. Kevin Share this post Link to post Share on other sites
theKiwi 0 Report post Posted March 22, 2019 25 minutes ago, KevyNC said: not sure if Functions would have anything to do with it. Some of the posts I've seen here, including made by me have the code that I have put into the Enhanced Text Widget. When I created this, I was assuming use of the TNG-WordPress plugin , so things like this section $path = get_option('mbtng_path'); chdir ($path); $wp_tng_path = get_option('mbtng_url'); include ("userscripts/list_birthdays.php"); mbtng_close_tng_table (); if being used on a site that does NOT have the plugin... the first line would fail since mbtng_path is a setting created by the plugin So the second line would fail because $path is undefined the third line would fail because the mbtng_url is a setting created by the plugin probably the 4th line would fail because WordPress doesn't know where to look for "userscripts" the last line would fail because the function mbtng_close_tng_table is only defined in the plugin. Roger Share this post Link to post Share on other sites
KevyNC 0 Report post Posted March 22, 2019 The code I use that (mostly) works is: echo ("Upcoming Birthdays"); global $wp_tng_path, $link; $path = "/home/alvesla1/public_html/tng1203/"; chdir ($path); $wp_tng_path = "tng1203"; include ("userscripts/list_birthdays.php"); ?> The first line is not necessary but I left in to test if it was executing. without modification to other PHP's I will get this message although results are displayed " Warning: session_start(): Cannot start session when headers already sent in /home/alvesla1/public_html/tng1203/begin.php on line 2 " Similar to below. I can get all 3 (or so ) scripts working on same page but it appears only if they are on the same snippet code for whatever reason. The code below displays the results as expected except for the begin session error. I modified the Begin.php around line 28 // modified to check if session already started if (session_status() == PHP_SESSION_NONE) { session_start(); } but I still get error. Warning: session_start(): Cannot start session when headers already sent in /home/alvesla1/public_html/tng1203/begin.php on line 28 However the lists do display. echo "<br>"; echo ("Upcoming Birthdays"); global $wp_tng_path, $link; $path = "/home/alvesla1/public_html/tng1203/"; chdir ($path); $wp_tng_path = "tng1203"; include ("userscripts/list_birthdays.php"); echo "<br>"; echo ("Upcoming Anniversaries"); global $wp_tng_path, $link; $path = "/home/alvesla1/public_html/tng1203/"; chdir ($path); $wp_tng_path = "tng1203"; include ("userscripts/list_anniversaries.php"); echo "<br>"; echo ("Upcoming Deaths"); global $wp_tng_path, $link; $path = "/home/alvesla1/public_html/tng1203/"; chdir ($path); $wp_tng_path = "tng1203"; include ("userscripts/list_deaths.php"); ?> With my limited knowledge and understanding I can only guess that might have to to do with the multiple PHP that are begin included and/or maybe the order they are being loaded on the page. Share this post Link to post Share on other sites
theKiwi 0 Report post Posted March 22, 2019 I don't know what to say... On my testing site, with the TNG-WordPress plugin disabled, this code in the Enhanced Text Widget <?php global $wp_tng_path, $link; $path = "/Library/WebServer/Documents/TNG_WordPress/tng_12.0/"; chdir ($path); $wp_tng_path = "tng_12.0"; echo "<strong>Today's Events</strong><br /><br />"; include ("userscripts/list_birthdays.php"); echo "<br />"; include ("userscripts/list_anniversaries.php"); echo "<br />"; include ("userscripts/list_deaths.php"); ?> produces this output, without any errors It also works with the plugin enabled, since I guess now it's not dependant on anything that is in the plugin, but dealing directly with TNG from WordPress. http://tngwp.lisaandroger.com/ This site is on WordPress 5.2alpha, TNG 12.1, PHP 5.6 Roger Share this post Link to post Share on other sites
KevyNC 0 Report post Posted March 22, 2019 That would seem to point to a plugin issue I would think. Thoughts? [Edit] another plugin might be causing / contributing to the "error" Also I am not using the Enhanced Widget -- I am using the Woody plugin (which I thought replaced the Enhanced widget Kevin Share this post Link to post Share on other sites
theKiwi 0 Report post Posted March 23, 2019 So after an hour or so futzing around, I have installed the Woody snippets plugin, and pasted my code for the 3 widgets into it. When I add it to a Post, it works in the post to display the 3 sets of events (Birthdays, Anniversaries, Deaths) in the post, but then the list in the right sidebar coming from the Enhanced Text Widget fails with the "TNG is not communicating with your database....." error. As soon as I hide the post, then the sidebar works again. I removed the Enhanced Text Widget and replaced it with the regular Text Widget and put the Woody snippet into that. It works IF the post with the Woody Snippets isn't showing (set back to Draft), but if I Publish the post with the Woody Snippet in it, then the list of Birthdays, Anniversaries, Deaths shows in the post, but then the Widget fails So clearly something is stopping this all working more than once on a single page, but I have no idea why, or where to start looking. You can see this here on my testing site - on the home page with the Post showing, the events are listed in the post, and the sidebar has failed. http://tngwp.lisaandroger.com/ Click on any other tab apart from Genealogy and you'll see then the sidebar works. And note - no errors anywhere... Roger Share this post Link to post Share on other sites
KevyNC 0 Report post Posted March 23, 2019 9 hours ago, theKiwi said: I removed the Enhanced Text Widget and replaced it with the regular Text Widget and put the Woody snippet into that. It works IF the post with the Woody Snippets isn't showing (set back to Draft), but if I Publish the post with the Woody Snippet in it, then the list of Birthdays, Anniversaries, Deaths shows in the post, but then the Widget fails So clearly something is stopping this all working more than once on a single page, but I have no idea why, or where to start looking. Roger, thank you very much for your hard word trying to figure this out. I feel less crazy. However, that is puzzling. Maybe it has with widgets vs. putting shortcode in regular text box etc? This is helpful, hopefully I will be able to find a solution with this information. Thanks again! Kevin Share this post Link to post Share on other sites