| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/clients/client2/web20/web/wp-content/themes/page-builder-framework/ |
Upload File : |
<?php
require_once( get_template_directory() . "/includes/post-types.php" );
/**
* Functions.
*
* @package Page Builder Framework
*/
defined( 'ABSPATH' ) || die( "Can't access directly" );
// Constants
define( 'WPBF_THEME_DIR', get_template_directory() );
define( 'WPBF_THEME_URI', get_template_directory_uri() );
define( 'WPBF_CHILD_THEME_DIR', get_stylesheet_directory() );
define( 'WPBF_CHILD_THEME_URI', get_stylesheet_directory_uri() );
define( 'WPBF_VERSION', wp_get_theme( 'page-builder-framework' )->get( 'Version' ) );
define( 'WPBF_CHILD_VERSION', '1.1' );
/**
* Theme setup.
*/
function wpbf_theme_setup() {
// Textdomain.
load_theme_textdomain( 'page-builder-framework', WPBF_THEME_DIR . '/languages' );
// Custom logo.
add_theme_support(
'custom-logo',
array(
'width' => 180,
'height' => 48,
'flex-width' => true,
'flex-height' => true,
)
);
// Custom background.
add_theme_support(
'custom-background',
array(
'default-color' => 'ffffff',
'default-image' => '',
'default-repeat' => 'repeat',
'default-position-x' => 'left',
'default-position-y' => 'top',
'default-size' => 'auto',
'default-attachment' => 'scroll',
)
);
// Title tag.
add_theme_support( 'title-tag' );
// Post thumbnails.
add_theme_support( 'post-thumbnails' );
// Automatic feed links.
add_theme_support( 'automatic-feed-links' );
// Full width support (by Nico)
add_theme_support( 'align-wide' );
// HTML5 support.
add_theme_support(
'html5',
array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'script',
'style',
)
);
// Selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
// Register nav menu's.
register_nav_menus(
array(
'main_menu' => __( 'Main Menu', 'page-builder-framework' ),
'mobile_menu' => __( 'Mobile Menu', 'page-builder-framework' ),
'pre_header_menu' => __( 'Pre Header Left', 'page-builder-framework' ),
'pre_header_menu_right' => __( 'Pre Header Right', 'page-builder-framework' ),
'footer_menu' => __( 'Footer Left', 'page-builder-framework' ),
'footer_menu_right' => __( 'Footer Right', 'page-builder-framework' ),
)
);
}
add_action( 'after_setup_theme', 'wpbf_theme_setup' );
// Content width.
if ( ! isset( $content_width ) ) {
$content_width = 1200;
}
/**
* Register sidebars.
*/
function wpbf_sidebars() {
register_sidebar(
array(
'name' => __( 'Sidebar', 'page-builder-framework' ),
'id' => 'sidebar-1',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="wpbf-widgettitle">',
'after_title' => '</h4>',
)
);
}
add_action( 'widgets_init', 'wpbf_sidebars' );
/**
* Enqueue scripts & styles.
*/
function wpbf_scripts() {
// Main JS file.
wp_enqueue_script( 'wpbf-site', get_template_directory_uri() . '/js/min/site-min.js', array( 'jquery' ), WPBF_VERSION, true );
if ( ! get_theme_mod( 'mobile_menu_options' ) || 'menu-mobile-hamburger' === get_theme_mod( 'mobile_menu_options' ) ) {
// Hamburger mobile menu.
wp_enqueue_script( 'wpbf-mobile-menu-hamburger', get_template_directory_uri() . '/js/min/mobile-hamburger-min.js', array( 'jquery', 'wpbf-site' ), WPBF_VERSION, true );
} elseif ( 'menu-mobile-default' === get_theme_mod( 'mobile_menu_options' ) ) {
// Default mobile menu.
wp_enqueue_script( 'wpbf-mobile-menu-default', get_template_directory_uri() . '/js/min/mobile-default-min.js', array( 'jquery', 'wpbf-site' ), WPBF_VERSION, true );
}
// Main stylesheet.
wp_enqueue_style( 'wpbf-style', get_template_directory_uri() . '/style.css', '', WPBF_VERSION );
// Responsive styles.
wp_enqueue_style( 'wpbf-responsive', get_template_directory_uri() . '/css/min/responsive-min.css', '', WPBF_VERSION );
// Comment reply.
if ( is_singular() ) {
wp_enqueue_script( 'comment-reply' );
}
if ( is_rtl() ) {
// RTL.
wp_enqueue_style( 'wpbf-rtl', get_template_directory_uri() . '/css/min/rtl-min.css', '', WPBF_VERSION );
}
}
add_action( 'wp_enqueue_scripts', 'wpbf_scripts', 10 );
add_action("publish_post", "eg_create_sitemap");
add_action("publish_page", "eg_create_sitemap");
add_action( "save_post", "eg_create_sitemap" );
function eg_create_sitemap() {
if ( str_replace( '-', '', get_option( 'gmt_offset' ) ) < 10 ) {
$tempo = '-0' . str_replace( '-', '', get_option( 'gmt_offset' ) );
} else {
$tempo = get_option( 'gmt_offset' );
}
if( strlen( $tempo ) == 3 ) { $tempo = $tempo . ':00'; }
$postsForSitemap = get_posts( array(
'numberposts' => -1,
'orderby' => 'modified',
'post_type' => array( 'post', 'page' ),
'order' => 'DESC'
) );
$sitemap .= '<?xml version="1.0" encoding="UTF-8"?>' . '<?xml-stylesheet type="text/xsl" href="' .
esc_url( home_url( '/' ) ) . 'sitemap.xsl"?>';
$sitemap .= "\n" . '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
$sitemap .= "\t" . '<url>' . "\n" .
"\t\t" . '<loc>' . esc_url( home_url( '/' ) ) . '</loc>' .
"\n\t\t" . '<lastmod>' . date( "Y-m-d\TH:i:s", current_time( 'timestamp', 0 ) ) . $tempo . '</lastmod>' .
"\n\t\t" . '<changefreq>daily</changefreq>' .
"\n\t\t" . '<priority>1.0</priority>' .
"\n\t" . '</url>' . "\n";
foreach( $postsForSitemap as $post ) {
setup_postdata( $post);
$postdate = explode( " ", $post->post_modified );
$sitemap .= "\t" . '<url>' . "\n" .
"\t\t" . '<loc>' . get_permalink( $post->ID ) . '</loc>' .
"\n\t\t" . '<lastmod>' . $postdate[0] . 'T' . $postdate[1] . $tempo . '</lastmod>' .
"\n\t\t" . '<changefreq>Weekly</changefreq>' .
"\n\t\t" . '<priority>0.5</priority>' .
"\n\t" . '</url>' . "\n";
}
$sitemap .= '</urlset>';
$fp = fopen( ABSPATH . "sitemap.xml", 'w' );
fwrite( $fp, $sitemap );
fclose( $fp );
}
// Init.
require_once WPBF_THEME_DIR . '/inc/init.php';