Home User profile
tagDiv Member
Christopher is a long time WordPress user. Anything else you need to know is private ;-) I *do not* work for TagDiv, but I've been using their themes since late 2013.
simchris
tagDiv Member

New update for the Automattic AMP plugin today (I’m guessing delayed until they got WP 4.6 out the door)
========
0.4 (in-progress)

Pages
Customizer
Updated Template

0.3.3 (Aug 18, 2016)

Handle many more validation errors (props bcampeau and alleyinteractive).
New filter: amp_post_template_dir (props mustafauysal).
New template: Nav bar is now it’s own template part (props jdevalk).
Better ratio for YouTube embeds.
Fix: better timezone handling (props rinatkhaziev).
Fix: better handling of non-int dimensions (like 100%).
Fix: better handling of empty dimensions.
Fix: autoplay is a bool-like value.
Fix: breakage when using the query_string hook (h/t mkuplens).
Fix: don’t break really large Twitter IDs.
Fix: don’t break Instagram shortcodes when using URLs with querystrings.
Readme improvements (props nickjohnford, sotayamashita)

simchris
tagDiv Member

For those curious about baseline speed with GTmetrix for test bed:

No additional compression of css or js done (minification);
No caching plugin running;
Mod_pagespeed is OFF;
Page has no ad, but large image, sidebar, bottom bar images; large logo.
Default Newsmag theme (not using a “style/demo”).
Share buttons ‘on’ at top of page.

Pagespeed Score: A (96%)
YSLOW Score A (94%)
Page load time: 1.2s
Total Page size: 248kb
requests: 12

Nice.

Still to do:
figure out how to fix the wonky ? query on the newsmag icon font …
/images/icons/newsmag.woff?11

a) compress style.css
b) replace gravatar with local author image
c) main css to footer; preload critical CSS in head (fixes ‘render blocking …’)
d) enable mod_pagespeed – does on the fly comment removal, image optiization for small png to base64 or webp, removes all double spaces in text for pseudo-minification; further optimizes anything loaded from google like jquery

=========
that’s it for now.
Hope this isn’t annoying folks too much 😉

————
Radu and co have really done a great job on this and theme is speedy on desktop testing ‘as advertised …” which is awesome. I was worried going from v2 to v3 was going to bring bloaty-mcbloatface, and turns out – not so much 🙂

  • This reply was modified 10 years by simchris.
simchris
tagDiv Member

okay; just noticed after forcing all remaining .js to footer, the deqeue comment-reply in my functions.php code above not working; however corrected, this does:

// Remove comment-reply.min.js from footer
function chrisbunny_clean_header_hook(){
wp_deregister_script( 'comment-reply' );
}
add_action('init','chrisbunny_clean_header_hook');

simchris
tagDiv Member

So, I want to remove Google fonts, stop them being loaded in page head, and use default mobile friendly font stack, also works for desktop:

——- PART 2 / FONT SWAP;
remove default Google Fonts in theme and loaded externally ——–

**/theme/includes/td_config.php

/remove google font calls for defalt roboto and open sans

lines 3247-3259 — remove:

/**
* the default fonts used by the theme. For a list of fonts ids @see td_fonts::$font_names_google_list
*/
td_global::$default_google_fonts_list = array (
'438' => array(
'css_style_id' => 'google_font_open_sans',
'url' => td_global::$http_or_https . '://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700'
),
'522' => array(
'css_style_id' => 'google_font_roboto_cond',
'url' => td_global::$http_or_https . '://fonts.googleapis.com/css?family=Roboto:400,300,700,700italic,400italic,300italic'
),
);

**/theme/style.css v3.1

<< do search/replace for ‘string’ using text editor like BBEdit, TextPad, etc.) >>

lines 352 + 866 + 962 + 1663 + 1752 + 1861 + 2608 + 5355 + 5388 + 5450 + 5691 + 5734 + 7303 + 7340 + 7565 + 7608 ((ETC.)),
replace: font-family: 'Open Sans', arial, sans-serif;

with modern font stack:
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;

