Scroll Progress Bar
add_action(‘wp_body_open’, function() { echo ‘ ‘; }); add_action(‘wp_head’, function() { echo ‘ ‘; }); add_action(‘wp_footer’, function() { echo ‘‘; });Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
add_action(‘wp_body_open’, function() { echo ‘ ‘; }); add_action(‘wp_head’, function() { echo ‘ ‘; }); add_action(‘wp_footer’, function() { echo ‘‘; });Continue reading
$reading_speed = 200; // 200 words per minute $content = get_post_field( ‘post_content’, get_the_id() ); $word_count = str_word_count( strip_tags( $content ) ); $reading_time = ceil( $word_count / $reading_speed ); echo ‘ Estimated reading time: ‘ . absint( $reading_time ) . ‘…Continue reading
add_action( ‘admin_init’, function () { // Get all public post types $post_types = get_post_types( array(), ‘names’ ); function wpcode_add_post_id_column( $columns ) { $columns[‘wpcode_post_id’] = ‘ID’; // ‘ID’ is the column title return $columns; } function wpcode_show_post_id_column_data( $column, $post_id ) {…Continue reading
add_action( ‘admin_init’, function() { remove_action(‘admin_color_scheme_picker’, ‘admin_color_scheme_picker’); });Continue reading
add_action( ‘add_meta_boxes’, function () { if ( ! current_user_can( ‘manage_options’ ) ) { // Don’t display the metabox to users who can’t manage options return; } add_meta_box( ‘wpcode-view-post-meta’, ‘Post Meta’, function () { $custom_fields = get_post_meta( get_the_ID() ); ?> Meta…Continue reading
add_action( ‘init’, function () { global $wcvendors_pro; $wcv_pro_vendor_controller = $wcvendors_pro->wcvendors_pro_vendor_controller; remove_action(‘woocommerce_product_meta_start’, array( $wcv_pro_vendor_controller, ‘product_ships_from’ ), 9); add_action(‘woocommerce_product_meta_end’, array( $wcv_pro_vendor_controller, ‘product_ships_from’ ), 9); }, 100 );Continue reading
function create_toc($html) { $toc = ”; if (is_single()) { if (!$html) return $html; $dom = new DOMDocument(); libxml_use_internal_errors(true); $dom->loadHTML(mb_convert_encoding($html, ‘HTML-ENTITIES’, ‘UTF-8’)); libxml_clear_errors(); $toc = ‘ Navigation rapide ‘; $h2_status = 0; $h3_status = 0; $i = 1; foreach($dom->getElementsByTagName(‘*’) as $element)…Continue reading
function create_toc($html) { $toc = ”; if (is_single()) { if (!$html) return $html; $dom = new DOMDocument(); libxml_use_internal_errors(true); $dom->loadHTML(mb_convert_encoding($html, ‘HTML-ENTITIES’, ‘UTF-8’)); libxml_clear_errors(); $toc = ‘ Navigation rapide ‘; $h2_status = 0; $h3_status = 0; $i = 1; foreach($dom->getElementsByTagName(‘*’) as $element)…Continue reading
add_filter( ‘login_errors’, function ( $error ) { // Edit the line below to customize the message. return ‘Something is wrong!’; } );Continue reading
global $wpdb; $args = array( ‘post_type’ => ‘product’, ‘product_tag’ => ‘top-products’, ‘orderby’ => ‘meta_value_num’, ‘meta_key’ => ‘top_product_page_order’, ‘order’ => ‘ASC’ ); $loop = new WP_Query($args); $product_count = $loop->post_count; if ($product_count > 0) { echo ‘ ‘; // Start the loop…Continue reading