Dashboard
PHP:
8.1.33
OS:
Linux
User:
lawtemple
/
/
home
/
www
/
lawtemplefirm.com
/
wp-content
/
themes
/
law-temple-theme
/
inc
📤 Upload
📝 New File
📁 New Folder
Close
Editing: extended-settings.php
<?php if ( ! defined( 'ABSPATH' ) ) { exit; } /** Optional Google Fonts. Disabled by default for privacy/performance. */ function lt_theme_google_font_url() { if ( 'google' !== lt_theme_option( 'font_source' ) ) { return ''; } $families = array_filter( array_map( 'trim', array( lt_theme_option( 'google_body_family' ), lt_theme_option( 'google_heading_family' ) ) ) ); $clean = array(); foreach ( $families as $family ) { if ( preg_match( '/^[A-Za-z0-9 ]{2,60}$/', $family ) ) { $clean[] = str_replace( ' ', '+', $family ) . ':wght@400;500;600;700'; } } if ( ! $clean ) { return ''; } return 'https://fonts.googleapis.com/css2?family=' . implode( '&family=', array_map( 'rawurlencode', $clean ) ) . '&display=swap'; } function lt_theme_enqueue_optional_fonts() { $url = lt_theme_google_font_url(); if ( $url ) { wp_enqueue_style( 'lt-google-fonts', $url, array(), null ); } } add_action( 'wp_enqueue_scripts', 'lt_theme_enqueue_optional_fonts', 5 ); add_action( 'enqueue_block_editor_assets', 'lt_theme_enqueue_optional_fonts', 5 ); /** Restrict front-end search to the content types the law-firm framework owns plus pages. */ function lt_theme_search_query_types( $query ) { if ( is_admin() || ! $query->is_main_query() || ! $query->is_search() ) { return; } $query->set( 'post_type', apply_filters( 'lt_theme_search_post_types', array( 'page', 'practice', 'lawyer', 'insight', 'matter', 'office', 'career' ) ) ); $query->set( 'post_status', 'publish' ); } add_action( 'pre_get_posts', 'lt_theme_search_query_types', 20 ); function lt_theme_archive_layout( $post_type ) { $key = sanitize_key( $post_type ) . '_archive_layout'; return sanitize_html_class( lt_theme_option( $key, 'grid' ) ?: 'grid' ); } function lt_theme_archive_columns( $post_type ) { $specific = absint( lt_theme_option( sanitize_key( $post_type ) . '_archive_columns' ) ); return max( 1, min( 4, $specific ?: absint( lt_theme_option( 'archive_columns' ) ) ?: 3 ) ); } /** Common archive card renderer keeps archive templates consistent and child-theme overrideable. */ function lt_theme_archive_card( $post_id, $post_type = '' ) { $post_type = $post_type ?: get_post_type( $post_id ); do_action( 'lt_theme_before_archive_card', $post_id, $post_type ); echo '<article class="lt-card lt-card--' . esc_attr( $post_type ) . '">'; if ( has_post_thumbnail( $post_id ) ) { echo '<a class="lt-card-media" href="' . esc_url( get_permalink( $post_id ) ) . '">' . get_the_post_thumbnail( $post_id, 'lt-card' ) . '</a>'; } if ( 'career' === $post_type ) { $meta = array_filter( array( get_post_meta( $post_id, 'lt_location', true ), get_post_meta( $post_id, 'lt_employment_type', true ) ) ); if ( $meta ) { echo '<div class="lt-card-meta">' . esc_html( implode( ' · ', $meta ) ) . '</div>'; } } elseif ( 'office' === $post_type ) { $meta = array_filter( array( get_post_meta( $post_id, 'lt_city', true ), get_post_meta( $post_id, 'lt_country', true ) ) ); if ( $meta ) { echo '<div class="lt-card-meta">' . esc_html( implode( ', ', $meta ) ) . '</div>'; } } elseif ( 'award' === $post_type ) { $meta = array_filter( array( get_post_meta( $post_id, 'lt_awarding_org', true ), get_post_meta( $post_id, 'lt_year', true ) ) ); if ( $meta ) { echo '<div class="lt-card-meta">' . esc_html( implode( ' · ', $meta ) ) . '</div>'; } } elseif ( 'matter' === $post_type ) { $year = get_post_meta( $post_id, 'lt_year', true ); if ( $year ) { echo '<div class="lt-card-meta">' . esc_html( $year ) . '</div>'; } } echo '<h3><a href="' . esc_url( get_permalink( $post_id ) ) . '">' . esc_html( get_the_title( $post_id ) ) . '</a></h3>'; if ( has_excerpt( $post_id ) ) { echo '<p>' . esc_html( get_the_excerpt( $post_id ) ) . '</p>'; } echo '</article>'; do_action( 'lt_theme_after_archive_card', $post_id, $post_type ); } function lt_theme_global_cta() { $id=0;if(is_page()){$page_id=get_queried_object_id();$mode=get_post_meta($page_id,'lt_page_cta',true);if(!$mode||'inherit'===$mode)$mode=lt_theme_option('page_default_cta','inherit');if('hide'===$mode)return;$id=absint(get_post_meta($page_id,'lt_page_cta_id',true));}if(!$id)$id = absint( lt_theme_option( 'global_cta_id' ) ); if ( ! $id || 'lt_cta' !== get_post_type( $id ) || 'publish' !== get_post_status( $id ) ) { return; } $style = sanitize_html_class( get_post_meta( $id, 'lt_cta_style', true ) ?: 'primary' ); $eyebrow = get_post_meta( $id, 'lt_cta_eyebrow', true ); $label = get_post_meta( $id, 'lt_cta_button_label', true ); $url = get_post_meta( $id, 'lt_cta_button_url', true ); $label2 = get_post_meta( $id, 'lt_cta_secondary_label', true ); $url2 = get_post_meta( $id, 'lt_cta_secondary_url', true ); echo '<section class="lt-section"><div class="lt-container lt-cta lt-cta--' . esc_attr( $style ) . '">'; if ( $eyebrow ) { echo '<div class="lt-kicker">' . esc_html( $eyebrow ) . '</div>'; } echo '<h2>' . esc_html( get_the_title( $id ) ) . '</h2>'; if ( get_post_field( 'post_excerpt', $id ) ) { echo '<p>' . esc_html( get_post_field( 'post_excerpt', $id ) ) . '</p>'; } echo '<div class="lt-hero-actions">'; if ( $label && $url ) { echo '<a class="lt-button lt-button--light" href="' . esc_url( $url ) . '">' . esc_html( $label ) . '</a>'; } if ( $label2 && $url2 ) { echo '<a class="lt-button lt-button--outline-light" href="' . esc_url( $url2 ) . '">' . esc_html( $label2 ) . '</a>'; } echo '</div></div></section>'; }
Save
Cancel