<?php
/**
 * Generated by blog pipeline.
 */
get_header();
?>
<?php
	if ( ! defined( 'ABSPATH' ) ) {
		exit;
	}

	$page_id = get_queried_object_id();

	$short_description = get_post_meta(
		$page_id,
		'short_description',
		true
	);
?>
<header class="g-acc5cd1e" data-analytics-metric="fb91830" data-element-content="b90d06ceac" data-module-size="xl">
	<?php if ( has_post_thumbnail( $page_id ) ) : ?>
		<div class="g-846e6a86" id="elem-33541bb0244fed36">
			<figure class="g-f96596f1 g-e1b31ca9 g-7f49f79d">
				<?php
					echo get_the_post_thumbnail(
						$page_id,
						'',
						[
							'loading' => 'eager',
						]
					);
				?>
			</figure>
		</div>
	<?php endif; ?>
	<div class="g-7a59c22d" data-bs-color="primary" data-mui-elevation="d2b9dea6d83c" data-analytics-size="small" data-block-position="top" data-analytics-color="warning">
		<div class="g-f7622a82" id="elem-7a4b6dcddf27d6e0">
			<h1 class="g-30b81947 g-2ec69fc9" data-bs-goal="1984bda" data-analytics-variant="outlined">
				<?php echo esc_html( get_bloginfo( 'name' ) ); ?>
			</h1>
			<?php if ( ! empty( $short_description ) ) : ?>
				<div class="g-7f9fa2f8 g-4a7c5c5a g-9b9886c1" id="elem-e841759f2b455902">
					<?php echo esc_html( $short_description ); ?>
				</div>
			<?php endif; ?>
			<div class="g-0b919549 g-065f1332" data-element-state="active" data-bs-pause="b8661c6a5a" data-mui-toggle="collapse" data-test-action="submit">
				<?php get_template_part( 'templates/searchform' ); ?>
			</div>
		</div>
	</div>
</header>

