Current Year Shortcode
function year_shortcode() { $year = date(‘Y’); return $year; } add_shortcode(‘year’, ‘year_shortcode’);Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
function year_shortcode() { $year = date(‘Y’); return $year; } add_shortcode(‘year’, ‘year_shortcode’);Continue reading
// Shortcode for the site title function site_title_shortcode() { $name = get_bloginfo(‘name’); return $name; } add_shortcode(‘site-title’, ‘site_title_shortcode’);Continue reading
// Shortcode for current year function year_shortcode() { $year = date_i18n(‘Y’); return $year; } add_shortcode(‘year’, ‘year_shortcode’);Continue reading
function fn_currentyear () { $year = date_i18n (‘Y’); return $year; } add_shortcode (‘currentyear’, ‘fn_currentyear’);Continue reading
function reading_time() { if ( empty( $post ) && isset( $GLOBALS[‘post’] ) ) { $post = $GLOBALS[‘post’]; $content = get_post_field( ‘post_content’, $post->ID ); $word_count = str_word_count( strip_tags( $content ) ); $readingtime = ceil($word_count / 260); if ($readingtime == 1) {…Continue reading
/** * Enable shortcodes for menu navigation. */ if ( ! has_filter( ‘wp_nav_menu’, ‘do_shortcode’ ) ) { add_filter( ‘wp_nav_menu’, ‘shortcode_unautop’ ); add_filter( ‘wp_nav_menu’, ‘do_shortcode’, 11 ); } /** * Enable shortcodes for widgets (footer, sidebar…). */ if ( ! has_filter(…Continue reading
add_filter( ‘widget_text’, ‘do_shortcode’ );Continue reading
add_filter( ‘widget_text’, ‘do_shortcode’ );Continue reading
// Shortcode to get post date function g9_get_post_date() { return ‘‘ . get_the_date() . ‘‘; } add_shortcode(‘post_date’, ‘g9_get_post_date’);Continue reading
function mpcs_author_custom_bio_shortcode( $atts ) { if( !isset( $atts[‘slug’] ) || empty( $atts[‘slug’] ) ) { return; } global $post; $field = get_user_meta( $post->post_author, $atts[‘slug’], true ); if( empty( $field ) ) { return; } return ‘ ‘ . sanitize_text_field( $field…Continue reading