| Server IP : 104.26.4.103 / Your IP : 216.73.216.4 Web Server : nginx/1.27.1 System : Linux in-5 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 User : arabianexpress ( 1872) PHP Version : 8.0.30 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /storage/v9321/leapdubai/public_html/wp-content/themes/printx/ |
Upload File : |
<?php
/**
* printx functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package printx
*/
if ( !function_exists( 'printx_setup' ) ):
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function printx_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on printx, use a find and replace
* to change 'printx' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'printx', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> 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' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( [
'main-menu' => esc_html__( 'Main Menu', 'printx' ),
'category-menu' => esc_html__( 'Category Menu', 'printx' ),
] );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', [
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
] );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'printx_custom_background_args', [
'default-color' => 'ffffff',
'default-image' => '',
] ) );
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
//Enable custom header
add_theme_support( 'custom-header' );
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support( 'custom-logo', [
'height' => 250,
'width' => 250,
'flex-width' => true,
'flex-height' => true,
] );
/**
* Enable suporrt for Post Formats
*
* see: https://codex.wordpress.org/Post_Formats
*/
add_theme_support( 'post-formats', [
'image',
'audio',
'video',
'gallery',
'quote',
] );
// Add support for Block Styles.
add_theme_support( 'wp-block-styles' );
// Add support for full and wide align images.
add_theme_support( 'align-wide' );
// Add support for editor styles.
add_theme_support( 'editor-styles' );
// Add support for responsive embedded content.
add_theme_support( 'responsive-embeds' );
// Add support for woocommerce.
add_theme_support('woocommerce');
// Remove woocommerce defauly styles
add_filter( 'woocommerce_enqueue_styles', '__return_false' );
remove_theme_support( 'widgets-block-editor' );
add_image_size( 'printx-case-details', 1170, 600, [ 'center', 'center' ] );
// support for woocommerce gallery lightbox
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}
endif;
add_action( 'after_setup_theme', 'printx_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 printx_content_width() {
// This variable is intended to be overruled from themes.
// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$GLOBALS['content_width'] = apply_filters( 'printx_content_width', 640 );
}
add_action( 'after_setup_theme', 'printx_content_width', 0 );
/**
* Enqueue scripts and styles.
*/
define( 'PRINTX_THEME_DIR', get_template_directory() );
define( 'PRINTX_THEME_URI', get_template_directory_uri() );
define( 'PRINTX_THEME_CSS_DIR', PRINTX_THEME_URI . '/assets/css/' );
define( 'PRINTX_THEME_JS_DIR', PRINTX_THEME_URI . '/assets/js/' );
define( 'PRINTX_THEME_INC', PRINTX_THEME_DIR . '/inc/' );
// wp_body_open
if ( !function_exists( 'wp_body_open' ) ) {
function wp_body_open() {
do_action( 'wp_body_open' );
}
}
/**
* Implement the Custom Header feature.
*/
require PRINTX_THEME_INC . 'custom-header.php';
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require PRINTX_THEME_INC . 'template-functions.php';
/**
* Custom template helper function for this theme.
*/
require PRINTX_THEME_INC . 'template-helper.php';
/**
* initialize kirki customizer class.
*/
if ( class_exists( 'Kirki' ) ) {
include_once PRINTX_THEME_INC . 'kirki-customizer.php';
}
/**
* Load Jetpack compatibility file.
*/
if ( defined( 'JETPACK__VERSION' ) ) {
require PRINTX_THEME_INC . 'jetpack.php';
}
/**
* include printx functions file
*/
require_once PRINTX_THEME_INC . 'class-navwalker.php';
require_once PRINTX_THEME_INC . 'class-navwalker-2.php';
require_once PRINTX_THEME_INC . 'class-tgm-plugin-activation.php';
require_once PRINTX_THEME_INC . 'add_plugin.php';
require_once PRINTX_THEME_INC . '/common/printx-breadcrumb.php';
require_once PRINTX_THEME_INC . '/common/printx-scripts.php';
require_once PRINTX_THEME_INC . '/common/printx-widgets.php';
require_once PRINTX_THEME_INC . '/common/printx-search.php';
if ( function_exists('tpmeta_kick')) {
require_once PRINTX_THEME_INC . 'tp-metabox.php';
}
if ( class_exists( 'WooCommerce' ) ) {
require_once PRINTX_THEME_INC . '/woocommerce/tp-woocommerce.php';
}
/**
* Add a pingback url auto-discovery header for single posts, pages, or attachments.
*/
function printx_pingback_header() {
if ( is_singular() && pings_open() ) {
printf( '<link rel="pingback" href="%s">', esc_url( get_bloginfo( 'pingback_url' ) ) );
}
}
add_action( 'wp_head', 'printx_pingback_header' );
// change textarea position in comment form
// ----------------------------------------------------------------------------------------
function printx_move_comment_textarea_to_bottom( $fields ) {
$comment_field = $fields[ 'comment' ];
unset( $fields[ 'comment' ] );
$fields[ 'comment' ] = $comment_field;
return $fields;
}
add_filter( 'comment_form_fields', 'printx_move_comment_textarea_to_bottom' );
// printx_comment
if ( !function_exists( 'printx_comment postbox-details-comment-inner' ) ) {
function printx_comment( $comment, $args, $depth ) {
$GLOBAL['comment'] = $comment;
extract( $args, EXTR_SKIP );
$args['reply_text'] = '<div class="postbox-details-comment-reply">
Reply
</div>';
$replayClass = 'comment-depth-' . esc_attr( $depth );
?>
<li id="comment-<?php comment_ID();?>" class="comment-list">
<div class="postbox__comment-box p-relative">
<div class="postbox__comment-info d-flex">
<div class="postbox__comment-avater mr-20">
<?php print get_avatar( $comment, 102, null, null, [ 'class' => [] ] );?>
</div>
<div class="postbox__comment-name">
<h5><?php print ucwords(get_the_author());?></h5>
<span class="post-meta"> <?php comment_time( get_option( 'date_format' ) );?></span>
</div>
</div>
<div class="postbox__comment-text ml-65">
<?php comment_text();?>
<div class="postbox__comment-reply">
<?php comment_reply_link( array_merge( $args, [ 'reply_text' => __('<span><svg width="26" height="19" viewBox="0 0 26 19" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.54688 10.2031L12.7969 16.4531C13.9688 17.625 16 16.8047 16 15.125V12.3516C20.6094 12.5469 20.7266 13.5625 20.0625 15.8672C19.5547 17.5469 21.4688 18.9141 22.9141 17.9375C24.9062 16.5703 26 14.8516 26 12.3516C26 6.76562 21 5.67188 16 5.47656V2.66406C16 0.984375 13.9688 0.164062 12.7969 1.33594L6.54688 7.58594C5.80469 8.28906 5.80469 9.5 6.54688 10.2031ZM7.875 8.875L14.125 2.625V7.3125C18.8125 7.3125 24.125 7.58594 24.125 12.3516C24.125 14.5391 22.9922 15.6328 21.8594 16.375C23.4609 11.0625 19.4766 10.4375 14.125 10.4375V15.125L7.875 8.875ZM1.54688 7.58594C0.804688 8.28906 0.804688 9.5 1.54688 10.2031L7.79688 16.4531C8.57812 17.2734 9.75 17.1562 10.4531 16.4531L2.875 8.875L10.4531 1.33594C9.75 0.632812 8.57812 0.515625 7.79688 1.33594L1.54688 7.58594Z" fill="#121416"/>
</svg></span>', 'printx'), 'depth' => $depth, 'max_depth' => $args['max_depth'] ] ) );?>
</div>
</div>
</div>
<?php
}
}
/**
* shortcode supports for removing extra p, spance etc
*
*/
add_filter( 'the_content', 'printx_shortcode_extra_content_remove' );
/**
* Filters the content to remove any extra paragraph or break tags
* caused by shortcodes.
*
* @since 1.0.0
*
* @param string $content String of HTML content.
* @return string $content Amended string of HTML content.
*/
function printx_shortcode_extra_content_remove( $content ) {
$array = [
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']',
];
return strtr( $content, $array );
}
// printx_search_filter_form
if ( !function_exists( 'printx_search_filter_form' ) ) {
function printx_search_filter_form( $form ) {
$form = sprintf(
'<div class="sidebar__search">
<form action="%s" method="get">
<div class="sidebar__search-input-2">
<input type="text" value="%s" required name="s" placeholder="%s">
<button type="submit"><i class="far fa-search"></i></button>
</div>
</form>
</div>',
esc_url( home_url( '/' ) ),
esc_attr( get_search_query() ),
esc_html__( 'Search Here...', 'printx' )
);
return $form;
}
add_filter( 'get_search_form', 'printx_search_filter_form' );
}
add_action( 'admin_enqueue_scripts', 'printx_admin_custom_scripts' );
// printx_admin_custom_scripts
function printx_admin_custom_scripts() {
wp_enqueue_media();
wp_enqueue_style( 'customizer-style', get_template_directory_uri() . '/inc/css/customizer-style.css',array());
wp_enqueue_script( 'printx-admin-custom', get_template_directory_uri() . '/inc/js/admin_custom.js', [ 'jquery' ], '', true );
wp_enqueue_script( 'printx-admin-custom' );
}