我正在尝试修改footer.php模板,以便landing-template.php将显示“联系人”部分。
我尝试注释掉if ( !is_page_template( 'landing-template.php' ) )
中的$ footer_contacts_show和$ footer_contacts,但这没有任何效果。我对PHP不太熟悉,所以我想知道是否需要修改其他/其他代码,以便不会从Landing-template.php页面模板中删除“联系人”部分?
if ( !is_page_template( 'landing-template.php' ) ) {
$copyright_class = $footer_contacts_show = $footer_contacts = $description_enable = $description_title = $description_text = $description_columns = $description_class = $description_socials = $footer_fixed = $footer_text = $custom_icon = '';
global $allowedtags;
global $allowedposttags;
$my_theme = wp_get_theme();
if ( function_exists( 'fw_get_db_customizer_option' ) ) {
$show_search = fw_get_db_customizer_option( 'search-icon/value','yes' );
$search_style = fw_get_db_customizer_option( 'search-icon/yes/style','fullscreen' );
$footer_fixed = fw_get_db_customizer_option( 'footer_fixed',false );
$footer_text = fw_get_db_customizer_option( 'footer_text_color','' );
$footer_title = fw_get_db_customizer_option( 'footer_title_color','' );
$footer_contacts_show = fw_get_db_customizer_option( 'footer_contacts_show','yes' );
$footer_contacts = fw_get_db_customizer_option( 'footer_contacts','' );
这段代码就是呈现页面上该部分的地方:
<?php if ( 'no' !== $footer_contacts_show ) {
if ( !empty( $footer_contacts ) && is_array( $footer_contacts ) ) {
?>
<div class="row" itemscope itemtype="http://schema.org/Organization">
<div class="contacts">
<?php
$grid_class = 'col-lg-' . intval( 12 / count( $footer_contacts ) );
$grid_class = count( $footer_contacts ) > 1 ? $grid_class . ' col-md-6' : $grid_class . ' col-md-12';
foreach ( $footer_contacts as $contacts_item ) {
?>
<div class="<?php echo esc_attr( $grid_class ) ?> col-sm-12 col-xs-12">
<div class="contacts-item">
<div class="icon js-animate-icon">
<?php
if ( isset( $contacts_item[ 'icon' ] ) ) {
get_template_part( 'svg/' . $contacts_item[ 'icon' ] . '.svg' );
}
?>
</div>
<div class="content">
<?php
if ( !empty( $contacts_item[ 'title' ] ) ) {
if ( is_email( $contacts_item[ 'title' ] ) ) {
echo '<a href="mailto:' . esc_html( $contacts_item[ 'title' ] ) . '" class="title" itemprop="email">' . esc_html( $contacts_item[ 'title' ] ) . '</a>';
} else {
if ( false !== strpos( $contacts_item[ 'icon' ],'phone' ) ) {
$microdata = 'telephone';
} else {
$microdata = 'address';
}
echo '<span class="title" itemprop="' . esc_attr( $microdata ) . '">' . wp_kses( $contacts_item[ 'title' ],$allowedtags ) . '</span>';
}
}
if ( !empty( $contacts_item[ 'subtitle' ] ) ) {
echo '<p class="sub-title">' . wp_kses( $contacts_item[ 'subtitle' ],$allowedtags ) . '</p>';
}
?>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<?php }
}
?>