youradds
Forum Replies Created
-
Forum: Hacks
In reply to: Get rid of ?ver on the end of CSS/JS files?Ok, now I feel stupid!!!
Just found this page:
https://zemalf.com/1443/w3-total-cache/
The bit in it about “CSS” files made me think – and it looks like that all it was!
In CDN > Custom file list: , all I had to do was add in the different CSS/JS files/folders I wanna run through the CDN – doh!!!
For example:
favicon.ico
wp-content/gallery/*
wp-content/plugins/wp-jquery-lightbox/lightbox.min.css..and it now works perfectly, and calls it from the CDN:
<link rel='stylesheet' id='jquery.lightbox.min.css-css' href='https://webdesign2.ultra-cdn.com/wp-content/plugins/wp-jquery-lightbox/lightbox.min.css' type='text' />
Man, wish I had just seen that article about a month ago ??
Thanks for your patience and help – got there in the end <G>
Cheers
Andy
Forum: Hacks
In reply to: Get rid of ?ver on the end of CSS/JS files?Hi,
Nah, missed that ??
Have done that change, and the ?ver=xxx is being removed ok, but still doesn’t seem to wanna pass through the CDN ??
Will leave it an hour or so, just in case it needs time to upload to the CDN (not 100% sure how the plugin works … so maybe it has uploaded the file, but cos it obviously has to propigate to all the other CDN servers, then it can take a little while to do that)
Will reply in about an hour, to let you know one way or the other <G>
TIA
Andy
Forum: Hacks
In reply to: Get rid of ?ver on the end of CSS/JS files?Hi,
Sorry, I must have not explained myself properly ??
The “mod” *does* work – but not quite how I’m wanting =)
I have the “W3 Total Cache” plugin installed, and have a CDN setup with MaxCDN. The main files, such as the theme CSS / JS files work correctly (they are accessed from the CDN)
However, the other files (CSS and JS) don’t seem to be.
This is only a problem, as I’m trying to get ALL the JS/CSS files served from my blog, to work from the CDN (to make the pages as fast as possible)
However, it seems that the plugin doesn’t wanna pick up those files for some reason (I just assumed it was to do with the ?ver=xxx stuff at the end of the files, which was causing some of the code in the Total Cache plugin not to pick those files up)
I tried having a look through the contents of that plugin, but its got sooo many features, I quickly got lost (and seeing as my PHP is very rusty, I’m wasn’t even 100% sure what I was looking for – appart from a preg_match() or similar that extracts the CSS files from the template, and then checks if they are uploaded to the CDN or not)
TIA
Andy
Forum: Hacks
In reply to: Get rid of ?ver on the end of CSS/JS files?BTW, in wp-jquery-lightbox.php, I see the following:
function jqlb_css(){ if(is_admin() || is_feed()){return;} wp_enqueue_style('jquery.lightbox.min.css', JQLB_STYLE_URL, false, '1.2'); }
I’m assuming thats where the problem is coming from?
TIA
Andy
Forum: Hacks
In reply to: Get rid of ?ver on the end of CSS/JS files?Hi,
Thanks for the reply – sorry about my tardy response time – didn’t get an email for some reason :/
If I comment out the lines:
// add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 ); // add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
..then the general CSS file comes up as:
<link rel='stylesheet' id='jquery.lightbox.min.css-css' href='https://www.mywebsitedesignersblog.com/wp-content/plugins/wp-jquery-lightbox/lightbox.min.css?ver=1.2' type='text/css' media='all' />
TIA
Andy
Forum: Hacks
In reply to: Get rid of ?ver on the end of CSS/JS files?Hi,
Ah, doesn’t seem to be working quite right ??
https://www.mywebsitedesignersblog.com/2011/01/speeding-up-your-site-with-cdns/
If you look at the source, you will see:
<link rel="stylesheet" type="text/css" href="https://webdesign2.ultra-cdn.com/wp-content/themes/df_marine/style.css">
..which is fine (as its going through the CDN) … but with the changes I made in the functions.php, it looks like thats run AFTER the “W3 Total Cache” plugin has been run?
Cos this one *should* be using the CDN, but doesn’t seem to be ??
<link rel='stylesheet' id='jquery.lightbox.min.css-css' href='https://www.mywebsitedesignersblog.com/wp-content/plugins/wp-jquery-lightbox/lightbox.min.css' type='text/css' media='all' />
I wish the author of that plugin would just make it so the ?ver=xxx is just ignored – it seems to be very picky about the URL’s for the CSS/JS files that it passes to the CDN ??
Any suggestions are much appreciated
Cheers
Andy
Forum: Hacks
In reply to: Get rid of ?ver on the end of CSS/JS files?You’re a legend!!!!
Adding this into functions.php works a charm:
function remove_cssjs_ver( $src ) { if( strpos( $src, '?ver=' ) ) $src = remove_query_arg( 'ver', $src ); return $src; } add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 ); add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
Its removed the ?ver=xxx from both the js and css files – which is exactly what I needed/wanted
Thanks!
Andy
Forum: Hacks
In reply to: Get rid of ?ver on the end of CSS/JS files?haha I know the feeling. I help on a pretty large forum (gossamer threads), and I’m about the only one who really helps people – everyone else just wants to ask questions ??
I’m not very familiar with PHP/Wordpress (only started using it for my new blog, although I dabbled in PHP a while back) … my main language is Perl ??
Where would I edit the code you suggested? In the plugin files, or a main .php / .inc file?
TIA!
Andy
Forum: Hacks
In reply to: Get rid of ?ver on the end of CSS/JS files?Hi,
Thanks for the reply ?? (first reply I think I’ve ever had – everyone seems to ignore my posts :()
Will give that a go this evening. Thanks again!
Andy
Forum: Plugins
In reply to: Force overwrite on CDN?Ok, so it looks like this plugin isn’t supported any more ??
Anyone got any good suggestions for a devent CDN plugin? I can deal without all the “minify” stuff, as using gzip does a pretty decent job of that anyway (from the CDN’s end)
All I need, is a way for the files to be uploaded to the CDN
Alternativly, I could setup one that is a PUSH account, but thats more manual – and would much prefer an automated system!
TIA
Andy
Forum: Plugins
In reply to: Force overwrite on CDN?Come on, someone must know???? ??
Forum: Plugins
In reply to: Force overwrite on CDN?Man, do no-one know anything about this plugin? This is like the 3rd post I’ve made related to it – and noone seems to ever reply! :/
Forum: Plugins
In reply to: W3 Total Cache – doesnt want to use the CDN for my CSS file?Man, this is getting a bit annoying now ?? Seems it won’t work properly with the Syntax Highlighter plugin either!
<script type=’text/javascript’ src=’https://www.mywebsitedesignersblog.com/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushCss.js?ver=3.0.2′></script>
<script type=’text/javascript’ src=’https://www.mywebsitedesignersblog.com/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushXml.js?ver=3.0.2′></script>
<script type=’text/javascript’ src=’https://www.mywebsitedesignersblog.com/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushBash.js?ver=3.0.2′></script>
<script type=’text/javascript’ src=’https://www.mywebsitedesignersblog.com/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/scripts/shBrushJScript.js?ver=3.0.2′></script>
<script type=’text/javascript’>
(function(){
var corecss = document.createElement(‘link’);
var themecss = document.createElement(‘link’);
var corecssurl = “https://www.mywebsitedesignersblog.com/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/styles/shCore.css?ver=3.0.83b”;
if ( corecss.setAttribute ) {
corecss.setAttribute( “rel”, “stylesheet” );
corecss.setAttribute( “type”, “text/css” );
corecss.setAttribute( “href”, corecssurl );
} else {
corecss.rel = “stylesheet”;
corecss.href = corecssurl;
}
document.getElementsByTagName(“head”)[0].insertBefore( corecss, document.getElementById(“syntaxhighlighteranchor”) );
var themecssurl = “https://www.mywebsitedesignersblog.com/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/styles/shThemeDefault.css?ver=3.0.83b”;
if ( themecss.setAttribute ) {
themecss.setAttribute( “rel”, “stylesheet” );
themecss.setAttribute( “type”, “text/css” );
themecss.setAttribute( “href”, themecssurl );
} else {
themecss.rel = “stylesheet”;
themecss.href = themecssurl;
}
//document.getElementById(“syntaxhighlighteranchor”).appendChild(themecss);
document.getElementsByTagName(“head”)[0].insertBefore( themecss, document.getElementById(“syntaxhighlighteranchor”) );
})();
SyntaxHighlighter.config.strings.expandSource = ‘+ expand source’;
SyntaxHighlighter.config.strings.help = ‘?’;
SyntaxHighlighter.config.strings.alert = ‘SyntaxHighlighter\n\n’;
SyntaxHighlighter.config.strings.noBrush = ‘Can\’t find brush for: ‘;
SyntaxHighlighter.config.strings.brushNotHtmlScript = ‘Brush wasn\’t configured for html-script option: ‘;
SyntaxHighlighter.defaults[‘pad-line-numbers’] = false;
SyntaxHighlighter.defaults[‘toolbar’] = false;
SyntaxHighlighter.all();
</script>..but those files should all be on the CDN server!
Anyone got any ideas? I tried looking in the snytaxhighlighter.php file, but doesn’t seem to have any affect (I’m wondering if its the ?ver=xxxx bit at the end of the JS and CSS URLs? )
TIA
Andy
Forum: Plugins
In reply to: W3 Total Cache – doesnt want to use the CDN for my CSS file?Ok – guess no-one knows what is going on ??
I managed to work it out myself, so thought I would share.
In the theme – I had:
<style type=”text/css” media=”screen”>
@import url( <?php bloginfo(‘stylesheet_url’);
?> );
</style>..but I needed to change it to:
<link rel=”stylesheet” type=”text/css” href=”<?php bloginfo(‘stylesheet_url’)?>”>
This has now fixed it, and it goes through the CDN fine.
Cheers
Andy
Forum: Plugins
In reply to: Good Social Media bar, with async?No one????