Shortcode for the Site Title [site-title]
// Shortcode for the site title function site_title_shortcode() { $name = get_bloginfo(‘name’); return $name; } add_shortcode(‘site-title’, ‘site_title_shortcode’);Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
// 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 my_plugin_kses( $html ) { $kses_defaults = wp_kses_allowed_html( ‘post’ ); $svg_args = array( ‘svg’ => array( ‘class’ => true, ‘aria-hidden’ => true, ‘aria-labelledby’ => true, ‘role’ => true, ‘xmlns’ => true, ‘fill’ => true, ‘width’ => true, ‘height’ => true,…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
foreach (array(‘pre_term_description’) as $filter) { remove_filter($filter, ‘wp_filter_kses’); if (!current_user_can(‘unfiltered_html’)) { add_filter($filter, ‘wp_filter_post_kses’); } } foreach (array(‘term_description’) as $filter) { remove_filter($filter, ‘wp_kses_data’); }Continue reading
function g9_mime_types($mime_types) { $mime_types[‘webp’] = ‘image/webp’; //Adding webp extension return $mime_types; } add_filter(‘woocommerce_rest_allowed_image_mime_types’, ‘g9_mime_types’, 1, 1);Continue reading
function g9_add_slug_body_class($classes) { global $post; if (isset($post)) { $classes[] = $post->post_type . ‘-‘ . $post->post_name; } return $classes; } add_filter(‘body_class’, ‘g9_add_slug_body_class’);Continue reading
add_filter( ‘excerpt_length’, function( $length ) { return 20; } );Continue reading
function g9_get_post_terms() { global $post; ob_start(); $taxonomy_name = ‘category’; // Taxonomy name $terms = get_the_terms($post->ID, $taxonomy_name); if ($terms) : $term_links = array(); foreach ($terms as $term) { $term_links[] = ‘Continue reading
function g9_remove_schedule_delete() { remove_action(‘wp_scheduled_delete’, ‘wp_scheduled_delete’); } add_action(‘init’, ‘g9_remove_schedule_delete’);Continue reading