lines 379 + 387 + 473 + 1968 + 2006 + 2118 + 2160 + 2301 + 2625 + 7500 ((ETC.)),
replace: font-family: 'Roboto', sans-serif;

as above, same font stack, or choose a serif stack for replacing Roboto.

this isn’t best choice, but option:

font-family: Rockwell, Georgia, Times, "Times New Roman", serif;

======
REMINDER: these haxx need to be done EVERY theme update; keep record and backup of your files in sub-folder on your work PC/Mac to easily redo this as needed for future versions of Newsmag (if you want… or not, won’t matter to me either way … just sayin….) 🙂

simchris
tagDiv Member

found it … // answered my own query 😉 //

**/theme/includes/td_config.php

/remove google font calls for defalt roboto and open sans

lines 3247-3259 — remove:

/**
* the default fonts used by the theme. For a list of fonts ids @see td_fonts::$font_names_google_list
*/
td_global::$default_google_fonts_list = array (
'438' => array(
'css_style_id' => 'google_font_open_sans',
'url' => td_global::$http_or_https . '://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700'
),
'522' => array(
'css_style_id' => 'google_font_roboto_cond',
'url' => td_global::$http_or_https . '://fonts.googleapis.com/css?family=Roboto:400,300,700,700italic,400italic,300italic'
),
);

simchris
tagDiv Member

Be sure to also update all the plugins that come with the theme at same time. 🙂

Also be sure to ‘export’ your settings from Theme, and also do tools > export before you update anything in WP in future as part of normal back-up process.

simchris
tagDiv Member

Okay…. was able to do good ol’ search/replace in style.css

now on hunt in classic /wp-booster/wp_booster_functions.php hack…

which looks like it’s around lines 270-304 …
forget which stuff to comment out here ….. Hmmmm……

=====
**/theme/style.css v3.1

<< do search/replace for ‘string’ using text editor like BBEdit, TextPad, etc.) >>

lines 352 + 866 + 962 + 1663 + 1752 + 1861 + 2608 + 5355 + 5388 + 5450 + 5691 + 5734 + 7303 + 7340 + 7565 + 7608 ((ETC.)),
replace: font-family: ‘Open Sans’, arial, sans-serif;

with modern font stack:
font-family: -apple-system, BlinkMacSystemFont, “Segoe UI”, Roboto, Oxygen-Sans, Ubuntu, Cantarell, “Helvetica Neue”, sans-serif;

lines 379 + 387 + 473 + 1968 + 2006 + 2118 + 2160 + 2301 + 2625 + 7500 ((ETC.)),
replace: font-family: ‘Roboto’, sans-serif;

font-family: -apple-system, BlinkMacSystemFont, “Segoe UI”, Roboto, Oxygen-Sans, Ubuntu, Cantarell, “Helvetica Neue”, sans-serif;

simchris
tagDiv Member

Basic WordPress documentation is helpful here:
https://codex.wordpress.org/Login_Trouble

For me, I usually try

(presuming you have proper dbase back made prior to wordpress upgrade — like it tells you to do)

a) clearing all cache in browser
b) try login; if fail then via FTP or server file manager …
c) rename plugins folder to xplugins
d) see if I can login
e) if not, delete all themes in theme folder except twenty sixteen
f) login — WP reverts to using default theme with no plugins.
g) once logged in, change theme to twenty-sixteen in appearance to clear prior theme selection
h) log out, rename plugins folder back
i) log back in — resave permalinks
j) clear all caching if used
h) consider using wp-optimize on database

Good luck!

simchris
tagDiv Member

Main issues with AMP is bad HTML (inline styles in your post), or a bad plugin injecting javascript into header, or a bad configuration with a CDN or compression service that tries to re-write/compress the AMP code and breaks it.

Old posts where you might have put in a YouTube video with ‘http’ might also not work as all external stuff should be https for amp.

simchris
tagDiv Member

Find better captcha plugin ?

simchris
tagDiv Member

CAUTION:
note in my functions.php example above/prior post I have this section which you may not need; I use this for changing the author slug to profile for specific site; but not needed for most folks and you would also need to update the templates for Newsmag to point to /profile/ vs /author/.

