Collection of functions Artrageous uses on it's websites/
/**
* Copyright Year
*/
function auto_copyright($year = 'auto', $attribution = NULL){
$date = NULL;
if ($attribution == NULL) {
$attribution = get_bloginfo('sitename');
} if(intval($year) == 'auto'){
$year = date('Y');
} if(intval($year) == date('Y')){
$date = intval($year);
} if(intval($year) < date('Y')){
$date = intval($year) . ' - ' . date('Y');
} if(intval($year) > date('Y')){
$date = date('Y');
}
$copyright = "© " . $date . " " . $attribution;
return $copyright;
}
/**
* Copyright Year Shortcode
* eg. [copyright starting_year="2016" attribution="DMT Industrial Fabrication"]
*/
function copyright_shortcode( $atts ) {
// Attributes
$atts = shortcode_atts(
array(
'starting_year' => 'auto',
'attribution' => NULL,
),
$atts,
'copyright'
);
return auto_copyright($year = $atts['starting_year'], $attribution = $atts['attribution']);
}
add_shortcode( 'copyright', __NAMESPACE__ . '\\copyright_shortcode' );
/**
* Link back to Artrageous on Homepage, no-follow on inner page
*/
function artrageous_shortcode() {
if(is_front_page()){
$rel = "";
} else {
$rel = 'rel="nofollow"';
}
return "<a href=\"https://artrageousadvertising.ca/\" class=\"art-link\" $rel target=\"_blank\">Made by Artrageous Advertising.</a>";
}
add_shortcode( 'artrageous', __NAMESPACE__ . '\\artrageous_shortcode' );
/**
* Custom logo on login page
*/
function custom_login_logo() {
$custom_logo_id = get_theme_mod( 'custom_logo' );
$image = wp_get_attachment_image_src( $custom_logo_id , 'full' );
if($image) {
echo '
<style type="text/css">
h1 a {
background-image: url(' . $image[0] . ') !important;
background-size: auto !important;
background-position: center !important;
background-color: #354255 !important;
width: 100% !important;
}
</style>';
}
}
add_action('login_head', __NAMESPACE__ . '\\custom_login_logo');