纯代码在wordpress加企业认证页

以下是创建WordPress企业认证页面的完整代码方案,包含自定义模板和样式:

把以下代码写enterprise-certification.php文件里。


<?php
/*
Template Name: 企业认证
*/
get_header(); ?>

<div class="enterprise-certification">
    <div class="cert-header">
        <h1><?php the_title(); ?></h1>
        <div class="badge">官方认证</div>
    </div>
    
    <div class="cert-content">
        <?php while (have_posts()) : the_post(); ?>
            <?php the_content(); ?>
        <?php endwhile; ?>
        
        <div class="cert-badges">
            <div class="badge-item">
                <img src="<?php echo get_template_directory_uri(); ?>/assets/icp-badge.png">
                <p>ICP备案认证</p>
            </div>
            <div class="badge-item">
                <img src="<?php echo get_template_directory_uri(); ?>/assets/business-license.png">
                <p>工商执照认证</p>
            </div>
        </div>
    </div>
    
    <div class="cert-footer">
        <p>最后更新: <?php echo get_the_modified_date(); ?></p>
    </div>
</div>

<?php get_footer(); ?>

把以下代码写style.css文件里。

/* 企业认证页面样式 */
.enterprise-certification {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    background: #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.cert-header {
    position: relative;
    padding-bottom: 20px;
    border-bottom: 2px solid #eaeaea;
}

.cert-header h1 {
    color: #333;
    font-size: 32px;
}

.cert-header .badge {
    position: absolute;
    right: 0;
    top: 0;
    background: #1890ff;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
}

.cert-content {
    padding: 30px 0;
    line-height: 1.8;
}

.cert-badges {
    display: flex;
    justify-content: center;
    margin: 40px 0;
    gap: 40px;
}

.badge-item {
    text-align: center;
}

.badge-item img {
    width: 120px;
    height: 120px;
    margin-bottom: 15px;
}

.badge-item p {
    font-weight: bold;
    color: #555;
}

.cert-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: center;
    color: #999;
    font-size: 14px;
}

使用说明:

1. 将php文件放入主题目录

2. 在WordPress后台创建新页面并选择”企业认证”模板

3. 上传认证徽章图片到主题assets目录