block.json
1 month ago
index-rtl.css
1 month ago
index.asset.php
1 month ago
index.css
1 month ago
index.js
1 month ago
render.php
1 month ago
render.php
218 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Footer Block - Server-Side Render |
| 4 | * Template: Child Author |
| 5 | * |
| 6 | * @package Author_Website_Templates |
| 7 | */ |
| 8 | |
| 9 | if (!defined('ABSPATH')) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | // Extract attributes |
| 14 | $logo_text = isset($attributes['logoText']) ? $attributes['logoText'] : 'Danielle Steel'; |
| 15 | $menu1_slug = isset($attributes['menu1Slug']) ? $attributes['menu1Slug'] : ''; |
| 16 | $menu1_title = isset($attributes['menu1Title']) ? $attributes['menu1Title'] : 'Explore'; |
| 17 | $menu2_slug = isset($attributes['menu2Slug']) ? $attributes['menu2Slug'] : ''; |
| 18 | $menu2_title = isset($attributes['menu2Title']) ? $attributes['menu2Title'] : 'Say Hello!'; |
| 19 | $copyright_text = isset($attributes['copyrightText']) ? $attributes['copyrightText'] : 'All the fun reserved.'; |
| 20 | $footer_style = isset($attributes['footerStyle']) ? $attributes['footerStyle'] : 'fun'; |
| 21 | $bio_text = isset($attributes['bioText']) ? $attributes['bioText'] : ''; |
| 22 | |
| 23 | $logo_type = isset($attributes['logoType']) ? $attributes['logoType'] : 'custom'; |
| 24 | $logo_image_url = isset($attributes['logoImageUrl']) ? $attributes['logoImageUrl'] : ''; |
| 25 | $logo_image_id = isset($attributes['logoImageId']) ? $attributes['logoImageId'] : 0; |
| 26 | |
| 27 | $show_curve = isset($attributes['showCurve']) ? $attributes['showCurve'] : true; |
| 28 | $curve_color = isset($attributes['curveColor']) ? $attributes['curveColor'] : '#FFF8E7'; |
| 29 | |
| 30 | $is_elegant = $footer_style === 'elegant'; |
| 31 | |
| 32 | // Default Colors based on Style |
| 33 | $default_bg = $is_elegant ? '#1e293b' : '#264653'; |
| 34 | $default_text = $is_elegant ? '#94a3b8' : '#FFFDF5'; |
| 35 | $default_heading = $is_elegant ? '#FFFFFF' : '#FFD166'; |
| 36 | |
| 37 | // User Overrides |
| 38 | $footer_bg_color = isset($attributes['footerBgColor']) && !empty($attributes['footerBgColor']) ? $attributes['footerBgColor'] : $default_bg; |
| 39 | $text_color = isset($attributes['textColor']) && !empty($attributes['textColor']) ? $attributes['textColor'] : $default_text; |
| 40 | $heading_color = isset($attributes['headingColor']) && !empty($attributes['headingColor']) ? $attributes['headingColor'] : $default_heading; |
| 41 | |
| 42 | $footer_title_color = isset($attributes['footerTitleColor']) ? $attributes['footerTitleColor'] : ''; |
| 43 | $footer_title_hover_color = isset($attributes['footerTitleHoverColor']) ? $attributes['footerTitleHoverColor'] : ''; |
| 44 | $social_icon_color = isset($attributes['socialIconColor']) ? $attributes['socialIconColor'] : ''; |
| 45 | $social_icon_hover_color = isset($attributes['socialIconHoverColor']) ? $attributes['socialIconHoverColor'] : ''; |
| 46 | |
| 47 | $block_id = isset($attributes['blockId']) ? $attributes['blockId'] : uniqid('footer-'); |
| 48 | |
| 49 | // Fetch menu items |
| 50 | $menu1_items = !empty($menu1_slug) ? wp_get_nav_menu_items($menu1_slug) : []; |
| 51 | $menu2_items = !empty($menu2_slug) ? wp_get_nav_menu_items($menu2_slug) : []; |
| 52 | |
| 53 | // Get current year |
| 54 | $current_year = date('Y'); |
| 55 | |
| 56 | // Determine Logo Content |
| 57 | $logo_content = ''; |
| 58 | if ($logo_type === 'image' && !empty($logo_image_url)) { |
| 59 | $logo_content = sprintf( |
| 60 | '<img src="%s" alt="%s" class="awt-footer-logo-img w-48 mx-auto md:mx-0 h-auto" />', |
| 61 | esc_url($logo_image_url), |
| 62 | esc_attr($logo_text) |
| 63 | ); |
| 64 | } elseif ($logo_type === 'site_title') { |
| 65 | $logo_content = get_bloginfo('name'); |
| 66 | } else { |
| 67 | $logo_content = esc_html($logo_text); |
| 68 | } |
| 69 | |
| 70 | |
| 71 | // CSS Variables for dynamic styling |
| 72 | $css_vars = "style=\" |
| 73 | --awt-footer-bg: {$footer_bg_color}; |
| 74 | --awt-footer-text: {$text_color}; |
| 75 | --awt-footer-heading: {$heading_color}; |
| 76 | --awt-title-color: " . ($footer_title_color ? $footer_title_color : 'inherit') . "; |
| 77 | --awt-title-hover: " . ($footer_title_hover_color ? $footer_title_hover_color : ($footer_title_color ? $footer_title_color : 'inherit')) . "; |
| 78 | --awt-social-color: " . ($social_icon_color ? $social_icon_color : $text_color) . "; |
| 79 | --awt-social-hover: " . ($social_icon_hover_color ? $social_icon_hover_color : $heading_color) . "; |
| 80 | --awt-heading-color: {$heading_color}; |
| 81 | --awt-curve-color: {$curve_color}; |
| 82 | background-color: var(--awt-footer-bg); |
| 83 | color: var(--awt-footer-text); |
| 84 | \""; |
| 85 | |
| 86 | // Scoped Styles for Hover States |
| 87 | $scoped_style = "<style> |
| 88 | .block-{$block_id} .awt-footer-title { color: var(--awt-title-color) !important; } |
| 89 | .block-{$block_id} .awt-footer-title:hover { color: var(--awt-title-hover) !important; } |
| 90 | .block-{$block_id} .awt-social-icon { color: var(--awt-social-color) !important; } |
| 91 | .block-{$block_id} .awt-social-icon:hover { color: var(--awt-social-hover) !important; } |
| 92 | .block-{$block_id} .awt-menu-heading { color: var(--awt-heading-color) !important; } |
| 93 | </style>"; |
| 94 | |
| 95 | // Get Social Icons from Global Settings |
| 96 | if (function_exists('rswpthemes_awt_get_social_icons')) { |
| 97 | $social_icons_html = rswpthemes_awt_get_social_icons($footer_style, [ |
| 98 | 'color' => $social_icon_color, // Passed for reference, but usually handled by CSS class/vars |
| 99 | ]); |
| 100 | } else { |
| 101 | $social_icons_html = '<p class="text-xs opacity-50">Social icons unavailable.</p>'; |
| 102 | } |
| 103 | |
| 104 | ?> |
| 105 | |
| 106 | <?php echo $scoped_style; ?> |
| 107 | |
| 108 | <footer class="awt-child-author-footer pt-20 pb-10 relative block-<?php echo esc_attr($block_id); ?>" <?php echo $css_vars; ?>> |
| 109 | |
| 110 | <?php if (!$is_elegant && $show_curve): ?> |
| 111 | <!-- SVG Wave Decorator (Fun Style Only) --> |
| 112 | <div class="absolute top-0 left-0 w-full"> |
| 113 | <svg viewBox="0 0 1440 100" fill="none" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"> |
| 114 | <path d="M0 0H1440V100C1192.5 50.503 919.5 25.503 720 25.503C520.5 25.503 247.5 50.503 0 100V0Z" |
| 115 | fill="var(--awt-curve-color)" /> |
| 116 | </svg> |
| 117 | </div> |
| 118 | <?php endif; ?> |
| 119 | |
| 120 | <div class="awt-container container mx-auto px-6 relative z-10"> |
| 121 | |
| 122 | <?php if ($is_elegant): ?> |
| 123 | <!-- ELEGANT LAYOUT --> |
| 124 | <div class="grid md:grid-cols-3 gap-12 text-center md:text-left"> |
| 125 | <!-- Column 1: Author, Bio, Socials --> |
| 126 | <div> |
| 127 | <a href="#" class="awt-footer-title text-3xl font-serif font-bold mb-6 block" style="color: var(--awt-title-color);"> |
| 128 | <?php echo $logo_content; ?> |
| 129 | </a> |
| 130 | |
| 131 | <?php if (!empty($bio_text)): ?> |
| 132 | <p class="mb-6 opacity-80 text-sm leading-relaxed max-w-sm mx-auto md:mx-0"> |
| 133 | <?php echo wp_kses_post($bio_text); ?> |
| 134 | </p> |
| 135 | <?php endif; ?> |
| 136 | |
| 137 | <div class="flex space-x-6 justify-center md:justify-start"> |
| 138 | <?php echo $social_icons_html; ?> |
| 139 | </div> |
| 140 | </div> |
| 141 | |
| 142 | <!-- Column 2: Menu 1 --> |
| 143 | <div> |
| 144 | <h5 class="awt-menu-heading font-sans text-xs font-bold uppercase tracking-wider mb-4" style="color: var(--awt-heading-color);"><?php echo esc_html($menu1_title); ?></h5> |
| 145 | <?php if (!empty($menu1_items)): ?> |
| 146 | <ul class="space-y-3 list-none text-sm"> |
| 147 | <?php foreach ($menu1_items as $item): ?> |
| 148 | <li><a href="<?php echo esc_url($item->url); ?>" class="hover:text-white transition-colors" style="color: var(--awt-footer-text);"><?php echo esc_html($item->title); ?></a></li> |
| 149 | <?php endforeach; ?> |
| 150 | </ul> |
| 151 | <?php endif; ?> |
| 152 | </div> |
| 153 | |
| 154 | <!-- Column 3: Menu 2 --> |
| 155 | <div> |
| 156 | <h5 class="awt-menu-heading font-sans text-xs font-bold uppercase tracking-wider mb-4" style="color: var(--awt-heading-color);"><?php echo esc_html($menu2_title); ?></h5> |
| 157 | <?php if (!empty($menu2_items)): ?> |
| 158 | <ul class="space-y-3 list-none text-sm"> |
| 159 | <?php foreach ($menu2_items as $item): ?> |
| 160 | <li><a href="<?php echo esc_url($item->url); ?>" class="hover:text-white transition-colors" style="color: var(--awt-footer-text);"><?php echo esc_html($item->title); ?></a></li> |
| 161 | <?php endforeach; ?> |
| 162 | </ul> |
| 163 | <?php endif; ?> |
| 164 | </div> |
| 165 | </div> |
| 166 | |
| 167 | <div class="border-t border-gray-800 mt-12 pt-8 text-center text-xs text-gray-400 opacity-50"> |
| 168 | <p>© <?php echo esc_html($current_year); ?> <?php echo esc_html($logo_text); ?>. |
| 169 | <?php echo esc_html($copyright_text); ?></p> |
| 170 | </div> |
| 171 | |
| 172 | <?php else: ?> |
| 173 | <!-- FUN LAYOUT (Default) --> |
| 174 | <div class="grid md:grid-cols-3 gap-12 text-center md:text-left"> |
| 175 | <!-- Column 1: Logo & Social --> |
| 176 | <div> |
| 177 | <a href="#" class="awt-footer-title text-3xl font-black mb-6 block" style="color: var(--awt-footer-heading);"> |
| 178 | <?php echo $logo_content; ?> |
| 179 | </a> |
| 180 | <div class="flex space-x-6 justify-center md:justify-start"> |
| 181 | <?php echo $social_icons_html; ?> |
| 182 | </div> |
| 183 | </div> |
| 184 | |
| 185 | <!-- Menus (Fun Style) --> |
| 186 | <div> |
| 187 | <h5 class="awt-menu-heading font-sans text-sm font-bold uppercase tracking-wider mb-4" style="color: var(--awt-heading-color);"><?php echo esc_html($menu1_title); ?></h5> |
| 188 | <?php if (!empty($menu1_items)): ?> |
| 189 | <ul class="space-y-3 list-none text-center md:text-left p-0"> |
| 190 | <?php foreach ($menu1_items as $item): ?> |
| 191 | <li><a href="<?php echo esc_url($item->url); ?>" class="hover:text-white transition-colors" style="color: var(--awt-footer-text);"><?php echo esc_html($item->title); ?></a></li> |
| 192 | <?php endforeach; ?> |
| 193 | </ul> |
| 194 | <?php endif; ?> |
| 195 | </div> |
| 196 | |
| 197 | <div> |
| 198 | <h5 class="awt-menu-heading font-sans text-sm font-bold uppercase tracking-wider mb-4" style="color: var(--awt-heading-color);"><?php echo esc_html($menu2_title); ?></h5> |
| 199 | <?php if (!empty($menu2_items)): ?> |
| 200 | <ul class="space-y-3 list-none text-center md:text-left p-0"> |
| 201 | <?php foreach ($menu2_items as $item): ?> |
| 202 | <li><a href="<?php echo esc_url($item->url); ?>" class="hover:text-white transition-colors" style="color: var(--awt-footer-text);"><?php echo esc_html($item->title); ?></a></li> |
| 203 | <?php endforeach; ?> |
| 204 | </ul> |
| 205 | <?php endif; ?> |
| 206 | </div> |
| 207 | </div> |
| 208 | |
| 209 | <div class="border-t border-cream/20 mt-12 pt-8 text-center"> |
| 210 | <p class="text-sm" style="color: var(--awt-footer-text);"> |
| 211 | Copyright © <?php echo $current_year; ?> <?php echo esc_html($logo_text); ?>. |
| 212 | <?php echo esc_html($copyright_text); ?> |
| 213 | </p> |
| 214 | </div> |
| 215 | |
| 216 | <?php endif; ?> |
| 217 | </div> |
| 218 | </footer> |