Jump to content
TNG Community
fluffy82

use different CSS style sheet

Recommended Posts

fluffy82

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

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
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

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.

image.png

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
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.

image.png

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
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
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

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×