This section near top likely NOT useful to most folks and can be removed:
add_action('init', 'cng_author_base');
function cng_author_base() {
global $wp_rewrite;
$author_slug = 'profile'; // change slug name
$wp_rewrite->author_base = $author_slug;
}

simchris
tagDiv Member

@BAKTL
the WordPress documentation is great place to learn to use WP:
https://codex.wordpress.org/WordPress_Housekeeping

simchris
tagDiv Member

YOu can ignore it

simchris
tagDiv Member

UPDATED FUNCTIONS HAXX AUG 2016
— supercedes old and moldy stuff in this long thread

Works for me on Apache; if not for you, then you messed something up elsewhere.

This goes at BOTTOM of the /theme/functions.php file

Don’t know where that is, then stop right now, buddy. Learn to use FTP!

/** ========================================== */

/** CUSTOM OPTIM CODE : by Christopher Simmons - REV 8.17.16 */

// Remove jQuery Migrate Script from header and Load jQuery from Google API
function simmonsbunny_remove_jquery_migrate_load_google_hosted_jquery() {
	if (!is_admin()) {
		wp_deregister_script('jquery');
		wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js', false, null);
		wp_enqueue_script('jquery');
	}
}
add_action('init', 'simmonsbunny_remove_jquery_migrate_load_google_hosted_jquery');

add_action('init', 'cng_author_base');
function cng_author_base() {
    global $wp_rewrite;
    $author_slug = 'profile'; // change slug name
    $wp_rewrite->author_base = $author_slug;
}

add_filter( 'jpeg_quality', create_function( '', 'return 50;' ) );

/** functions for headcleaner */
function rm_generator_filter() { return ''; }
add_filter('the_generator', 'rm_generator_filter');

remove_action('wp_head','wlwmanifest_link');
remove_action('wp_head','rsd_link');
remove_action('wp_head','feed_links', 2);
remove_action('wp_head','feed_links_extra', 3);
remove_action('wp_head','start_post_rel_link', 10, 0);
remove_action('wp_head','adjacent_posts_rel_link_wp_head', 10, 0);
remove_action('wp_head','print_emoji_detection_script',7);
remove_action('wp_print_styles','print_emoji_styles');

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

function remove_pingback_url( $output, $show ) {
  if ( $show == 'pingback_url' ) $output = '';
  return $output;
}
add_filter( 'bloginfo_url', 'remove_pingback_url', 10, 2 );

/** functions for security */
function no_errors_please(){
return 'You appear to be up to no good. Your IP logged and will be blocked.';
}
add_filter( 'login_errors', 'no_errors_please' );

function disable_reset_lost_password()
 {
   return false;
 }
add_filter( 'allow_password_reset', 'disable_reset_lost_password');

function remove_lost_your_password($text)
  {
    return str_replace( array('Lost your password?', 'Lost your password'), '', trim($text, '?') );
  }
 add_filter( 'gettext', 'remove_lost_your_password'  );

add_filter( 'send_email_change_email', '__return_false' );

/** functions for admin bar */
function mytheme_admin_bar_render() {
  	global $wp_admin_bar;
  	$wp_admin_bar->remove_menu('wpseo-menu');
  }
 add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );
 add_filter( 'wpseo_use_page_analysis', '__return_false' );

function my_custom_css() {
     echo '<style>
          .misc-pub-section.yoast-seo-score.content-score { display: none; }
          .misc-pub-section.yoast-seo-score.keyword-score { display: none; }
     </style>';
}
add_action( 'admin_head', 'my_custom_css' );

function dequeue_yoast_css() {
  wp_dequeue_style('yoast-seo-adminbar');
  wp_deregister_style('yoast-seo-adminbar');
}
add_action('wp_enqueue_scripts','dequeue_yoast_css');

/*remove embeds */
function disable_embeds_init() {
remove_action('rest_api_init', 'wp_oembed_register_route');
remove_filter('oembed_dataparse', 'wp_filter_oembed_result', 10);
remove_action('wp_head', 'wp_oembed_add_discovery_links');
remove_action('wp_head', 'wp_oembed_add_host_js');
}
add_action('init', 'disable_embeds_init', 9999);

