/**
* Enqueue Font Awesome.
*/
add_action( 'wp_enqueue_scripts', 'tu_load_font_awesome' );
function tu_load_font_awesome() {
wp_enqueue_style( 'font-awesome', '//use.fontawesome.com/releases/v5.5.0/css/all.css', array(), '5.5.0' );
}
code snippets
enqueue google fonts
/**
* Add Google Fonts to Generate Press
*/
add_filter( 'generate_typography_customize_list', 'tu_add_google_fonts' );
function tu_add_google_fonts( $fonts ) {
$fonts[ 'Livvic' ] = array(
'name' => 'Livvic',
'variants' => array( '100', '100i', '200', '200i','300', '300i', '400', '400i', '500', '500i', '600', '600i', '700', '700i' ),
'category' => 'sans-serif'
);
$fonts[ 'Barlow Condensed' ] = array(
'name' => 'Barlow Condensed',
'variants' => array( '100', '100i', '200', '200i','300', '300i', '400', '400i', '500', '500i', '600', '600i', '700', '700i' ),
'category' => 'sans-serif'
);
$fonts[ 'Barlow Semi Condensed' ] = array(
'name' => 'Barlow Semi Condensed',
'variants' => array( '100', '100i', '200', '200i','300', '300i', '400', '400i', '500', '500i', '600', '600i', '700', '700i' ),
'category' => 'sans-serif'
);
return $fonts;
}
google analytics
// Include the Google Analytics Tracking Code (ga.js)
// @ https://developers.google.com/analytics/devguides/collection/gajs/
function google_analytics_tracking_code(){
$propertyID = 'UA-XXXXXX-1'; // GA Property ID ADD THIS FOR EVERY SITE
if ($options['ga_enable']) { ?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<?php echo $propertyID; ?>']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<?php }
}
// include GA tracking code before the closing head tag
//add_action('wp_head', 'google_analytics_tracking_code');
// OR include GA tracking code before the closing body tag
add_action('wp_footer', 'google_analytics_tracking_code');
change admin email from name
// change email sender name for admin posts
function ec_mail_name( $email ){
return 'form robot fontaholic.biz'; // new email name from sender.
}
add_filter( 'wp_mail_from_name', 'ec_mail_name' );
enqueue parent styles
// enqueue parent styles
wp_enqueue_style('parent-theme', get_template_directory_uri() .'/style.css');
}
add_action('wp_enqueue_scripts', 'example_enqueue_styles');
display published as post list default
// change page link to display published pages only
function wcs_change_admin_page_link() {
global $submenu;
$submenu['edit.php?post_type=page'][5][2] = 'edit.php?post_type=page&post_status=publish';
}
add_action( 'admin_menu', 'wcs_change_admin_page_link' );
// change post link to display published posts only
function wcs_change_admin_post_link() {
global $submenu;
$submenu['edit.php'][5][2] = 'edit.php?post_status=publish';
}
add_action( 'admin_menu', 'wcs_change_admin_post_link' );
image has no alt tag
img:not([alt]) {
border: 4px solid red;
}
color scrollbar
/* COLOR SCROLLBAR - CHROME ONLY */
::-webkit-scrollbar {
width: 15px;
}
::-webkit-scrollbar-thumb {
border-radius: 0;
background: #d8d86c!important;
}
::-webkit-scrollbar-thumb:window-inactive {
background: #d8d86c!important;
opacity: .5;
}
reset everything
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
center anything
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);