/home/techb158/l2hypotheques.com/wp-content/themes/pylon
Edit: /home/techb158/l2hypotheques.com/wp-content/themes/pylon/functions.php (8204B)
tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
add_theme_support('woocommerce');
add_image_size( 'pylon-medium', 370, 252, true );
add_image_size( 'pylon-team-member', 370, 430, true );
// This theme uses wp_nav_menu() in one location.
register_nav_menus(
array(
'main-menu' => 'Main Menu',
)
);
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support(
'html5',
array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script',
)
);
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background' );
add_theme_support(
'custom-background',
apply_filters(
'pylon_custom_background_args',
array(
'default-color' => 'ffffff',
'default-image' => '',
)
)
);
add_theme_support( 'custom-header' );
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support(
'custom-logo',
array(
'width' => 155,
'flex-width' => true,
'flex-height' => true,
)
);
}
endif;
add_action( 'after_setup_theme', 'pylon_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function pylon_content_width() {
$GLOBALS['content_width'] = apply_filters( 'pylon_content_width', 640 );
}
add_action( 'after_setup_theme', 'pylon_content_width', 0 );
// Pylon pagination
if ( !function_exists( 'pylon_pagination' ) ) {
function pylon_pagination() {
the_posts_pagination( array(
'screen_reader_text' => '',
'before' => '
' . esc_html__( 'Pages:', 'pylon' ) . '
- ',
'separator' => '
- ',
'after' => '
',
'prev_text' => '
',
'next_text' => '
',
'type' => 'list',
'mid_size' => 1,
) );
}
}
// Post Length
function pylon_excerpt_length( $length ) {
return 23;
}
add_filter( 'excerpt_length', 'pylon_excerpt_length', 999 );
// deactivate new block editor
function pylon_theme_editor_support() {
remove_theme_support( 'widgets-block-editor' );
}
add_action( 'after_setup_theme', 'pylon_theme_editor_support' );
/**
* Add a parent CSS class for nav menu items.
*
* @param array $items The menu items, sorted by each menu item's menu order.
* @return array (maybe) modified parent CSS class.
*/
function pylon_add_menuclass( $items ) {
$parents = array();
foreach ( $items as $item ) {
if ( $item->menu_item_parent && $item->menu_item_parent > 0 ) {
$parents[] = $item->menu_item_parent;
}
}
foreach ( $items as $item ) {
if ( in_array( $item->ID, $parents ) ) {
$item->classes[] = 'dropdown';
}
}
return $items;
}
add_filter( 'wp_nav_menu_objects', 'pylon_add_menuclass' );
if(!function_exists('pylon_excerpt_max_charlength')){
function pylon_excerpt_max_charlength($charlength,$excerpt) {
$charlength++;
if ( mb_strlen( $excerpt ) > $charlength ) {
$subex = mb_substr( $excerpt, 0, $charlength - 5 );
$exwords = explode( ' ', $subex );
$excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) );
if ( $excut < 0 ) {
echo mb_substr( $subex, 0, $excut );
} else {
echo esc_html($subex);
}
echo '[...]';
} else {
echo wp_kses_post($excerpt);
}
}
}
//Register widget area
require_once PYLON_INC_DIR . 'widget-area-init.php';
require_once PYLON_INC_DIR . 'css-and-js.php';
/**
* Implement the Custom Header feature.
*/
require_once PYLON_INC_DIR . 'custom-header.php';
/**
* TGM Plugin
*/
require_once PYLON_INC_DIR . 'plugins-activation.php';
/**
* Custom template tags for this theme.
*/
require_once PYLON_INC_DIR . 'template-tags.php';
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require_once PYLON_INC_DIR. 'template-functions.php';
/**
* Comment Template
*/
require_once PYLON_INC_DIR. 'comment-template.php';
require_once PYLON_INC_DIR. 'comments-list.php';
require_once PYLON_INC_DIR. 'nav-menu-walker.php';
/**
* Customizer additions.
*/
require_once PYLON_INC_DIR . 'customizer.php';
//Load default theme options
require_once PYLON_INC_DIR . 'metabox-and-options/theme-options/theme-options-default.php';
//Load meta box and theme options if Codestar framework installed.
if( class_exists( 'CSF' ) ) {
require_once PYLON_INC_DIR . 'metabox-and-options/metabox-and-options.php';
//Load inline style.
require_once PYLON_INC_DIR . 'inline-style.php';
}
add_action( 'after_setup_theme', function () {
/* Demo Content import*/
require_once get_parent_theme_file_path( '/inc/merlin/vendor/autoload.php' );
require_once get_parent_theme_file_path( '/inc/merlin/class-merlin.php' );
require_once get_parent_theme_file_path( '/inc/demo-wizard.php' );
require_once get_parent_theme_file_path( '/inc/merlin-config.php' );
// woocommerce file
require_once get_template_directory(). '/inc/woocommerce.php';
add_filter( 'woocommerce_prevent_automatic_wizard_redirect', '__return_true' );
} );