[Resolved] The type attribute

Home Forums Support The type attribute

  • This topic has 28 replies, 3 voices, and was last updated 3 months ago by Maarten.
Viewing 15 posts - 1 through 15 (of 29 total)
  • Author
    Posts
  • #1439903
    Maarten

    Dear support,

    First thanks for this great theme, will buy every year as I love the development and support.
    I do however have some questions:

    1) I am still using a child theme that uses functions.php for some extra functions e.g. removing the URL option for comments and some more stuff

    I did think about using this as plugin but it seems better as child theme as it is only for the theme.

    I do use style.css but these are only 7 lines of css code. My question is, is the render time faster if I skip this extra css file for the child theme and copy the css lines in customizer?

    Would the pull from the custom_html code line somewhere under posts in the database be faster or does that not matter much.

    If I add the css lines to the customizer (global site) it will get saved in the database wp_posts table if I remember correctly.

    Then, because I still use the child theme, I do not add header.php to this child theme as I need to check it every time GeneratePress is updated.

    But would it be possible to remove all the type= attributes from the header.php as this is not needed anymore according to W3C validation for HTML.

    You will see the blow test for JavaScript but if someone does not use Autoptimize it will say type=”text/css”

    If I remove all these tags from header.php the warnings in the validation test are removed.

    Here is the link for GP:
    https://validator.w3.org/nu/?doc=https%3A%2F%2Fgeneratepress.com%2F

    As you can see, these are still for JavaScript and can also be omitted from the line of code, same for Stylesheet type=”text/css”

    I know this works as other thems I tested have removed these tags as well. E.g. kadence

    For now I do not see any reason to hack the theme part header.php or other official theme files and thought it would be a good idea to just ask here.

    Thanks a lot!

    #1440123
    Elvin
    Customer Support

    First thanks for this great theme, will buy every year as I love the development and support.

    We really appreciate you saying that. 🙂

    I do use style.css but these are only 7 lines of css code. My question is, is the render time faster if I skip this extra css file for the child theme and copy the css lines in customizer?

    Would the pull from the custom_html code line somewhere under posts in the database be faster or does that not matter much.

    Loading less files is always better. To be honest, if its possible, it’d be great if you didn’t have to use a child theme and just use Code Snippet plugin for your PHP codes and Additional CSS for your custom CSS codes.

    If I add the css lines to the customizer (global site) it will get saved in the database wp_posts table if I remember correctly.

    Correct.

    But would it be possible to remove all the type= attributes from the header.php as this is not needed anymore according to W3C validation for HTML.

    Definitely, 100% possible.

    You can try this PHP code:

    add_action( 'after_setup_theme', function() {
    add_theme_support( 'html5', [ 'script', 'style' ] );
    });

    I’ve already tested this code via Code Snippet plugin.(no child theme)

    This PHP code will remove all the type attributes from <script> and <style> tags on the entire page.

    For now I do not see any reason to hack the theme part header.php or other official theme files and thought it would be a good idea to just ask here.

    Its not recommended to play around with official theme files as it’ll probably cost you more trouble than help you especially if you don’t have a good grasp of how it fully works.:)

    Let us know if this works for you.:)

    A wise man once said:
    "Have you cleared your cache?"

    #1446272
    Maarten

    Dear Elvin,

    Thanks again for your GREAT support. This is what I mean, you people give support that is practical and useful and complete.

    When my email list is big enough and ready for it, I will tell them to get GP premium for sure.

    The thing with the Child theme was easy as it is ready when WP has been setup.
    Meaning I do not have to open customizer and add the CSS.

    But as I see Yoast SEO is doing the same thing now (Adding Meta data to database and saying it speedsup load time) I was wondering the same.

    I did write my own Performance Plugin for WP. It just has all the parts I like removed from HTML. The only thing I do not remove anymore is profile link.

    The old profiel link that is/was used for I think Friends Network and some old schema. I can only remove it using PHP preg_replace and since that does take some time it might slow down the load.

    Also I have the feeling GoogleBot is looking for this head tag as it 100% indicates to it that WordPress has been used as normal HTML sites or Wix do not have this tag.

    Thanks for the code I could add it to my speedup plugin.

    The other reason for the Child Theme:

    1) CSS is just used for GeneratePress to style some elements
    2) Functions has only 20 functions used for GeneratePress

    And as I have build my own WP Builder it loads this Child theme when done installing WP on my local server and automatically loads disclamer and privacy pages into the footer bar.

    I wrote custom_html but after looking it is I think custom_css that is used in a post beloning to customizer from WP

    If I export the settings in GP Premium it does not save this CSS code. That would be nice maybe if possible in the future.

    Also it does not remember the Meta Data settings for the Post/Blog.

    When I remove all Meta data from the post/article and have it just show the Title of the page and then export JSON in Premium and build a new 100% identical site using my offline WP builder it does not load these settings.

    It does load the settings for blog page/ archive but not for the post meta data. No idea why this is.

    But thanks a lot for you code and reply!

    Regards.

    #1446443
    Elvin
    Customer Support

    Thanks again for your GREAT support. This is what I mean, you people give support that is practical and useful and complete.

    That means a lot to us. We really appreciate it.

    When my email list is big enough and ready for it, I will tell them to get GP premium for sure.

    We’ll look forward to it. Thanks a lot.

    The thing with the Child theme was easy as it is ready when WP has been setup.
    Meaning I do not have to open customizer and add the CSS.

    That actually makes a lot of sense. There’s no “one way” of doing things.

    I wrote custom_html but after looking it is I think custom_css that is used in a post beloning to customizer from WP

    If I export the settings in GP Premium it does not save this CSS code. That would be nice maybe if possible in the future.

    Oh yes this was asked a few times. And the only way to get it was manually copying.

    If you have any ideas or feature requests, you can visit the github page. Tom is always accommodating with these things.

    Also it does not remember the Meta Data settings for the Post/Blog.

    You mean for exports? If you’re exporting that too, I believe you can just use the Tool > Export native to WordPress. And I’m not exactly sure but doesn’t Yoast do this too?

    When I remove all Meta data from the post/article and have it just show the Title of the page and then export JSON in Premium and build a new 100% identical site using my offline WP builder it does not load these settings.

    It does load the settings for blog page/ archive but not for the post meta data. No idea why this is.

    At this point, with so many things added to your site (custom child theme, custom functions, homebrewed WP builder, etc) it’s difficult to know which ones causes this.

    While this may be tedious, I’d say make more sandbox sites and remove things piece by piece to see what causes this. As the saying goes, this will “hit two birds with one stone” as you’ll be debugging while getting an idea of what to remove. (in context of any redundancies like w/ Yoast)

    But thanks a lot for you code and reply!

    No problem, we’re always glad to help.:)

    Cheers.

    A wise man once said:
    "Have you cleared your cache?"

    #1447031
    Maarten

    Oh yes this was asked a few times. And the only way to get it was manually copying.

    If you have any ideas or feature requests, you can visit the github page. Tom is always accommodating with these things.

    Yes, I will check the export en import tool build by Beaver Builder team. They have the export and import build into customizer using a plugin, and that way they do capture all CSS settings. I think they just pull them from wp_posts that has the custom_css line of code. Easy for Tom to build into JSON exporter I think.

    You mean for exports? If you’re exporting that too, I believe you can just use the Tool > Export native to WordPress. And I’m not exactly sure but doesn’t Yoast do this too?

    What I ment is the export/import settings in GP Premium.

    It saves all settings for the modules/options in Premium in the backend of WP and I think it gets all option table items used by WP customizer.

    It does backup all these settings but not for single post. I ment with Meta Data not the meta data for a page or post like in Yoast SEO but the Meta Data or maybe is called Author meta for a single post.

    When I do not want to show categories link tag below ever post and open customizer to remove the check-mark and than go back in WordPress and do a JSON export of GP Premium settings and then build a new site and re-import GP Premium JSON -> The check-mark for showing categories, author and Date below every post title is checked again and showing while I did remove the checkmark to have it not show and created a JSON file.

    For the rest, besides custom CSS, all export and import works great for GP Premium. Maybe the code for what to display below single post title is saved somewhere else in MySQL database and not options table.

    Of course I can find this out as I know a bit about MySQL.

    Hope this helps!

    Regards.

    #1447707
    Tom
    Lead Developer
    Lead Developer

    Exporting and importing custom fields from posts is significantly more complicated than Customizer options, unfortunately.

    The best way to get that data is to export the actual content in Tools > Export.

    #1452232
    Maarten

    Thanks Tom. I more thing about CSS. If I need to make a new topic let me know but the question I have is this:

    Because of some great code here I managed to remove all warnings from my site for HTML, that is great. And also all CSS is great but I keep getting 1 error in all.css (i think it is the first line in source of homepage)

    https://ibb.co/wwy0Zdq

    Can I change or and a number to have speak attribute not ‘none’. If i could add say number 1 or 10 it would remove the error I think.

    Thanks for the great support.

    #1452920
    Tom
    Lead Developer
    Lead Developer

    Best thing to do is update to GP 3.0: https://generatepress.com/generatepress-3-0-a-new-era/

    Then choose to use SVG icons in Customize > General.

    #1455085
    Maarten

    Hi Tom,

    Thanks for your reply and solution. I like to respond to the following:

    Exporting and importing custom fields from posts is significantly more complicated than Customizer options, unfortunately.

    The best way to get that data is to export the actual content in Tools > Export.

    I did not mean the meta data of a post. What I mean is the following:

    If I change any setting under blog/post e.g. to not show author name for posts, in my situation it does not seem to save that setting from customizer.

    When I setup customizer after installing and activating GP Premium plugin, and make changes to that blog section and go back to GP premium and click Export settings, than the setting for that part of customizer seems to not be in the JSON backup.

    If i build a new site and re-import that JSON settings after activating GP Premium, it does not have the settings I made in customizer under blog/page/post section.

    Fot archive / blogrol settings that works. Also works to not show e.g. a featured image. That also works but some settings under page/ do not get saved in the exported GP Premium settings file.

    #1455775
    Tom
    Lead Developer
    Lead Developer

    That’s strange, all of the blog options are under one option name in the database which is exported and imported. I’ll try to reproduce this today. Just to confirm, which options seem to be missing? The ones under “Pages”?

    #1456670
    Maarten

    Hi Tom,

    Later today I will do a test and make screenshots if possible for you. Hope that is okay under this topic.
    I will use the default GenegratePress version including Premium and will show you what is happening when I import JSON.

    On my server it does just not to seem to keep the checkmarks set correctly.
    Under blog in customizer, e.g. for every signal post if I do not want to show a link to category and remove that checkmark. It work of course but If I now back a backup in Premium with all options check-marked there and get the settings JSON, it does not export the changes I made in customizer.

    When I now build 100% identical website and re-import that GP premium I just made before and load it and check cutsomizer -> Checkmarks for showing category under every post is back and checked again, while I had it un-checked when making the backup.

    Hope I explain this a bit better now.

    I will test it again using no plugins but yours and GP.

    Regards!

    #1458874
    Tom
    Lead Developer
    Lead Developer

    Got it – is it only those checkboxes you’re noticing this with? I’ll do some tests.

    #1459106
    Maarten

    Hi Tom,

    I just 4 min ago did some tests.

    To build and re-build WordPress on my local server I made a powerful script that has a UI with some fields to download plugins and themes for this install and I can select the WP language. It does much more than this but to give you an idea to show you it will be 100% identical every time I make a site.

    To remove a website I made, I just clean my WP install folder and reset MySQL database empty and start the server again to build a new website.

    I made folders, in these folder I put your generatepress.zip and in the folder named plugins, I put your gp-premium.zip

    When I press Start button it will download WP, Unpack, Install, clean database and then unpack the theme and plugins.

    I now login using my default username and password and normally I follow a procedure to first update all plugins and then activate them all at once. My Builder can do this but I most of the time do not turn on that option as I like to keep control of what’s happening and prefer to load the backend first and than manually do the update.

    I put in my install folders the generatepress theme 2.x version and the latest gp-premium zip.

    After I login:

    1) Activate GP Premium
    2) Make sure my child theme for GeneratePress is active

    (As you see above, my child theme does not do a lot. Just some of your great PHP scrips to have /privacy /disclaimer /contact locations setup in the footer. Handy because my builder makes these empty pages on install so I do not have to do that again after login and saves me a lot of time.

    And some CSS to have hyperlinks in body text, widget text and everywhere else on the site and get underline with hovering and making them blue (
    nice if you could add this to GP Premium in the future for hyperlinks and colors

    ). I need to use this CSS as I did not find a way in Premium to have underlined and blue color hyperlinks, which I prefer to have.)

    3) Go to GP Premium options and select all to have active
    4) I could make a menu now but is not important for this test, WP will now show all pages created in the menu bar for the theme by default

    5) I now visit the website front homepage and click on the Blog menu item
    6) Because my WP builder made a default post, I do not have to make a new post and can open customizer on this post so I can see what effect the check-marks have

    7) Because all options in premium are loaded, I see all options active in customizer

    8) Go to the Blog section for the post. The blogroll/archive check-boxes do get a backup in JSON it is just the single blog section (what to show for every blog page/post)

    9) I now remove all the check-marks for the blog. Not showing author, date, featured image and category link. Just all empty, no check-marks.

    10) I now save these options and go back to WP backend into GP Premium to export these changes

    11) I save this settings JSON file on my PC

    12) Now I reset this WP install and clean everything and make a new setup using my Builder

    13) I login to the new build site and do the same as above, except I now Import the saved settings JSON file

    14) If I now open Blog item and click on my demo article, the date, author and category items are visible again which they should not be as I just saved it without these check-marks for the article

    15) I made sure the import was successful and all the options in GP Premium were selected and check after the import was done and executed and it all is working in the backend.

    16) I recheck, go back to homepage, click on blog page, open my demo content article and click on customizer

    17) Go to the blog section in customizer and yes, the check-marks are indeed selected again.

    These tests have been done with only your plugin, your theme 2.x version and the latest version of WordPress (my builder downloads the latest zip file on every install)

    Any idea why this is happening?

    I could test it using US version but I do not think it makes any difference.

    I did not check MySQL database options to see what is imported when importing the JSON or exporting that file but I do think you push all the wp_options into this JSON file if I understand what is happening correctly.

    Hope this helps.

    Regards.

    #1460197
    Tom
    Lead Developer
    Lead Developer

    Thanks for the extensive debugging! I tried this and it seemed to work. Any chance you can share the exported .json file with me?

    #1460880
    Maarten

    Thanks. Well could it be my browser? I am using the latetst Chrome version I think, I could try Firefox as well. I need to find a location to upload the file.
    Does it contain any private data or just some options for GP-Premium, is just options I will find a place to upload it and share it.
    I will make 2 ones. 1 Without the options selected and one with it selected.

Viewing 15 posts - 1 through 15 (of 29 total)
  • You must be logged in to reply to this topic.