function project_dequeue_unnecessary_scripts() {
wp_dequeue_script( 'comment-reply' );
wp_deregister_script( 'comment-reply' );
}
add_action( 'wp_print_scripts', 'project_dequeue_unnecessary_scripts',100 );

/** End Christopher's magic bunny code; Copr. (c) 2013-2016 CLS */

========== and again ===============
THESE MISSIVES ARE COPR. © Christopher Simmons, all rights reserved. You may use this info, but you may *NOT* republish on your blog, in a book, or make claim any of this is originated by you. Seriously. I know warlocks and they can get bitchy.

  • This reply was modified 10 years by simchris.
simchris
tagDiv Member

REV ONE “thinning” a couple of files to re-orient myself on where things are, what they do, etc. — very minor fixes since we do not use the following on our news portals
* WooCommerce
* BBpress
* BuddyPress

=========== THINNING EFFORT PART ONE =============

THINNING BY CHRIS SIMMONS – A QUICKIE NEWSMAG 3.1 TUTORIAL
make backups while editing; you assume all risk for edits. If what I’m doing does not make sense, then stop right now or you might wreck it (check yourself before you wreck yourself) 🙂

<< Edits must be made each theme update if files change! >>

//******
theme/style.css

Remove bbpress and buddypress sections

(save 50kb before compression)

//******
theme/functions.php

(1)
line 17
remove woocommerce and bbpress stuff not used

(saves 2kb prior to compression)

//******
/includes/wp_booster/td_wp_booster_functions.php

(1)
line 187, remove woocommerce support

(2)
Remove editor styles
new line 814

(3)

Remove echo scripts/theme info
new line 827

(saves 0 KB in file)

//*******

END EFFORT ONE

THESE MISSIVES ARE COPR. © Christopher Simmons, all rights reserved. You may use this info, but you may *NOT* republish on your blog, in a book, or make claim any of this is originated by you. Seriously. I know warlocks and they can get bitchy.

simchris
tagDiv Member

NEWSMAG OPTIMIZATION EFFORT 2016
——————————-
PRECIS:
* WordPress 4.6
* Newsmag 3.1
* tagDiv Composer v1.0 BETA
* TD Speed Booster plugin – Version: 4.5
——————————-
I am re-optimizing my network sites since upgrading from v2 v3, and needing to revisit all the past steps from past 3 years with new TadDiv tech, code, etc.

This project presumes I will do several advanced things
1) run mod_pagespeed on deploy; currently disabled for all other efforts; with proper webp format support added as mime type and in htaccess (MPS converts some png files to base64 inline, and others to .webp format when better than jpeg)
2) compress main css and js files not already compressed after ‘thinning’
3) decomment some TD files loaded by pages which are (ahem) overly commented
4) have proper gzip/deflate/TTL elements on server
5) no caching used for initial deploy (MPS uses opcache/memcache)
6) move CSS to footer and use critical CSS generator for inline above the fold CSS
7) test free SSL cert and http/2 on our new server for 2017
8) test move to PHP7 from PHP5

Follow along if the mood strikes; I’m just sharing my info not offering to consult with you (you cannot afford me, in most cases). Please do not post any questions until I post the info during last half of August 2016, as you can “try” any of my changes if you wish, at your own risk.

I am using Unix/Linux, CentOS, Plesk 12.5x (will likely move to ONYX when releases for 2017); Apache with NGINX in front; dedicated server, 1GB connection to network in Class A datacenter in Texas, USA. Running PHP 5x with PHP7 installed and will test ‘7’ once initial deploy stable with my ‘thinning’ and optimization.

Hey party people, it’s on!

  • This reply was modified 10 years by simchris.
simchris
tagDiv Member

Oh… just happen to have that window open, duh ….

here is example of adding a filter for Automattic AMP plugin in your functions.php file where you can include ads, shortcode, etc.