<section class="g-e51ccfcf g-2d98e3f4" aria-labelledby="faq-title" data-module-content="49b316fa459a" data-analytics-testid="d7d45b31124" data-mui-elevation="600da6a9a8" data-bs-source="b4339b47" data-element-group="2b542ae2f">
    <div class="g-957a8097" id="elem-b1beafdc1a5a108e">
        <div class="g-86923634" data-bs-keyboard="53b4d87deb" data-element-role="main" data-component-theme="dark" data-bs-selector="3ec50dd">
            <header class="g-db46f085" id="elem-a9ce167319b6c084">
                <h2 id="faq-title" class="g-2ec69fc9 g-69753963" data-widget-role="sidebar" data-bs-focus="1fe102cf1" data-element-status="deleted" data-element-group="69f83bf767cf">Frequently Asked Questions About Car Ownership</h2>
                <p class="g-99fc6ecc g-d53a2e64 g-69753963" id="elem-cc7ff97f31f8ed30">
                    
                </p>
            </header>
            <ul class="g-94eb288c g-72872471" role="list" data-test-loading="4d0b6ea6ad5" data-component-action="focus" data-bs-disabled="8116cf5">
                <li role="listitem" id="elem-9817a41832150e71">
                    <details class="g-2b889348 g-a099c319 g-ea465c0f" data-widget-status="published" data-element-role="footer" data-bs-keyboard="724914326" data-module-action="focus" data-bs-dismiss="4a4dfb">
                        <summary class="g-155d09b9 g-ac617201 g-5caee912" id="elem-b3cddf319a1ca79a">
                            What factors should a beginner consider when selecting a used car?
                            <span class="g-55d2823d" aria-hidden="true" data-section-config="f59f7f6348" data-test-size="large" data-section-size="xs" data-test-pause="e85749800" data-bs-loading="9dd29d88">
                                <svg width="22" height="22" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg" id="elem-3b1ec4cf5d9a4c49">
                                    <path fill-rule="evenodd" clip-rule="evenodd"
                                          d="M11 22C10.4477 22 10 21.5523 10 21L10 12L0.999999 12C0.447715 12 -9.13368e-07 11.5523 -9.61651e-07 11C-1.00993e-06 10.4477 0.447715 10 0.999999 10L10 10L10 0.999999C10 0.447715 10.4477 -8.97416e-07 11 -9.45698e-07C11.5523 -9.9398e-07 12 0.447715 12 0.999999L12 10L21 10C21.5523 10 22 10.4477 22 11C22 11.5523 21.5523 12 21 12L12 12L12 21C12 21.5523 11.5523 22 11 22Z"/>
                                </svg>
                            </span>
                        </summary>
                        <div class="g-9389c064 g-72872471 g-afc070b9" data-test-qa="442b2844" data-component-priority="low" data-component-trigger="6225abb39" data-analytics-mock="8b84b3e779" data-widget-state="error">
                            Key factors include budget, mileage, maintenance history, and reliability ratings. A pre-purchase inspection by a mechanic can help identify potential issues.
                        </div>
                    </details>
                </li>
                <li role="listitem" class="g-d53a2e64" data-element-role="main" data-section-state="error">
                    <details class="g-2b889348 g-a099c319 g-ea465c0f" id="elem-1b70192d3facb47a">
                        <summary class="g-155d09b9 g-ac617201 g-5caee912" data-element-animation="bounce" data-section-status="deleted" data-test-elevation="c6c38b22260b" data-block-theme="dark">
                            How often should I perform basic maintenance like oil changes?
                            <span class="g-55d2823d" aria-hidden="true" id="elem-453d59ac0fc03393">
                                <svg width="22" height="22" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg" data-element-role="content" data-widget-size="large" data-mui-metric="66c8d2d2a" data-module-action="click" data-analytics-color="primary">
                                    <path fill-rule="evenodd" clip-rule="evenodd"
                                          d="M11 22C10.4477 22 10 21.5523 10 21L10 12L0.999999 12C0.447715 12 -9.13368e-07 11.5523 -9.61651e-07 11C-1.00993e-06 10.4477 0.447715 10 0.999999 10L10 10L10 0.999999C10 0.447715 10.4477 -8.97416e-07 11 -9.45698e-07C11.5523 -9.9398e-07 12 0.447715 12 0.999999L12 10L21 10C21.5523 10 22 10.4477 22 11C22 11.5523 21.5523 12 21 12L12 12L12 21C12 21.5523 11.5523 22 11 22Z"/>
                                </svg>
                            </span>
                        </summary>
                        <div class="g-9389c064 g-72872471 g-afc070b9" id="elem-d94137510895a5c0">
                            Oil change intervals vary by vehicle. Typically every 5,000 to 7,500 miles is recommended. Always check the owner&#039;s manual for specific guidance.
                        </div>
                    </details>
                </li>
                <li role="listitem" class="g-d53a2e64" id="elem-6eed1397ec59ec43">
                    <details class="g-2b889348 g-a099c319 g-ea465c0f" data-analytics-target="a40b1d" data-bs-action="submit" data-element-trigger="82e4de5d6b2f">
                        <summary class="g-155d09b9 g-ac617201 g-5caee912" data-bs-value="f309d0" data-component-position="left" data-block-animation="fade">
                            What are the early signs of brake problems?
                            <span class="g-55d2823d" aria-hidden="true" id="elem-b81836ad308e3f10">
                                <svg width="22" height="22" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg" data-section-mode="readonly" data-component-target="cbc77d9f" data-section-state="success" data-block-type="secondary">
                                    <path fill-rule="evenodd" clip-rule="evenodd"
                                          d="M11 22C10.4477 22 10 21.5523 10 21L10 12L0.999999 12C0.447715 12 -9.13368e-07 11.5523 -9.61651e-07 11C-1.00993e-06 10.4477 0.447715 10 0.999999 10L10 10L10 0.999999C10 0.447715 10.4477 -8.97416e-07 11 -9.45698e-07C11.5523 -9.9398e-07 12 0.447715 12 0.999999L12 10L21 10C21.5523 10 22 10.4477 22 11C22 11.5523 21.5523 12 21 12L12 12L12 21C12 21.5523 11.5523 22 11 22Z"/>
                                </svg>
                            </span>
                        </summary>
                        <div class="g-9389c064 g-72872471 g-afc070b9" id="elem-b12e3ce03ea05495">
                            Squealing or grinding noises, a soft brake pedal, or vibrations when braking can indicate worn pads or other issues. Regular inspection is advised.
                        </div>
                    </details>
                </li>
                <li role="listitem" class="g-d53a2e64" data-analytics-keyboard="d3106c4ae44f" data-module-mode="readonly">
                    <details class="g-2b889348 g-a099c319 g-ea465c0f" id="elem-0490b192d140ea2a">
                        <summary class="g-155d09b9 g-ac617201 g-5caee912" id="elem-acce5df8fa34f3f3">
                            Is it better to repair an old car or buy a new one?
                            <span class="g-55d2823d" aria-hidden="true" data-component-content="16b3dfcef13" data-bs-goal="8ddd257a04" data-component-state="success" data-component-target="87f086fcc" data-bs-testid="b01ac893">
                                <svg width="22" height="22" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg" id="elem-dec3ea3ad6dec3bd">
                                    <path fill-rule="evenodd" clip-rule="evenodd"
                                          d="M11 22C10.4477 22 10 21.5523 10 21L10 12L0.999999 12C0.447715 12 -9.13368e-07 11.5523 -9.61651e-07 11C-1.00993e-06 10.4477 0.447715 10 0.999999 10L10 10L10 0.999999C10 0.447715 10.4477 -8.97416e-07 11 -9.45698e-07C11.5523 -9.9398e-07 12 0.447715 12 0.999999L12 10L21 10C21.5523 10 22 10.4477 22 11C22 11.5523 21.5523 12 21 12L12 12L12 21C12 21.5523 11.5523 22 11 22Z"/>
                                </svg>
                            </span>
                        </summary>
                        <div class="g-9389c064 g-72872471 g-afc070b9" data-component-target="b976403c" data-analytics-wrap="c9c9dacf6658" data-component-theme="auto" data-mui-size="xl" data-bs-category="error">
                            Consider the cost of repairs versus the vehicle&#039;s value. If repairs exceed the car&#039;s worth or are frequent, a newer model may be more economical.
                        </div>
                    </details>
                </li>
                <li role="listitem" class="g-d53a2e64" data-component-config="321233a5" data-analytics-toggle="dropdown">
                    <details class="g-2b889348 g-a099c319 g-ea465c0f" id="elem-978dbad0c10881d2">
                        <summary class="g-155d09b9 g-ac617201 g-5caee912" id="elem-dd39f0acbaefb4f6">
                            How can I extend the life of my car&#039;s engine?
                            <span class="g-55d2823d" aria-hidden="true" data-widget-theme="light" data-block-group="30753de" data-mui-cy="3c84d313" data-widget-size="large">
                                <svg width="22" height="22" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg" id="elem-5639ce5f829ce4b8">
                                    <path fill-rule="evenodd" clip-rule="evenodd"
                                          d="M11 22C10.4477 22 10 21.5523 10 21L10 12L0.999999 12C0.447715 12 -9.13368e-07 11.5523 -9.61651e-07 11C-1.00993e-06 10.4477 0.447715 10 0.999999 10L10 10L10 0.999999C10 0.447715 10.4477 -8.97416e-07 11 -9.45698e-07C11.5523 -9.9398e-07 12 0.447715 12 0.999999L12 10L21 10C21.5523 10 22 10.4477 22 11C22 11.5523 21.5523 12 21 12L12 12L12 21C12 21.5523 11.5523 22 11 22Z"/>
                                </svg>
                            </span>
                        </summary>
                        <div class="g-9389c064 g-72872471 g-afc070b9" data-section-type="tertiary" data-bs-automation="c20e32232f9a" data-test-cy="4bdc69" data-module-role="main">
                            Regular oil changes, using quality fuel, avoiding hard acceleration, and keeping the cooling system in good condition contribute to engine longevity.
                        </div>
                    </details>
                </li>
            </ul>
        </div>
    </div>
