gnore WordPress.Security.NonceVerification.Recommended
}
$url = get_preview_post_link( $post, $query_args, $url );
}
return $url;
}
/**
* Returns whether the footer can be displayed.
*
* @param int $id The post ID.
* @return bool Whether the footer can be displayed.
*/
function tripp_has_footer( $id = 0 ) {
if ( empty( $id ) ) {
$id = tripp_get_page_id();
}
return false === (bool) get_post_meta( $id, '_tripp_hide_footer', true );
}
/**
* Return whether the footer gap is visible.
*
* @param int $id The post ID.
* @return bool Whether the footer gap is visible.
*/
function tripp_has_footer_gap( $id = 0 ) {
if ( ( is_archive() && ! is_post_type_archive() ) ) {
return true;
}
if ( empty( $id ) ) {
$id = tripp_get_page_id();
}
return false === (bool) get_post_meta( $id, '_tripp_hide_footer_gap', true );
}
/**
* Determines if the Footer Logo can be displayed.
*
* @return bool Whether the Footer Logo can be displayed.
*/
function tripp_has_footer_logo() {
return (bool) get_theme_mod( 'footer_logo', 0 );
}
/**
* Prints out the footer widgets class.
*
* @param string $class Space-separated string.
* @param int $columns Number of columns.
*/
function tripp_footer_widgets_class( $class = '', $columns = 1 ) {
$classes = array( $class );
if ( absint( $columns ) > 1 ) {
$classes[] = "tripp-grid has-{$columns}-columns";
} else {
$classes[] = 'has-one-column';
}
echo esc_attr( implode( ' ', $classes ) );
}
/**
* Prints out the footer columns and widgets.
*
* @param int $columns Number of columns.
*/
function tripp_footer_columns( $columns = 1 ) {
$is_preview = is_customize_preview();
$max = $is_preview ? 4 : $columns;
for ( $i = 1; $i <= $max; $i++ ) {
$name = 'footer-' . $i;
$class = 'footer-col-' . esc_attr( $i );
if ( $is_preview && $i > $columns ) {
$class .= ' is-hidden';
}
echo '
';
dynamic_sidebar( $name );
echo '
';
}
}
/**
* Displays footer widgets.
*/
function tripp_footer_widgets() {
$columns = get_theme_mod( 'footer_widgets', 0 );
if ( absint( $columns ) > 0 ) {
get_template_part( 'template-parts/footer/footer', 'widgets', array( 'columns' => $columns ) );
}
}
/**
* Displays footer info.
*/
function tripp_footer_info() {
get_template_part( 'template-parts/footer/footer', 'info' );
}
/**
* Displays Footer Logo.
*/
function tripp_footer_logo() {
$html = '';
$footer_logo_id = absint( get_theme_mod( 'footer_logo', 0 ) );
// We have a logo. Logo is go.
if ( $footer_logo_id ) {
$footer_logo_attr = array();
$footer_logo_retina_id = absint( get_theme_mod( 'footer_logo_retina', 0 ) );
if ( $footer_logo_retina_id ) {
$srcsets = array();
$srcsets[] = wp_get_attachment_image_url( $footer_logo_id, 'full' ) . ' 1x';
$srcsets[] = wp_get_attachment_image_url( $footer_logo_retina_id, 'full' ) . ' 2x';
$footer_logo_attr['srcset'] = implode( ', ', $srcsets );
unset( $footer_logo_attr['sizes'] );
}
/*
* If the logo alt attribute is empty, get the site title and explicitly
* pass it to the attributes used by wp_get_attachment_image().
*/
$image_alt = get_post_meta( $footer_logo_id, '_wp_attachment_image_alt', true );
if ( empty( $image_alt ) ) {
$footer_logo_attr['alt'] = get_bloginfo( 'name', 'display' );
}
/*
* If the alt attribute is not empty, there's no need to explicitly pass
* it because wp_get_attachment_image() already adds the alt attribute.
*/
echo sprintf(
'',
esc_url( tripp_logo_url() ),
wp_get_attachment_image( $footer_logo_id, 'full', false, $footer_logo_attr )
);
} elseif ( is_customize_preview() ) {
// If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview).
echo sprintf(
'',
esc_url( tripp_logo_url() )
);
}
}
/**
* Displays footer menu.
*/
function tripp_footer_menu() {
if ( ( 'show' === get_theme_mod( 'footer_menu', '' ) || is_customize_preview() ) && has_nav_menu( 'footer' ) ) {
echo '';
}
}
/**
* Displays footer social links.
*/
function tripp_footer_social_links() {
$footer_links = get_theme_mod( 'footer_links', '' );
if ( function_exists( 'flextension_social_icons_widget' ) && ( ! empty( $footer_links ) || is_customize_preview() ) ) {
echo '';
}
}
/**
* Displays language switcher in the footer.
*
* @since 1.2.2
*/
function tripp_footer_language_switcher() {
if ( function_exists( 'wpml_footer_language_selector_action' ) && class_exists( 'WPML_Language_Switcher', false ) ) {
global $wpml_language_switcher;
if ( $wpml_language_switcher instanceof WPML_Language_Switcher ) {
$footer_slot = $wpml_language_switcher->get_slot( 'statics', 'footer' );
if ( true === (bool) $footer_slot->get( 'show' ) ) {
wpml_footer_language_selector_action();
}
}
}
}
/**
* Returns default Site Info.
*
* @return string Default site info.
*/
function tripp_default_site_info() {
$site_title = get_bloginfo( 'name' );
if ( empty( $site_title ) ) {
$site_title = 'Tripp';
}
return '© ' . gmdate( 'Y' ) . ' ' . $site_title . '. Proudly powered by WordPress.';
}
/**
* Displays Site Info in the footer.
*/
function tripp_footer_text() {
$html = get_theme_mod( 'footer_text', tripp_default_site_info() );
if ( ! empty( $html ) || is_customize_preview() ) {
echo '';
}
}
walking – Nos Dushi Bida