PluginProbe ʕ •ᴥ•ʔ
Author Website Templates – Create Writer, Author & Publisher Websites Easily / 1.1.9
Author Website Templates – Create Writer, Author & Publisher Websites Easily v1.1.9
trunk 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9
author-website-templates / build / blocks / child-author / page-title / render.php
author-website-templates / build / blocks / child-author / page-title Last commit date
block.json 1 month ago index.asset.php 1 month ago index.js 1 month ago render.php 1 month ago
render.php
142 lines
1 <?php
2 /**
3 * Render template for Child Author Page Title block
4 *
5 * @package Author_Website_Templates
6 */
7
8 // If direct access, exit
9 if (!defined('ABSPATH')) {
10 exit;
11 }
12
13 // Attributes with defaults
14 $titleStyle = isset($attributes['titleStyle']) ? $attributes['titleStyle'] : 'fun';
15 $badgeText = isset($attributes['badgeText']) ? $attributes['badgeText'] : 'Biography';
16 $heading = isset($attributes['heading']) ? $attributes['heading'] : 'So Nice to Meet You!';
17 $subHeading = isset($attributes['subHeading']) ? $attributes['subHeading'] : 'I\'m Danielle Steel, a writer of silly stories and a lover of big adventures.';
18 $sectionBgColor = isset($attributes['sectionBgColor']) ? $attributes['sectionBgColor'] : '';
19 $curveColor = isset($attributes['curveColor']) ? $attributes['curveColor'] : '#FFFDF5';
20 $headingColor = isset($attributes['headingColor']) ? $attributes['headingColor'] : '';
21 $textColor = isset($attributes['textColor']) ? $attributes['textColor'] : '';
22 $blockId = isset($attributes['blockId']) ? $attributes['blockId'] : '';
23
24 // Render Dynamic Content based on context
25 if (is_archive()) {
26 $heading = get_the_archive_title();
27 $subHeading = get_the_archive_description();
28 } elseif (is_search()) {
29 $heading = sprintf('Search Results for: %s', get_search_query());
30 $subHeading = '';
31 } elseif (is_404()) {
32 $heading = __('Page Not Found', 'author-website-templates');
33 $subHeading = __('It looks like nothing was found at this location.', 'author-website-templates');
34 } elseif (is_home() && !is_front_page()) {
35 $heading = single_post_title('', false);
36 $subHeading = '';
37 }
38
39
40 // Set default background color based on style if not explicitly set
41 if (empty($sectionBgColor)) {
42 if ($titleStyle === 'elegant') {
43 $sectionBgColor = '#f8fafc';
44 } elseif ($titleStyle === 'author-pro') {
45 $sectionBgColor = ''; // Uses bg-paper class
46 } else {
47 $sectionBgColor = 'rgba(0, 198, 255, 0.1)';
48 }
49 }
50
51 // Classes
52 $container_class = 'alignfull relative overflow-hidden pt-20 pb-28';
53 if ($titleStyle === 'author-pro') {
54 $container_class = 'relative pt-20 pb-20 bg-paper border-b border-gray-100 overflow-hidden';
55 }
56
57 if (!empty($blockId)) {
58 $container_class .= ' block-' . esc_attr($blockId);
59 }
60
61 // Heading Classes
62 if ($titleStyle === 'elegant') {
63 $heading_class = 'text-5xl md:text-7xl font-serif font-bold mb-6';
64 if (empty($headingColor)) {
65 $heading_class .= ' text-brand-dark';
66 }
67 } elseif ($titleStyle === 'author-pro') {
68 $heading_class = 'text-4xl md:text-5xl lg:text-6xl font-serif font-bold mb-6 leading-tight';
69 if (empty($headingColor)) {
70 $heading_class .= ' text-primary';
71 }
72 } else {
73 // Fun (default)
74 $heading_class = 'text-5xl md:text-7xl font-black mb-4';
75 if (empty($headingColor)) {
76 $heading_class .= ' text-navy';
77 }
78 }
79
80 // Subheading Classes
81 if ($titleStyle === 'elegant') {
82 $sub_heading_class = 'text-xl max-w-2xl mx-auto font-light leading-relaxed';
83 if (empty($textColor)) {
84 $sub_heading_class .= ' text-brand-gray';
85 }
86 } elseif ($titleStyle === 'author-pro') {
87 $sub_heading_class = 'text-lg leading-relaxed max-w-2xl mx-auto';
88 if (empty($textColor)) {
89 $sub_heading_class .= ' text-secondary';
90 }
91 } else {
92 // Fun (default)
93 $sub_heading_class = 'text-xl max-w-lg mx-auto';
94 if (empty($textColor)) {
95 $sub_heading_class .= ' text-navy/80';
96 }
97 }
98
99 $inner_container_class = 'awt-container mx-auto px-6 relative z-10 text-center';
100 if ($titleStyle === 'author-pro') {
101 $inner_container_class .= ' max-w-4xl';
102 }
103 if (is_tax('book-author')) {
104 return;
105 }
106 ?>
107
108 <section class="<?php echo esc_attr($container_class); ?>"
109 style="<?php echo !empty($sectionBgColor) ? 'background-color: ' . esc_attr($sectionBgColor) . ';' : ''; ?>">
110
111 <!-- Bottom SVG Wave - Only for Fun Style -->
112 <?php if ($titleStyle !== 'elegant' && $titleStyle !== 'author-pro'): ?>
113 <div class="absolute bottom-0 left-0 w-full">
114 <svg viewBox="0 0 1440 100" fill="none" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"
115 class="w-full h-auto">
116 <path d="M0 100H1440V0C1192.5 49.497 919.5 74.497 720 74.497C520.5 74.497 247.5 49.497 0 0V100Z"
117 fill="<?php echo esc_attr($curveColor); ?>" />
118 </svg>
119 </div>
120 <?php endif; ?>
121
122 <div class="<?php echo esc_attr($inner_container_class); ?>">
123 <!-- Badge - Only for Elegant Style -->
124 <?php if ($titleStyle === 'elegant' && !empty($badgeText)): ?>
125 <span class="font-bold text-gray-500 uppercase tracking-widest text-xs mb-4 block">
126 <?php echo esc_html($badgeText); ?>
127 </span>
128 <?php endif; ?>
129
130 <?php if (!empty($heading)): ?>
131 <h1 class="<?php echo esc_attr($heading_class); ?>" <?php echo !empty($headingColor) ? 'style="color: ' . esc_attr($headingColor) . ';"' : ''; ?>>
132 <?php echo wp_kses_post($heading); ?>
133 </h1>
134 <?php endif; ?>
135
136 <?php if (!empty($subHeading)): ?>
137 <p class="<?php echo esc_attr($sub_heading_class); ?>" <?php echo !empty($textColor) ? 'style="color: ' . esc_attr($textColor) . ';"' : ''; ?>>
138 <?php echo wp_kses_post($subHeading); ?>
139 </p>
140 <?php endif; ?>
141 </div>
142 </section>