</section>

<section class="g-fc02470c" data-bs-cy="391220" data-widget-position="left" data-block-mode="readonly" data-analytics-automation="3b2ef182b74">
    <div class="g-957a8097" id="elem-75d237849ca9bd02">
        <h2 class="g-2ec69fc9 g-011d5e5d" data-mui-locator="18405e71b0" data-test-event="click" data-bs-e2e="c53196587" data-section-handler="02f692a75b">All categories</h2>
        <div class="g-93e40f68" id="elem-c64f6394f3c41032">
            <?php
                $categories = get_categories(
                    [
                        'orderby'    => 'count',
                        'order'      => 'DESC',
                        'hide_empty' => true,
                    ]
                );

                if ( $categories ) :
                    ?>
                    <?php foreach ( $categories as $category ) : ?>
                    <?php $icon = get_term_meta( $category->term_id, 'icon', true ); ?>
                    <a
                        href="<?php echo esc_url( get_category_link( $category->term_id ) ); ?>"
                        class="g-e237137e"
                    >
                        <div class="g-d61bc791 g-ac617201">
                            <?php if ( ! empty( $icon ) ) : ?>
                                <span class="g-b9ba5d24">
                                    <?php echo esc_html( $icon ); ?>
                                </span>
                            <?php endif; ?>

                            <?php echo esc_html( $category->name ); ?>
                        </div>
                    </a>
                <?php endforeach; ?>
                <?php endif; ?>
        </div>
    </div>