add_action( 'amp_post_template_footer', 'xyz_amp_add_pixel' );
function xyz_amp_add_pixel( $amp_template ) {
$post_id = $amp_template->get( 'post_id' );
?>
<div class="s2pamp02">
<p>My Custom Message Went Here</p>
<!--Related posts-->
<?php if ( function_exists( 'echo_ald_crp' ) ) echo_ald_crp(); ?>
</div>

Some good articles out there now too
http://torquemag.io/2016/03/making-amp-wordpress/

hope that little taste helped somebody 🙂

simchris
tagDiv Member

I don’t think any kind of “slideshow” would work unless you have build out your own custom template. AMP is really more for stories, not for viral slideshows.

In our case we were able to do our own ‘related posts’ using the CRP plugin, then simply including the shortcode via a hook, along with a string to include link back to the story page and message to follow us on Apple News channel if using iOS device.

If I have time I’ll try to post that someplace.

Right now I’m in process of “thinning” Newsmag 3.1 along with the custom composer plugin to replace the v2x version and TD ‘SHIM;’ for one of our sites as text (server crash messed up the site, so seemed good time to move onward ) … just took 50kb out of main style.css since we don’t use BBpress/forum or Buddypress. Boom 50KB gone from style sheet 🙂

simchris
tagDiv Member

Looks like you need to turn OFF the lightbox function.

simchris
tagDiv Member

Working for me, including with the beta composer plugin 🙂

————
REMINDER: always make BACKUP of your dbase BEFORE any major updates to WP — as it clearly states when doing update to ANY major “dot” version of WordPress. Doing an ‘export’ from tools is a “Plan C” level backup. A “Plan B” level backup is making a dump from MySQL with phpMyadmin from your hosting panel. A “Plan A” backup is using DUPLICATOR, and making full snapshot of website (but remembering to remove the backup once done).

Note also not all plugins may work with WP dot upgrades, not part of theme. Useful to go look on the support forum for those that you use, for each plugin first. A 3 year old plugin not updated for WP 4x might stop working at any time.

simchris
tagDiv Member

All sites with Newspaper and Newsmag (including latest Newsmag with the beta composer; older version of Newspaper) all working with 4.6

REMINDER: always make BACKUP of your dbase BEFORE any major updates to WP — as it clearly states when doing update to ANY major “dot” version of WordPress. Doing an ‘export’ from tools is a “Plan C” level backup. A “Plan B” level backup is making a dump from MySQL with phpMyadmin from your hosting panel. A “Plan A” backup is using DUPLICATOR, and making full snapshot of website (but remembering to remove the backup once done).

Note also not all plugins may work with WP dot upgrades, not part of theme. Useful to go look on the support forum for those that you use, for each plugin first. A 3 year old plugin not updated for WP 4x might stop working at any time.

simchris
tagDiv Member

Test your page speed with and without it; on our system was major slower-downer; fine for blogs not for busy news portals.

simchris
tagDiv Member

See tutorials online for how to use “FileZilla” to manage WordPress via FTP.

Really good skill to have 🙂

Basically, have a “local” copy of your entire site on your hard drive; both as a backup and as a “working” copy to make edits to. Best NOT using child theme and use “main” theme to ensure ease of future updates; just keep track of any changes to theme files.

I often make a separate folder for copies of files I have changed.

Edit files in textpad 5 (free), BBEdit, notepad on PC, simpletext (DO NOT USE WORD PROCESSOR!).

Make edits, upload via FTP, then check site on web; if you mess up, just upload the working file back again. Keep both FTP and browser windows open, and pretty soon you’ll be a wiz! 🙂

simchris
tagDiv Member

FYI
reason to delete extra themes and rename plugins folder is to solve not being able to login.

The “transient” settings and “dbase” settings for theme will be retained.

BUT: good to “save/export” any customizations you’ve done in theme panel to a text file.

I forgot to do that recently and after server RAID crash… I went “waaaah”! … actually I cursed, but that isn’t polite to print here 😉

simchris
tagDiv Member

TIPS for those on this topic

a) make sure any divs/classes don’t have “ad” in them …

b) try selling locally loaded text/graphic ads not loaded from any ‘known’ ad network.

Trying to make Adsense work on website to fight adblocker not possible.

Viewing 25 posts - 3,751 through 3,775 (of 9,335 total)