| Server IP : 178.212.43.201 / Your IP : 10.100.0.33 Web Server : Apache/2.4.37 (Oracle Linux Server) OpenSSL/1.1.1k System : Linux spa0007.srv.paxillus.pl 5.4.17-2136.355.3.1.el8uek.x86_64 #3 SMP Sat May 9 17:11:55 PDT 2026 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/kontur_dev/wp-content/themes/konturpolska/ |
Upload File : |
<?php
// remove comments
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
// Remove comments metabox from dashboard
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
// Disable support for comments and trackbacks in post types
foreach (get_post_types() as $post_type) {
if (post_type_supports($post_type, 'comments')) {
remove_post_type_support($post_type, 'comments');
remove_post_type_support($post_type, 'trackbacks');
}
}
});
// Close comments on the front-end
add_filter('comments_open', '__return_false', 20, 2);
add_filter('pings_open', '__return_false', 20, 2);
// Hide existing comments
add_filter('comments_array', '__return_empty_array', 10, 2);
// Remove comments page in menu
add_action('admin_menu', function () {
remove_menu_page('edit-comments.php');
});
// Remove comments links from admin bar
add_action('init', function () {
if (is_admin_bar_showing()) {
remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
}
});
//Remove Gutenberg Block Library CSS from loading on the frontend
function smartwp_remove_wp_block_library_css(){
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'wc-block-style' ); // Remove WooCommerce block CSS
}
add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css', 100 );
/* Change excerpt length */
function wplab_custom_excerpt_length( $length ) {
return 30;
}
add_filter( 'excerpt_length', 'wplab_custom_excerpt_length', 999 );
/* WIDGETS FUNCTION*/
if (function_exists ("register_sidebar")) {
register_sidebar ();
}
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
/* FEATURED IMAGE */
add_theme_support( 'post-thumbnails' );
/* WEBP IMAGES*/
function webp_upload_mimes($existing_mimes) {
$existing_mimes['webp'] = 'image/webp';
return $existing_mimes;
}
add_filter('mime_types', 'webp_upload_mimes');
//** * Enable preview / thumbnail for webp image files.*/
function webp_is_displayable($result, $path) {
if ($result === false) {
$displayable_image_types = array( IMAGETYPE_WEBP );
$info = @getimagesize( $path );
if (empty($info)) {
$result = false;
} elseif (!in_array($info[2], $displayable_image_types)) {
$result = false;
} else {
$result = true;
}
}
return $result;
}
add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2);
function current_url($url){
global $wp;
if( (home_url( $wp->request ).'/')== (esc_url(home_url('/')).$url) ){
echo 'active-link';
}
}
add_shortcode( 'cta_button', 'konturpolska_cta' );
function konturpolska_cta( $atts ) {
$a = shortcode_atts( array(
'link' => 'https://konturpolska.pl/kontakt/',
'text' => 'Masz pytania?',
'button_text' => 'Skontaktuj siÄ™ z nami',
'target' => '_self'
), $atts );
$output = '
<div class="wp360-cta">
<p>' . ( $a['text'] ) . '</p>
<p><a class="wp360-button" href="' . esc_url( $a['link'] ) . '" target="' . ($a['target']) . '">' . ( $a['button_text'] ) . '</a></p>
</div>';
return $output;
}
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'Pola dodatkowe',
'menu_title' => 'Pola dodatkowe',
'menu_slug' => 'theme-options',
'capability' => 'edit_posts'
));
acf_add_options_sub_page(array(
'page_title' => 'Elementy stopki',
'parent_slug' => 'theme-options',
'menu_title' => 'Elementy stopki',
'menu_slug' => 'footer-settings',
));
}
?>