大家好,我只想问一问,是否可以在名称中添加帖子标题:在个人信息下,我想将user_name更改为post标题,以及如何将帖子标题添加到自定义元字段中
<?php
/**
* The template for displaying all single posts.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package Astra
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
get_header(); ?>
<?php if ( astra_page_layout() == 'left-sidebar' ) : ?>
<?php get_sidebar(); ?>
<?php endif ?>
<div id="primary" <?php astra_primary_class(); ?>>
<?php astra_primary_content_top(); ?>
<div class="custom-metafields">
<ul>
<h4>
<strong>I. Personal Information</strong>
</h4>
<li><strong>Name: </strong> <?php the_field('user_name'); ?></li>
<li><strong>Date of Birth: </strong> <?php the_field('Date_Birth'); ?></li>
<li><strong>Age: </strong> <?php the_field('user_age'); ?></li>
<li><strong>Occupation: </strong> <?php the_field('user_occupation'); ?></li>
<li><strong>Marital Status: </strong> <?php the_field('marital_status'); ?></li>
<br>
<br>
<h4>
<strong>II. Contact Information</strong>
</h4>
<li><strong>Email Address: </strong> <?php the_field('email_address'); ?></li>
<li><strong>Phone Number: </strong> <?php the_field('phone_number'); ?></li>
<li><strong>Address: </strong> <?php the_field('user_address'); ?></li>
<br>
<br>
<h4>
<strong>III. Report Details</strong>
</h4>
<li><strong>Type of Abuse: </strong> <?php the_field('Type_Abuse'); ?></li>
<li><strong>Photo Evidence: </strong></li>
</ul>
</div>
<?php astra_content_loop(); ?>
<?php astra_primary_content_bottom(); ?>
</div><!-- #primary -->
<?php if ( astra_page_layout() == 'right-sidebar' ) : ?>
<?php get_sidebar(); ?>
<?php endif ?>
<?php get_footer(); ?>发布于 2022-10-05 08:28:52
你可以这样做:
<li><strong>Name: </strong> <?php the_title(); ?></li>https://stackoverflow.com/questions/73955012
复制相似问题