wp空主题

后补说明

现在发现有些简单的主题也好用。看好:kadence。

关于主题

wp一些设计,感觉和我的脚本系统很像。然后我感觉,可以把平时写的一些测试性的html,或者临时让AI帮我写的小工具,传到wp上用。

然后试了一些主题,感觉好像都会让wp系统变慢吧;也没有必要用复杂的主题。

于是弄了一个空主题;空主题主要是写了一些必要的代码,让打开Elementor编辑器的时候不会报错。

空主题的代码如下:

style.css

/*
Theme Name: FasWpEmp
Theme URI: https://example.com/mytheme
Author: Your Name
Author URI: https://example.com
Description: A custom WordPress theme.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: mytheme
*/

* {
    margin: 0;
    padding: 0;
}

 index.php

<?php get_header(); ?>

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        <?php the_content(); ?>
    </article>
<?php endwhile; endif; ?>

<?php get_footer(); ?>

footer.php

<hr>
<?php wp_footer(); ?>

functions.php

<?php
function mytheme_setup() {
    add_theme_support( 'title-tag' );
    add_theme_support( 'post-thumbnails' );
    register_nav_menus( array(
        'primary' => __( 'Primary Menu', 'mytheme' ), 
        'top_menu' => __('Top Menu', 'mytheme'),
    ) );
}
add_action( 'after_setup_theme', 'mytheme_setup');

 

posted @ 2025-03-31 16:36  法宝  阅读(14)  评论(0)    收藏  举报