• Resolved calle81

    (@calle81)


    Hi, I ask for very important help.

    In the player tab, I added a metric called “Player’s Agent” ( This is the link of the created metric: wp-admin/post.php?post=623&action=edit ).

    How can I activate the html code in that field ???

    I would like to enter the name of the player’s agent and the link to the agent’s site in that field. Example: <a href="https://www.agentsite.com/">Mario Rossi</a>.

    Thanks.

    • This topic was modified 4 years, 3 months ago by calle81.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Savvas

    (@savvasha)

    By default if you just copy paste <a href="https://www.agentsite.com/">Mario Rossi</a> to your metric field, it will be shown as a link in the frontend.

    Thanks,
    Savvas

    Thread Starter calle81

    (@calle81)

    @savvasha Hi, I entered it but in frontend it is seen as text and is not interpreted as html.

    Do you have any tips to solve the problem? Thanks for your time.

    Thread Starter calle81

    (@calle81)

    This is the php code used in my template header to show the metrics.

    <?php foreach ( $player_metrics as $player_metric_key => $player_metric_value ) : ?>
    						<?php if ( ! empty( $player_metrics_data[ $player_metric_key ] ) ) : ?>
    							<div class="player-info-details__item player-info-details__item--<?php echo esc_attr( $player_metric_key ); ?>">
    								<h6 class="player-info-details__title"><?php echo esc_html( $player_metric_value ); ?></h6>
    								<div class="player-info-details__value"><?php echo esc_html( $player_metrics_data[ $player_metric_key ] ); ?></div>
    							</div>
    						<?php endif; ?>
    					<?php endforeach; ?>

    Thanks.

    Plugin Contributor Savvas

    (@savvasha)

    Please try a default theme like Rookie or TwenetyTwenty. It should work. It seems like your theme used esc_html to prevent html links from showing in the frontend.

    Thanks,
    Savvas

    Thread Starter calle81

    (@calle81)

    @savvasha Thanks for the reply. I solved.

    I changed the code:

    <div class="player-info-details__value"><?php echo esc_html( $player_metrics_data[ $player_metric_key ] ); ?></div>

    in this way:

    <div class="player-info-details__value"><?php echo $player_metrics_data[ $player_metric_key ]; ?></div>

    Thanks.

    Plugin Contributor Savvas

    (@savvasha)

    I am glad you sorted it out @calle81 .
    Please dont forget to use a child theme, so as not to loose your changes on a theme update.

    Thanks,
    Savvas

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Html in Metric field.’ is closed to new replies.