- This topic has 8 replies, 2 voices, and was last updated 5 years, 4 months ago by
Elvin.
-
AuthorPosts
-
November 29, 2020 at 12:50 pm #1557138
Mr Calvert
Can you help me function to remove javascript one by one in this list?
generate-main-js
navigation-search.min.js
back-to-top.min.js
I want to remove that to test effect. I think I not use navigation-search and back-to-top, can you give me function to remove that and CSS of its?November 29, 2020 at 1:31 pm #1557185Elvin
StaffCustomer SupportHi,
You can try dequeuing them with this PHP snippet.
add_action( 'wp_enqueue_scripts', 'tu_remove_menu_scripts', 50 ); function tu_remove_menu_scripts() { wp_dequeue_script( 'generate-back-to-top' ); wp_dequeue_script( 'generate-navigation-search' ); wp_dequeue_script( 'generate-main' ); }However, the style for these can’t be easily removed without affecting other things in your site as most styles for your site are added in a single stylesheet.
November 30, 2020 at 9:35 am #1558861Mr Calvert
Yes thanks you so much!!!
November 30, 2020 at 9:39 am #1558868Mr Calvert
Can you help me with code css I need remove CSS of search bar and back to top buttom! I was deactive that js so I want remove css too
November 30, 2020 at 3:16 pm #1559393Elvin
StaffCustomer SupportCan you help me with code css I need remove CSS of search bar and back to top buttom! I was deactive that js so I want remove css too
This is pretty tricky as the search bar and back to top button doesn’t have their own stylesheet file.
Their default CSS styles are added within main.css while their non-default styles from Appearance > Customizer is added inline on
generate-style-inline-csswith again, is combined w/ every other styles.That said, we can’t just dequeue
generate-mainandgenerate-style-inlineas it will also affect other parts of the site.However, you can just override them w/ your child theme or custom CSS added on Additional CSS.
November 30, 2020 at 4:06 pm #1559436Mr Calvert
And the last question. I was check in blog and category I see it have new js file auto call is list:
jquery.js
infinite-scroll.pkgd.min.js
scripts.min.js
And this javascript I see it call in header: script id=’generate-blog-js-extra’
And
script id=’generate-classlist-js’
Have any function or turn off that? I want turn off that for testing! Can you help me that function?November 30, 2020 at 4:54 pm #1559471Elvin
StaffCustomer SupportYou can remove jquery by dequeuing it,
wp_dequeue_script( 'jquery' );.I don’t recommend doing this though. Some plugins may be using this library as well.
generate-classlist-jsI believe this one is turned off by default. Its only for IE 11 browsers. You can check it on the page source as !– commented out meaning it doesn’t run.infinite-scroll.pkgd.min.jsis only added when you enable infinite scroll on the customizer. You can turn it off it the same way you enabled it on the customizer if you want it removed.generate-blog-js-extraworks w/ infinite scroll script and is also removed if you disable infinite scroll.November 30, 2020 at 4:59 pm #1559479Mr Calvert
Yes thanks you so much ^^! All best with you!
November 30, 2020 at 8:47 pm #1559666Elvin
StaffCustomer SupportYes thanks you so much ^^! All best with you!
No problem. Glad to be of any help.:)
-
AuthorPosts
- You must be logged in to reply to this topic.