| Server IP : 3.111.61.48 / Your IP : 216.73.216.67 Web Server : Apache System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.2.31 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/vhost/cosmicindrani.com/wp-content/themes/indrani/ |
Upload File : |
<?php
/**
* Twenty Nineteen functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package WordPress
* @subpackage Twenty_Nineteen
* @since Twenty Nineteen 1.0
*/
/**
* Twenty Nineteen only works in WordPress 4.7 or later.
*/
if ( version_compare( $GLOBALS['wp_version'], '4.7', '<' ) ) {
require get_template_directory() . '/inc/back-compat.php';
return;
}
if ( ! function_exists( 'twentynineteen_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 twentynineteen_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on Twenty Nineteen, use a find and replace
* to change 'twentynineteen' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'twentynineteen', 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' );
set_post_thumbnail_size( 1568, 9999 );
// This theme uses wp_nav_menu() in two locations.
register_nav_menus(
array(
'header_menu' => __( 'Primary', 'twentynineteen' ),
'footer_menu' => __( 'Footer Menu', 'twentynineteen' ),
)
);
/*
* 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',
'script',
'style',
'navigation-widgets',
)
);
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support(
'custom-logo',
array(
'height' => 190,
'width' => 190,
'flex-width' => false,
'flex-height' => false,
)
);
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
// 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' );
// Enqueue editor styles.
add_editor_style( 'style-editor.css' );
// Add custom editor font sizes.
add_theme_support(
'editor-font-sizes',
array(
array(
'name' => __( 'Small', 'twentynineteen' ),
'shortName' => __( 'S', 'twentynineteen' ),
'size' => 19.5,
'slug' => 'small',
),
array(
'name' => __( 'Normal', 'twentynineteen' ),
'shortName' => __( 'M', 'twentynineteen' ),
'size' => 22,
'slug' => 'normal',
),
array(
'name' => __( 'Large', 'twentynineteen' ),
'shortName' => __( 'L', 'twentynineteen' ),
'size' => 36.5,
'slug' => 'large',
),
array(
'name' => __( 'Huge', 'twentynineteen' ),
'shortName' => __( 'XL', 'twentynineteen' ),
'size' => 49.5,
'slug' => 'huge',
),
)
);
// Editor color palette.
add_theme_support(
'editor-color-palette',
array(
array(
'name' => 'default' === get_theme_mod( 'primary_color' ) ? __( 'Blue', 'twentynineteen' ) : null,
'slug' => 'primary',
'color' => twentynineteen_hsl_hex( 'default' === get_theme_mod( 'primary_color' ) ? 199 : get_theme_mod( 'primary_color_hue', 199 ), 100, 33 ),
),
array(
'name' => 'default' === get_theme_mod( 'primary_color' ) ? __( 'Dark Blue', 'twentynineteen' ) : null,
'slug' => 'secondary',
'color' => twentynineteen_hsl_hex( 'default' === get_theme_mod( 'primary_color' ) ? 199 : get_theme_mod( 'primary_color_hue', 199 ), 100, 23 ),
),
array(
'name' => __( 'Dark Gray', 'twentynineteen' ),
'slug' => 'dark-gray',
'color' => '#111',
),
array(
'name' => __( 'Light Gray', 'twentynineteen' ),
'slug' => 'light-gray',
'color' => '#767676',
),
array(
'name' => __( 'White', 'twentynineteen' ),
'slug' => 'white',
'color' => '#FFF',
),
)
);
// Add support for responsive embedded content.
add_theme_support( 'responsive-embeds' );
// Add support for custom line height.
add_theme_support( 'custom-line-height' );
}
endif;
add_action( 'after_setup_theme', 'twentynineteen_setup' );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function twentynineteen_widgets_init() {
register_sidebar(
array(
'name' => __( 'Brand Logo', 'twentynineteen' ),
'id' => 'logo',
'description' => __( '', 'twentynineteen' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
)
);
register_sidebar(
array(
'name' => __( 'Footer Text', 'twentynineteen' ),
'id' => 'footer_text',
'description' => __( '', 'twentynineteen' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
)
);
register_sidebar(
array(
'name' => __( 'Social Media', 'twentynineteen' ),
'id' => 'social',
'description' => __( '', 'twentynineteen' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
)
);
register_sidebar(
array(
'name' => __( 'Address', 'twentynineteen' ),
'id' => 'address',
'description' => __( '', 'twentynineteen' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
)
);
register_sidebar(
array(
'name' => __( 'Contact Emails', 'twentynineteen' ),
'id' => 'contact-emails',
'description' => __( '', 'twentynineteen' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
)
);
register_sidebar(
array(
'name' => __( 'Contact Phoneno', 'twentynineteen' ),
'id' => 'contact-phone',
'description' => __( '', 'twentynineteen' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
)
);
register_sidebar(
array(
'name' => __( 'Copyright', 'twentynineteen' ),
'id' => 'copy',
'description' => __( '', 'twentynineteen' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
)
);
}
add_action( 'widgets_init', 'twentynineteen_widgets_init' );
/**
* 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 Content width.
*/
function twentynineteen_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( 'twentynineteen_content_width', 640 );
}
add_action( 'after_setup_theme', 'twentynineteen_content_width', 0 );
/**
* Enqueue scripts and styles.
*/
function twentynineteen_scripts() {
wp_enqueue_style( 'twentynineteen-style', get_stylesheet_uri(), array(), wp_get_theme()->get( 'Version' ) );
wp_style_add_data( 'twentynineteen-style', 'rtl', 'replace' );
if ( has_nav_menu( 'menu-1' ) ) {
wp_enqueue_script( 'twentynineteen-priority-menu', get_theme_file_uri( '/js/priority-menu.js' ), array(), '20181214', true );
wp_enqueue_script( 'twentynineteen-touch-navigation', get_theme_file_uri( '/js/touch-keyboard-navigation.js' ), array(), '20181231', true );
}
wp_enqueue_style( 'twentynineteen-print-style', get_template_directory_uri() . '/print.css', array(), wp_get_theme()->get( 'Version' ), 'print' );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'twentynineteen_scripts' );
/**
* Fix skip link focus in IE11.
*
* This does not enqueue the script because it is tiny and because it is only for IE11,
* thus it does not warrant having an entire dedicated blocking script being loaded.
*
* @link https://git.io/vWdr2
*/
function twentynineteen_skip_link_focus_fix() {
// The following is minified via `terser --compress --mangle -- js/skip-link-focus-fix.js`.
?>
<script>
/(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())},!1);
</script>
<?php
}
add_action( 'wp_print_footer_scripts', 'twentynineteen_skip_link_focus_fix' );
/**
* Enqueue supplemental block editor styles.
*/
function twentynineteen_editor_customizer_styles() {
wp_enqueue_style( 'twentynineteen-editor-customizer-styles', get_theme_file_uri( '/style-editor-customizer.css' ), false, '1.1', 'all' );
if ( 'custom' === get_theme_mod( 'primary_color' ) ) {
// Include color patterns.
require_once get_parent_theme_file_path( '/inc/color-patterns.php' );
wp_add_inline_style( 'twentynineteen-editor-customizer-styles', twentynineteen_custom_colors_css() );
}
}
add_action( 'enqueue_block_editor_assets', 'twentynineteen_editor_customizer_styles' );
/**
* Display custom color CSS in customizer and on frontend.
*/
function twentynineteen_colors_css_wrap() {
// Only include custom colors in customizer or frontend.
if ( ( ! is_customize_preview() && 'default' === get_theme_mod( 'primary_color', 'default' ) ) || is_admin() ) {
return;
}
require_once get_parent_theme_file_path( '/inc/color-patterns.php' );
$primary_color = 199;
if ( 'default' !== get_theme_mod( 'primary_color', 'default' ) ) {
$primary_color = get_theme_mod( 'primary_color_hue', 199 );
}
?>
<style type="text/css" id="custom-theme-colors" <?php echo is_customize_preview() ? 'data-hue="' . absint( $primary_color ) . '"' : ''; ?>>
<?php echo twentynineteen_custom_colors_css(); ?>
</style>
<?php
}
add_action( 'wp_head', 'twentynineteen_colors_css_wrap' );
/**
* SVG Icons class.
*/
require get_template_directory() . '/classes/class-twentynineteen-svg-icons.php';
/**
* Custom Comment Walker template.
*/
require get_template_directory() . '/classes/class-twentynineteen-walker-comment.php';
/**
* Common theme functions.
*/
require get_template_directory() . '/inc/helper-functions.php';
/**
* SVG Icons related functions.
*/
require get_template_directory() . '/inc/icon-functions.php';
/**
* Enhance the theme by hooking into WordPress.
*/
require get_template_directory() . '/inc/template-functions.php';
/**
* Custom template tags for the theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Block Patterns.
*/
require get_template_directory() . '/inc/block-patterns.php';
require_once('class-wp-bootstrap-navwalker.php');
remove_filter('widget_text_content', 'wpautop'); // For modern widgets
remove_filter('widget_text', 'wpautop'); // For older widgets
add_filter('wpcf7_autop_or_not', '__return_false');
/////// adding option in the option menu
add_action('admin_menu', 'custom_options_fb');
function custom_options_fb() {
add_options_page('Custom Options', 'Custom Options', 'administrator', 'custom_settings', 'options_page_cb');
}
// creating form for custom settings form
function options_page_cb() {
?>
<div>
<form action="options.php" method="post">
<?php settings_fields('custom_settings'); ?>
<?php do_settings_sections('custom_settings'); ?>
<p class="submit">
<input name="submit" id="submit" type="submit" class="button-primary" value="<?php esc_attr_e('Save Changes'); ?>" />
</p>
</form></div>
<?php
}
// for managing site basic settings
add_action('admin_init', 'add_theme_settings_cb');
// adding section and registering settings
function add_theme_settings_cb() {
add_settings_section('custom_setting_section','Custom settings section','contact_setting_section_cb','custom_settings');
add_settings_field( 'site_logo', 'Site Logo', 'site_logo_cb', 'custom_settings', 'custom_setting_section' );
add_settings_field( 'footer_text', 'Footer Text', 'footer_text_cb', 'custom_settings', 'custom_setting_section' );
add_settings_field( 'contact_email', 'Contact Email', 'contact_email_cb', 'custom_settings', 'custom_setting_section' );
add_settings_field( 'contact_phone', 'Contact Phone', 'contact_phone_cb', 'custom_settings', 'custom_setting_section' );
add_settings_field( 'contact_address', 'Contact Address', 'contact_address_cb', 'custom_settings', 'custom_setting_section' );
add_settings_field( 'facebook', 'Facebook', 'facebook_cb', 'custom_settings', 'custom_setting_section' );
add_settings_field( 'twitter', 'Twitter', 'twitter_cb', 'custom_settings', 'custom_setting_section' );
add_settings_field( 'youtube', 'Youtube', 'youtube_cb', 'custom_settings', 'custom_setting_section' );
add_settings_field( 'linkedin', 'Linkedin', 'linkedin_cb', 'custom_settings', 'custom_setting_section' );
register_setting('custom_settings','site_logo');
register_setting('custom_settings','footer_text');
register_setting('custom_settings','contact_email');
register_setting('custom_settings','contact_phone');
register_setting('custom_settings','contact_address');
register_setting('custom_settings','facebook');
register_setting('custom_settings','twitter');
register_setting('custom_settings','youtube');
register_setting('custom_settings','linkedin');
}
function contact_setting_section_cb(){
echo '<p><i>Managing Custom Setting here...</i></p>';
}
// creating Conatct Fields block
function footer_text_cb() {
echo '<textarea class="regular-text code" id="footer_text" name="footer_text" style="height:100px; resize: none">'.get_option('footer_text').'</textarea>';
}
function contact_email_cb() {
echo '<input type="text" size="5" class="regular-text code" value="'.get_option('contact_email').'" id="contact_email" name="contact_email" />';
}
function contact_phone_cb() {
echo '<input type="text" size="5" class="regular-text code" value="'.get_option('contact_phone').'" id="contact_phone" name="contact_phone" />';
}
function contact_address_cb() {
echo '<input type="text" size="5" class="regular-text code" value="'.get_option('contact_address').'" id="contact_address" name="contact_address" />';
}
function facebook_cb() {
echo '<input type="text" size="5" class="regular-text code" value="'.get_option('facebook').'" id="facebook" name="facebook" />';
}
function twitter_cb() {
echo '<input type="text" size="5" class="regular-text code" value="'.get_option('twitter').'" id="twitter" name="twitter" />';
}
function youtube_cb() {
echo '<input type="text" size="5" class="regular-text code" value="'.get_option('youtube').'" id="youtube" name="youtube" />';
}
function linkedin_cb() {
echo '<input type="text" size="5" class="regular-text code" value="'.get_option('linkedin').'" id="linkedin" name="linkedin" />';
}
/*Site Logo */
function site_logo_cb() {
if(function_exists( 'wp_enqueue_media' )){
wp_enqueue_media();
}else{
wp_enqueue_style('thickbox');
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
}
?>
<p><strong>Site Logo Image URL</strong><br />
<img class="site_logo" src="<?php echo get_option('site_logo'); ?>" style="object-fit: cover" width="100"/><br />
<input class="site_logo_banner_url" type="text" name="site_logo" size="60" value="<?php echo get_option('site_logo'); ?>"><br />
<a href="#" class="site_logo_upload">Upload</a>
</p>
<script>
jQuery(document).ready(function($) {
$('.site_logo_upload').click(function(e) {
e.preventDefault();
var custom_uploader = wp.media({
title: 'Custom Image',
button: {
text: 'Upload Image'
},
multiple: false // Set this to true to allow multiple files to be selected
})
.on('select', function() {
var attachment = custom_uploader.state().get('selection').first().toJSON();
$('.site_logo').attr('src', attachment.url);
$('.site_logo_banner_url').val(attachment.url);
})
.open();
});
});
</script>
<?php
}
/*Site Logo */