</section>

<?php

	if ( ! defined( 'ABSPATH' ) ) {
		exit;
	}
	/**
	 * Popular post
	 */
	$popular_posts = get_posts(
		[
			'post_type'           => 'post',
			'posts_per_page'      => 1,
			'meta_key'            => 'is_popular',
			'meta_value'          => '1',
			'ignore_sticky_posts' => true,
		]
	);
	/**
	 * Latest posts
	 */
	$latest_posts = get_posts(
		[
			'post_type'           => 'post',
			'posts_per_page'      => 3,
			'post_status'         => 'publish',
			'ignore_sticky_posts' => true,
			'post__not_in'        => ! empty( $popular_posts )
				? [ $popular_posts[0]->ID ]
				: [],
		]
	);

?>
<section class="g-5d041be9" data-element-position="center" data-element-priority="high" data-element-handler="a641d57d" data-analytics-metric="a9a78f01" data-block-mode="disabled">
	<div class="g-957a8097" id="elem-50fd556c7de14e28">
		<div class="g-4af9e0d1" data-analytics-variant="contained" data-widget-trigger="f6e9d1c5" data-bs-fixture="a34f60e60" data-section-group="fa1242e6f">
			<?php if ( ! empty( $popular_posts ) ) : ?>
				<div
					class="g-e6e487ba"
					aria-labelledby="popular-post-title"
				>
					<div class="g-a74e7083" id="elem-9795b46d7e8db89c">
						<h2
							id="popular-post-title"
							class="g-83576681 g-2ec69fc9"
							data-section-handler="84f763" data-block-config="6ef10b6" data-test-pause="ee6b38b9d" data-mui-elevation="1fa4329" data-bs-selector="5ad8dd8b40"
						>
						Popular posts
						</h2>
					</div>
					<div class="g-d6548e2d g-065f1332" id="elem-3c667d4e79586f9e">
						<?php
							$post = $popular_posts[0];
							setup_postdata( $post );
							get_template_part(
								'templates/post-card',
								null,

							);
							wp_reset_postdata();
						?>
					</div>
				</div>
			<?php endif; ?>
			<?php if ( ! empty( $latest_posts ) ) : ?>
				<aside
					class="g-df782061"
					aria-labelledby="latest-posts-title"
				>
					<div class="g-a43d1e3b g-fac249ac" data-module-content="dc2c323d" data-test-dimension="9095946f58" data-module-mode="readonly" data-mui-size="xs">
						<h2
							id="latest-posts-title"
							class="g-83576681 g-e9694222"
							id="elem-fe40266b11a12938"
						>
						Latest posts
						</h2>
					</div>
					<?php
						foreach ( $latest_posts as $key => $post ) :
							setup_postdata( $post );
							?>
							<?php
							if ( $key !== 0 ) {
								echo '<hr class="g-5a13872b" />';
							}
							get_template_part(
								'templates/post-card',
								null,
								[
									'size' => 'small',
								]
							);
							?>
						<?php
						endforeach;
						wp_reset_postdata();
					?>
				</aside>
			<?php endif; ?>
		</div>
		<?php
			$posts_page_id = get_option( 'page_for_posts' );

			if ( $posts_page_id ) :
				?>
				<div class="g-4e34c618" data-component-group="3ed2ad44c3" data-mui-track="b8fd69" data-test-toggle="tooltip" data-test-expanded="1455b9929f">
					<a href="<?php echo esc_url( get_permalink( $posts_page_id ) ); ?>" class="g-52725655" id="elem-8e6ed53844b6ccaf">
						<span>View all</span>
					</a>
				</div>
			<?php endif; ?>
	</div>
</section>

<?php
	if ( ! defined( 'ABSPATH' ) ) {
		exit;
	}

	$render_page_content = static function ( string $content ): void {
		if ( $content === '' ) {
			return;
		}
		?>
		<div class="g-957a8097">
			<article id="post-<?php the_ID(); ?>" class="content-wrapper g-60ff7358">
				<?php echo apply_filters( 'the_content', $content ); ?>
			</article>
		</div>
		<?php
	};

	if ( in_the_loop() ) {
		$render_page_content( get_the_content() );
	} elseif ( have_posts() ) {
		while ( have_posts() ) {
			the_post();
			$render_page_content( get_the_content() );
		}
	}
?>
<?php get_footer(); ?>
