Prefixed variables with mf_. Avoid conflicting.

This commit is contained in:
Frank419
2024-08-29 15:33:08 +08:00
parent 82b47c9804
commit 45e080cfba
6 changed files with 48 additions and 48 deletions
+12 -12
View File
@@ -8,42 +8,42 @@ if ( !defined( 'WPINC' ) ) {
<?php if ( have_posts() ) : ?>
<div class="minimalistflex-author">
<?php $id = get_the_author_meta( 'ID' ); ?>
<?php $mf_id = get_the_author_meta( 'ID' ); ?>
<h1 class="author-title panel">
<?php if ( get_theme_mod( 'minimalistflex_layout_author_title', 'yes' ) === 'yes' ): ?>
<?php the_archive_title() ?>
<?php endif; ?>
<div class="author-page-avatar<?php if ( user_can( $id, 'administrator' ) && get_theme_mod( 'minimalistflex_layout_author_admin', 'yes' ) === 'yes' ) {
<div class="author-page-avatar<?php if ( user_can( $mf_id, 'administrator' ) && get_theme_mod( 'minimalistflex_layout_author_admin', 'yes' ) === 'yes' ) {
echo ' author-admin';
} ?>" aria-hidden="true">
<?php echo get_avatar( $id, 150 ); ?>
<?php echo get_avatar( $mf_id, 150 ); ?>
</div>
</h1>
<div class="author-details">
<?php
$titles = Array(
$mf_titles = Array(
esc_html__( 'User description', 'minimalistflex' ),
esc_html__( 'Registration time', 'minimalistflex' ),
esc_html__( 'Website', 'minimalistflex' ),
esc_html__( 'Email', 'minimalistflex' )
);
$metas = Array(
$mf_metas = Array(
'description',
'user_registered',
'user_url',
'user_email'
);
$i = 0;
$mf_i = 0;
?>
<?php while ( $i < count( $metas ) ): ?>
<?php $meta = get_the_author_meta( $metas[$i] ); ?>
<?php if ( strlen( $meta ) && get_theme_mod( 'minimalistflex_layout_author_elements_' . $metas[$i], 'yes' ) === 'yes' ): ?>
<?php while ( $mf_i < 4 ): ?>
<?php $mf_meta = get_the_author_meta( $mf_metas[$mf_i] ); ?>
<?php if ( strlen( $mf_meta ) && get_theme_mod( 'minimalistflex_layout_author_elements_' . $mf_metas[$mf_i], 'yes' ) === 'yes' ): ?>
<div class="author-detail">
<h2><?php echo $titles[$i] ?></h2>
<?php echo esc_html( $meta ) ?>
<h2><?php echo $mf_titles[$mf_i] ?></h2>
<?php echo esc_html( $mf_meta ) ?>
</div>
<?php endif; ?>
<?php $i++; ?>
<?php $mf_i++; ?>
<?php endwhile; ?>
</div>
<h2 class="author-page-all-posts-title">