Here is my speed booster file
<?php
/*
Plugin Name: tagDiv Speed Booster
Plugin URI: http://tagdiv.com
Description: Speed booster for Newspaper 6 and Newsmag 1.x themes - It moves the styles and all the scripts of the theme to the bottom when needed. It activates internal theme optimizations for better speed and it adds async js .
Author: tagDiv
Version: 4.1
Author URI: http://tagdiv.com
*/
define('TD_SPEED_BOOSTER' , 'v4.1');
class td_speed_booster {
private $style_footer_queue = array(); // here we keep all the stylesheets IDs that we want to move to the footer
private $is_ie = false; // if the browser is detected as IE, treat it differently
// here we keep the theme information
private $td_theme_name = '';
private $td_theme_version = '';
private $td_deploy_mode = '';
private $allowed_plugins = array(
'bbpress/bbpress.php',
'contact-form-7/wp-contact-form-7.php',
'jetpack/jetpack.php',
'js_composer/js_composer.php',
'td-speed-booster/td-speed-booster.php',
'font-awesome-4-menus/n9m-font-awesome-4.php',
'wordpress-seo/wp-seo.php',
'wp-user-avatar/wp-user-avatar.php',
'td-social-counter/td-social-counter.php',
'wp-super-cache/wp-cache.php'
);
// this class is instantiated at the bottom of this page
function __construct() {
add_action('td_wp_booster_loaded', array($this, 'start_booster'));
}
/**
* everything starts from here
*/
function start_booster() {
// read the theme version and name if defined
if (defined('TD_THEME_VERSION') and defined('TD_THEME_NAME') and defined('TD_DEPLOY_MODE')) {
$this->td_theme_version = TD_THEME_VERSION;
$this->td_theme_name = TD_THEME_NAME;
$this->td_deploy_mode = TD_DEPLOY_MODE;
} else {
return;
}
// detect IE 8 9 10 11
if (
!empty($_SERVER['HTTP_USER_AGENT'])
and (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) or (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false))
) {
$this->is_ie = true;
}
// add hooks
add_action('wp_enqueue_scripts', array($this, 'css_mover'), 1002); // 1002 priority - because visual composer has 1000 and we use 1001 in the wp010 theme
add_action('wp_enqueue_scripts', array($this, 'js_mover'), 1002); // 1002 priority - because visual composer has 1000 and we use 1001 in the wp010 theme
add_action('wp_footer', array($this, 'render_footer_styles'), 15);
// hide the body only on IE and Newspaper 6+
if (
$this->is_ie === false
and $this->td_theme_name == 'Newsmag'
) {
//add_action('wp_head', array($this, 'hide_body_inline_css'), 15);
}
/**
* jetpack is 'special' - it has to be moved like this. It has now only one CSS
* the two hooks are needed!
* @since 27.05.2015
*/
add_action('wp_print_styles', array($this, 'jetpack_mover'), 10);
add_action('wp_print_footer_scripts', array($this, 'jetpack_mover'), 10);
}
/**
* jetpack is 'special' - it has to be moved like this. It has now only one CSS
* @since 27.05.2015
*/
function jetpack_mover() {
$this->move_style_to_footer_queue('jetpack_css');
}
/**
* here we move the css
*/
function css_mover() {
if ($this->td_theme_name == 'Newsmag') {
// wp 011 - Newspaper 6
//$this->move_style_to_footer_queue('bbp-default-bbpress'); //bpress old
//$this->move_style_to_footer_queue('bbp-default'); //bpress
$this->move_style_to_footer_queue('google_font_open_sans');
$this->move_style_to_footer_queue('google_font_roboto');
$this->move_style_to_footer_queue('contact-form-7');
if ($this->is_ie === false) {
// move style.css theme style
//$this->move_style_to_footer_queue('js_composer_front');
//$this->move_style_to_footer_queue('td-theme'); //this is the main style of the theme. It's only moved on Newspaper 6!
}
}
//@todo test on newsmag
$this->move_style_to_footer_queue('woocommerce_frontend_styles'); //old woocommerce?
$this->move_style_to_footer_queue('woocommerce-layout');
$this->move_style_to_footer_queue('woocommerce-smallscreen');
$this->move_style_to_footer_queue('woocommerce-general');
$this->move_style_to_footer_queue('bp-legacy-css');
$this->move_style_to_footer_queue('td-theme');
$this->move_style_to_footer_queue('font-awesome-four');
//move revolution slider css
$this->move_style_to_footer_queue('rs-plugin-settings');
$this->move_style_to_footer_queue('genericons'); //still rev slider
}
/**
* move the js
*/
function js_mover() {
global $wp_scripts;
//detect revmin - revolution slider and do not move jquery, the plugin outputs raw js in the page!
if( !is_admin() and !isset($wp_scripts->registered['revmin'])){
if (is_ssl()) {
$td_protocol = 'https';
} else {
$td_protocol = 'http';
}
wp_deregister_script('jquery');
wp_register_script('jquery', ($td_protocol . '://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'), true, '1.11.1', true);
wp_enqueue_script('jquery');
}
/**
* move javascript to footer
*/
$this->move_js_to_footer('themepunchtools');
$this->move_js_to_footer('td-site-min');
$this->move_js_to_footer('revmin');
$this->move_js_to_footer('archivesCW');
$this->move_js_to_footer('js_composer_front');
$this->move_style_to_footer_queue('archives-cal-classiclight');
//print_r($wp_scripts);
// replace comment-reply.min.js with inline version
}
/**
* here we render the footer styles
* the styles are already deregistered when you call @see move_style_to_footer_queue ($style_id)
*/
function render_footer_styles() {
//get the theme version for style
$current_theme_version = $this->td_theme_version;
//on demo mode, auto generate version hourly + day - so we get a fresh css hourly
if ($this->td_deploy_mode == 'demo') {
$current_theme_version = date('jG');
}
if (isset($this->style_footer_queue['td-theme'])) {
// whatever the order, make damn sure that our td-theme style is LAST - we remove it from the queue and add it again at the end
$td_theme_value = $this->style_footer_queue['td-theme'];
unset($this->style_footer_queue['td-theme']);
$this->style_footer_queue['td-theme'] = $td_theme_value;
}
// output the new styles
foreach ($this->style_footer_queue as $style_id => $style_src) {
echo "<link rel='stylesheet' id='" . $style_id . "-css' href='" . $style_src . "?ver=" . $current_theme_version . "' type='text/css' media='all' />\n";
}
}
/**
* prevent flickering of the image until the style is loaded
*/
function hide_body_inline_css() {
echo '<style>body {visibility:hidden;}</style>';
}
/**
* the id of the style can be found in the source of the page, for example:
* <link rel='stylesheet' id='td-theme-css' => the id is 'td-theme' (note that the '-css' part is missing)
* using this method you can move other styles if needed
* Moves a style to the bottom of the page
* @param $style_id string - the id of the style
*/
function move_style_to_footer_queue($style_id) {
global $wp_styles;
if (!empty($wp_styles->registered[$style_id]) and !empty($wp_styles->registered[$style_id]->src)) {
$this->style_footer_queue[$style_id] = $wp_styles->registered[$style_id]->src;
wp_deregister_style($style_id);
}
}
/**
* @param $js_id string - the js file id (this is a bit more complex to get) @todo -> add a tutorial about how to get the theme js
*/
function move_js_to_footer($js_id) {
global $wp_scripts;
if (isset($wp_scripts->registered[$js_id])) {
wp_enqueue_script($js_id, ($wp_scripts->registered[$js_id]->src), '', $wp_scripts->registered[$js_id]->ver, true);
}
}
}
new td_speed_booster();
and here is registered scripts
registered scripts
archivesCW | http://www.domain.com/second/wp-content/plugins/archives-calendar-widget/jquery.archivesCW.min.js
aspexi-facebook-like-box | http://www.domain.com/second/wp-content/plugins/aspexi-facebook-like-box/js/aflb.js
jquery | http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
td-site-min | http://www.domain.com/second/wp-content/themes/Newsmag/js/tagdiv_theme.min.js
comment-reply | /wp-includes/js/comment-reply.min.js
registered styles
archives-cal-classiclight | http://www.domain.com/second/wp-content/plugins/archives-calendar-widget/themes/classiclight.css
awesome-weather | http://www.domain.com/second/wp-content/plugins/awesome-weather/awesome-weather.css
opensans-googlefont | https://fonts.googleapis.com/css?family=Open+Sans:400,300
google_font_roboto_cond | http://fonts.googleapis.com/css?family=Roboto+Condensed:300italic,400italic,700italic,400,300,700
google-fonts-style | http://fonts.googleapis.com/css?family=Open+Sans:400,700
js_composer_front | http://www.domain.com/second/wp-content/plugins/js_composer/assets/css/js_composer.css
td-theme | http://www.domain.com/second/wp-content/themes/Newsmag/style.css
td-theme-child | http://www.domain.com/second/wp-content/themes/Newsmag-child/style.css
Hi
I was following exact steps fro configuring Speed Booster and when i opened the file, i noticed all references in file are written for Newspaper.
And does nothing 🙂 Still js and css showing up in Page speed insights.
What is latest version of Speed Booster for Newsmag?
Thank you
Hi,
You can doit with custom css (add it in Theme Panel -> Custom CSS): – http://screencast.com/t/1x4nUsqI
.home .td-main-page-wrap .td-pb-span4{
background-color: lightgray;
}
For more precise results you have to add a custom class on the row which contains that sidebar and add the class in the css. – http://screencast.com/t/t7dbhZOvFwB
.home .td-main-page-wrap .main_page_sidebar{
background-color: lightgray;
}
Thank you!
-
This reply was modified 11 years by
Emil G.
Hi,
The css loads after the html elements and because of this for a few seconds the elements are displayed one on top of the other. Try to disable SpeedBooster and see if the issue is still there.
Thank you!
was loaded over HTTPS, but requested an insecure stylesheet ‘http://fonts.googleapis.com/css?family=Open+Sans:400,800,300,700’. This request has been blocked; the content must be served over HTTPS.
My website is webhost4lifereview.com and the error displayed on Google Chrome “Console”
How to fix?
I mean removed from code. With the css attribute, it still display with search engine.
Hello,put this CSS as follow in your CSS box
.td_block_related_posts .td-related-right {
display: none;
}
Hi Alin,
Thanks, the problem is fixed (bug EventOn plugin).
I also would like to disable some modules at the frontpage for mobile users.
I set-up this custom css fof mobile device: http://postimg.org/image/d3ag8colj/
But Block 13 (natuur in Amsterdam) and textblock (Winkelen in Amsterdam) are still vissible, how can I de-activate the 2 blocks for mobile device?
There is also a lot of empty space at mobile if you scroll down.
http://mobiletest.me/iphone_5_emulator/?u=http://amsterdam-online.nl/
Hi,
Not sure why you have this issue, normally using Upscale thumbnail and Force regenerate should fix your issue if your featured images are smaller as like you know WordPress doesn’t enlarge images.
You also can try to enlarge them via custom css – http://screencast.com/t/bAmBDUxobN Also please make sure that you don’t use row in row as like I see your slider is in one column – http://screencast.com/t/KtcKSgkT8B15 and it should be on 2 columns – http://screencast.com/t/RnSBpHSdfopP
Thanks!
Hi
If you want the same color on the mobile version you can use custom css but notice that you need to change the color of the mobile menu and the search button, because will not be visible.
@media (max-width: 767px){}
.td-header-wrap .td-header-main-menu{
background-color: white !important;
}
}
@media (max-width: 767px){
#td-top-mobile-toggle i{
color: #0A0A0A;
}
}
@media (max-width: 767px){
.header-search-wrap .td-icon-search {
color: #000 !important;
}
Please post your issue on Newspaper forum https://forum.tagdiv.com/forum/newspaper/
Thanks!
Hi
Try to add after css rules !important and test again or send your site url so we can test it.
The big grid was designed to work with 4 small thumbs how it work and looks now and to change it you will need additional customization and testing and adjusting to make it look right on all devices and screens width.
This is not easy and you will need custom work for this, if you don’t know how to do it yourself we advise you to get a freelancer to do it for you. You can find one on site’s like: studio.envato.com
We also plan to add in next theme’s versions more type of grids so you can wait until then.
Thanks!
Salut.
1. Daca nu vrei sa modifici template-ul pentru footer poti folosi acest css in Theme Panel > Custom Css: http://screencast.com/t/QumjT0yurX9
.td-footer-bottom-full {
display: none;
}
2. Exista o optiune in block settings sa apara doar anumite categori, pe care le setezi folosind id-urile – http://screencast.com/t/bw9HPyA7n – http://screencast.com/t/QYwateRHUKs
Mersi!
Hi,
Please try to add border like this: http://screencast.com/t/PzoxdCqFP – http://screencast.com/t/jzXNarSXOx7 so you can either use those settings and use it like that or you can use custom css and set a specific class for the text block or the VC container you use and apply custom css using that class.
To use custom css for customizing VC elements you need to style a custom class to the column/row/element you need to style, like this: http://screencast.com/t/7JAB7kdJ281E then use custom css like this to apply the border and some padding: http://screencast.com/t/CJaETDd2f
Add the custom css you’ve made in theme panel > custom css section:
.custom_css_class {
border: 1px solid red;
padding: 10px
}
Thanks!
Hi,
I need a link to inspect this, you can try to hide it via custom css in Theme Panel > Custom Css:
.wpb_revslider_heading {
display: none;
}
You can change the header style to one that use full logo size – http://screencast.com/t/mV8fUDZ6kg
If you don’t want to post images or link here on forum, you can send an email at contact@tagdiv.com and provide details about your issues.
Thanks!
If I try to set the form 300×250 banner it is still centered. look here: http://imgur.com/kmpSlfI
I think I have to change settings in the css for it to be left awake. how can I do? I think it’s a common problem.
Your function is very interesting, I’d really be able to use on my website to show the banner as you.
Hi
Please try this css in theme panel > custom css:
.td-header-style-10 .td-a-rec-id-header > div{
display:table;
}
Here it’s the result: http://screencast.com/t/5Rfe9e29NQ
Thanks!
Hi
You can increase the text modifying the font size with custom css in theme panel > custom css like here: http://screencast.com/t/3e0U9y7Inyd
.td-social-but-text{
font-size: 17px!important;
}
You can modify the font size value as you like.
Thanks!
Hi,
Please check this – https://css-tricks.com/snippets/css/media-queries-for-standard-devices/
Thanks!
Hi,
Please check this using the main theme and see if you still have this issue, as I have checked your site and seems that the style.css file from the child theme is an old version – http://screencast.com/t/imHZGArQ98p2
Let me know how it goes!
Thanks!
Hi,
Sorry for misunderstanding! If you want to remove the zoom effect please use this custom css in
Theme Panel > Custom Css – http://screencast.com/t/1gFiihjuFWja
.td-hover-1 .td-big-grid-post:hover .td-module-thumb .entry-thumb {
transform: none !important;
-webkit-transform: none !important;
-moz-transform: none !important;
}
Thanks!
Salutare,
Scuze daca scriu in lb romana si nu este ok.
Astazi revin cu 3 probleme. Sper sa ma ajutati.
Problema nr 1.
Cum scot partea incercuita din footer fara sa modific style-ul footerului. CSS-ul este mult prea complex pentru cunostintele mele sumare. Efectiv nu am reusit sa gasesc o modalitate.
Problema nr 2 & 3 !
Cum scap de celelalte categorii de aici
Si aici:
Multumesc anticipat pentru ajutor.
Hi,
You can use the tagDiv Speed Booster plugin to move the css and js at the bottom of the page, but please note that it is tested only with these plugins – http://screencast.com/t/hcjLnOqh4i2 and if you use other plugins it will be automatically disabled. A lot of people install the plugin without knowing what it does and after that they add many plugins and some of the them are not written fine so the developer took this decision. Please check documentation if you want to use it – https://forum.tagdiv.com/how-to-make-the-site-faster/
Also for cache we recommend WP Super Cache and we suggest to be used by default(default settings).
Thanks!
Hi,
I’ve added your suggestions on the list, Radu O. is going to investigate this, he’s the expert on this area.
The Google SEO requests are not properly defined, Radu constantly looks for the pattern used on big sites with lots of employees which benefit from high quality SEO expertise and are highly ranked on Google. He also makes tests with various installs to test the theme pattern are working and the results are excellent. The theme is constantly tested with Google Structured Data Testing tool, a fix on this will be released in the next update to address some issues which appeared lately (Google is constantly changing the requirements).
If you’re in a hurry the title h tags can be changed manually in the code, ex for modules/blocks – http://screencast.com/t/pk3pvqzQvZ – http://screencast.com/t/fVS4pOnM
The header container can also be changed, it seems it doesn’t affect the css but additional tests should be made (i just made a quick test) – http://screencast.com/t/R5ewHTxWGii
On the sidebar is more complicated, on a quick look you have to modify the before and after used on widgets – http://screencast.com/t/5o1A6ZJd8F4 – then change the sidebar container tag on templates – http://screencast.com/t/Lke6IZsOk – extensive tests have to be done it this area too.
Any changes to these sections will be announced in the theme log.
Thanks for your feedback!
Hi,
You decrease the space between paragraphs using custom css as it is a default value for margin bottom – http://screencast.com/t/tKgnaC6SQB
.td-post-content p {
margin-bottom: 5px;
}
Thanks!
Hi,
You can change the module to display articles for each category page from Theme Panel – http://screencast.com/t/kHQtzvgrOUUc if this what you mean. Also if you want to make some css customization on specific category page you can target it after the slug name or ID – http://screencast.com/t/a4f5hx3u9w
Thanks!