Skip to content

Instantly share code, notes, and snippets.

@luizlopescom
Created September 5, 2020 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luizlopescom/92215337cf0aeab930d3780b7b98aad5 to your computer and use it in GitHub Desktop.
Save luizlopescom/92215337cf0aeab930d3780b7b98aad5 to your computer and use it in GitHub Desktop.
<?php
/**
* Add useful shortcodes
*
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
//Site name
function sitename_shortcode( $atts ){
return get_bloginfo( 'name' );
}
add_shortcode( 'sitename', 'sitename_shortcode' );
//Date shortcodes
function year_shortcode() {
$year = date('Y');
return $year;
}
add_shortcode('year', 'year_shortcode');
//Copyright
function copyright_shortcode( $atts ){
return '©';
}
add_shortcode( 'copyright', 'copyright_shortcode' );
add_shortcode( 'c', 'copyright_shortcode' );
//Registered
function registered_shortcode( $atts ){
return '®';
}
add_shortcode( 'registered', 'registered_shortcode' );
add_shortcode( 'r', 'registered_shortcode' );
//Trademark
function trademark_shortcode( $atts ){
return '™';
}
add_shortcode( 'trademark', 'trademark_shortcode' );
add_shortcode( 'tm', 'trademark_shortcode' );
//FontAwwesome Icons Shortcodes
function fa_user_plus_shortcode() {
return '<i class="fa fa-user-plus" aria-hidden="true"></i>';
}
add_shortcode('fa_user_plus', 'fa_user_plus_shortcode');
function fa_mail_shortcode() {
return '<i class="fa fa-envelope-o" aria-hidden="true"></i>';
}
add_shortcode('fa_mail', 'fa_mail_shortcode');
function fa_phone_shortcode() {
return '<i class="fa fa-phone" aria-hidden="true"></i>';
}
add_shortcode('fa_phone', 'fa_phone_shortcode');
function fa_pin_shortcode() {
return '<i class="fa fa-map-marker" aria-hidden="true"></i>';
}
add_shortcode('fa_map', 'fa_pin_shortcode');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment