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

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">

View File

@ -8,7 +8,7 @@ if ( !defined( 'WPINC' ) ) {
<?php if ( have_posts() ) :
the_post();
$id = get_the_ID();
$mf_id = get_the_ID();
?>
<div <?php post_class( "singular" ) ?>>
<?php if ( has_post_thumbnail() ): ?>

View File

@ -5,32 +5,32 @@ if ( !defined( 'WPINC' ) ) {
?>
<?php
$default_images = explode( ',', get_theme_mod( 'minimalistflex_default_featured_images' ));
$default_image_location = get_theme_mod( 'minimalistflex_default_featured_images_location', 'archive' );
$mf_default_images = explode( ',', get_theme_mod( 'minimalistflex_default_featured_images' ));
$mf_default_image_location = get_theme_mod( 'minimalistflex_default_featured_images_location', 'archive' );
?>
<?php get_header(); ?>
<?php if ( have_posts() ) :
the_post();
$id = get_the_author_meta( 'ID' );
$mf_id = get_the_author_meta( 'ID' );
?>
<div <?php post_class( "singular" ) ?>>
<?php if ( has_post_thumbnail() ): ?>
<div class="singular-image">
<?php the_post_thumbnail( 'large' ); ?>
</div>
<?php elseif ( ( $default_images[0] <> '' || minimalistflex_get_first_image() ) && $default_image_location <> 'no' && $default_image_location <> 'archive' ): ?>
<?php elseif ( ( $mf_default_images[0] <> '' || minimalistflex_get_first_image() ) && $mf_default_image_location <> 'no' && $mf_default_image_location <> 'archive' ): ?>
<?php if ( get_theme_mod( 'minimalistflex_default_featured_images_first_image', 'yes' ) === 'yes' && minimalistflex_get_first_image() ): ?>
<?php $imgsrc = minimalistflex_get_first_image(); ?>
<?php $mf_imgsrc = minimalistflex_get_first_image(); ?>
<?php else: ?>
<?php
$key = minimalistflex_get_seconds() % count($default_images);
$imgsrc = $default_images[$key];
$mf_key = minimalistflex_get_seconds() % count($mf_default_images);
$mf_imgsrc = $mf_default_images[$mf_key];
?>
<?php endif; ?>
<div class="singular-image">
<img src="<?php echo esc_url( $imgsrc ) ?>" aria-label="<?php
<img src="<?php echo esc_url( $mf_imgsrc ) ?>" aria-label="<?php
printf(
/* translators: %s: Title of the post. */
esc_attr__( 'The thumbnail image for %s.', 'minimalistflex' ),

View File

@ -4,14 +4,14 @@ if ( !defined( 'WPINC' ) ) {
}
?>
<?php $userid = get_the_author_meta( 'ID' ) ?>
<?php $mf_userid = get_the_author_meta( 'ID' ) ?>
<div class="singular-author">
<div class="author-card">
<div class="author-avatar">
<?php echo get_avatar( $userid, 80 ); ?>
<?php echo get_avatar( $mf_userid, 80 ); ?>
</div>
<div class="author-description">
<a class="author-link" href="<?php echo esc_url( get_author_posts_url( $userid ) ) ?>"><?php the_author() ?></a>
<a class="author-link" href="<?php echo esc_url( get_author_posts_url( $mf_userid ) ) ?>"><?php the_author() ?></a>
<p class="author-tagline"><?php the_author_meta( 'description' ) ?></p>
</div>
</div>

View File

@ -5,14 +5,14 @@ if ( !defined( 'WPINC' ) ) {
?>
<?php
$default_images = explode( ',', get_theme_mod( 'minimalistflex_default_featured_images' ));
$default_image_location = get_theme_mod( 'minimalistflex_default_featured_images_location', 'archive' );
$mf_default_images = explode( ',', get_theme_mod( 'minimalistflex_default_featured_images' ));
$mf_default_image_location = get_theme_mod( 'minimalistflex_default_featured_images_location', 'archive' );
?>
<?php while ( have_posts() ) :
the_post();
$id = get_the_author_meta('ID');
$post_id = get_the_ID();
$mf_id = get_the_author_meta('ID');
$mf_post_id = get_the_ID();
?>
<div <?php post_class("panel"); ?>>
<?php if ( has_post_thumbnail() ): ?>
@ -24,13 +24,13 @@ $default_image_location = get_theme_mod( 'minimalistflex_default_featured_images
) ?>">
<?php the_post_thumbnail( 'large' ); ?>
</a>
<?php elseif ( ( $default_images[0] <> '' || minimalistflex_get_first_image() ) && $default_image_location <> 'no' && $default_image_location <> 'single' ): ?>
<?php elseif ( ( $mf_default_images[0] <> '' || minimalistflex_get_first_image() ) && $mf_default_image_location <> 'no' && $mf_default_image_location <> 'single' ): ?>
<?php if ( get_theme_mod( 'minimalistflex_default_featured_images_first_image', 'yes' ) === 'yes' && minimalistflex_get_first_image() ): ?>
<?php $imgsrc = minimalistflex_get_first_image(); ?>
<?php $mf_imgsrc = minimalistflex_get_first_image(); ?>
<?php else: ?>
<?php
$key = minimalistflex_get_seconds() % count($default_images);
$imgsrc = $default_images[$key];
$mf_key = minimalistflex_get_seconds() % count($mf_default_images);
$mf_imgsrc = $mf_default_images[$mf_key];
?>
<?php endif; ?>
<a class="panel-image" href="<?php the_permalink() ?>" aria-label="<?php
@ -39,7 +39,7 @@ $default_image_location = get_theme_mod( 'minimalistflex_default_featured_images
esc_attr__( 'The thhumbnail image link for %s', 'minimalistflex' ),
get_the_title()
) ?>">
<img src="<?php echo esc_url( $imgsrc );?>" aria-label="<?php
<img src="<?php echo esc_url( $mf_imgsrc );?>" aria-label="<?php
printf(
/* translators: %s: Title of the post. */
esc_attr__( 'The thumbnail image for %s.', 'minimalistflex' ),
@ -74,15 +74,15 @@ $default_image_location = get_theme_mod( 'minimalistflex_default_featured_images
</div>
<div class="panel-meta">
<?php if ( get_theme_mod( 'minimalistflex_interface_publisher', 'yes' ) === 'yes' ): ?>
<a class="panel-author" href="<?php echo esc_url( get_author_posts_url($id) ) ?>">
<span aria-hidden="true"><?php echo get_avatar( $id, 80 ) ?></span>
<a class="panel-author" href="<?php echo esc_url( get_author_posts_url($mf_id) ) ?>">
<span aria-hidden="true"><?php echo get_avatar( $mf_id, 80 ) ?></span>
<?php the_author() ?>
</a>
<?php endif; ?>
<?php $datemode = get_theme_mod( 'minimalistflex_interface_date', 'modify' ); ?>
<?php if ( $datemode <> 'no' ): ?>
<?php $mf_datemode = get_theme_mod( 'minimalistflex_interface_date', 'modify' ); ?>
<?php if ( $mf_datemode <> 'no' ): ?>
<div class="panel-author">
<?php if ( $datemode === 'publish' || get_the_modified_date() <> get_the_date() ): ?>
<?php if ( $mf_datemode === 'publish' || get_the_modified_date() <> get_the_date() ): ?>
<?php printf(
/* translators: %s: Post publish time. */
esc_html__( 'Published on %s', 'minimalistflex' ),

View File

@ -5,31 +5,31 @@ if ( !defined( 'WPINC' ) ) {
?>
<div class="singular-meta">
<?php $tags = get_the_category(); ?>
<?php if( $tags ): ?>
<?php $mf_tags = get_the_category(); ?>
<?php if( $mf_tags ): ?>
<div class="singular-categories">
<div class="categories-indicator">
<?php esc_html_e( 'Categories:', 'minimalistflex' ) ?>
</div>
<?php foreach( $tags as $tag ) { ?>
<?php foreach( $mf_tags as $mf_tag ) { ?>
<div class="singular-category">
<a href="<?php echo esc_url( get_category_link( $tag ) ) ?>">
<?php echo $tag->name; ?>
<a href="<?php echo esc_url( get_category_link( $mf_tag ) ) ?>">
<?php echo $mf_tag->name; ?>
</a>
</div>
<?php } ?>
</div>
<?php endif; ?>
<?php $tags = get_the_tags(); ?>
<?php if( $tags ): ?>
<?php $mf_tags = get_the_tags(); ?>
<?php if( $mf_tags ): ?>
<div class="singular-categories singular-tags">
<div class="categories-indicator tags-indicator">
<?php esc_html_e( 'Tags:', 'minimalistflex' ) ?>
</div>
<?php foreach( $tags as $tag ) { ?>
<?php foreach( $mf_tags as $mf_tag ) { ?>
<div class="singular-category singular-tag">
<a href="<?php echo esc_url( get_tag_link( $tag ) ) ?>">
<?php echo $tag->name; ?>
<a href="<?php echo esc_url( get_tag_link( $mf_tag ) ) ?>">
<?php echo $mf_tag->name; ?>
</a>
</div>
<?php } ?>