doushang3352 2019-02-10 19:32
浏览 401

如何让Wordpress加载我的html和css代码

So I've been trying to create a homepage for my WP website that would have its own design not based on the theme. I want it to be a simple html and css page and then Wordpress stuff kicks in when a user clicks a link. I don't need header, footer sidebar tags or anything like that, you could say I just want an html/css homepage separate from the Wordpress.

I've read about custom templates and tried editing theme functions by adding this:

function wpse_enqueue_page_template_styles() {
if ( is_page_template( 'customhome.php' ) ) {
    wp_enqueue_style( 'page-template', get_stylesheet_directory_uri() . '/custom-home.css' );
  }
}
add_action( 'wp_enqueue_scripts', 'wpse_enqueue_page_template_styles' );

but when I create a page with the template it shows me plain html and doesn't load css.

I'm quite new to Wordpress theme editing and don't know php that much but adding your own html/css is said to be quite easy in WP.

How do I integrate my code into WP so it loads only my html with the correct css?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?
    • ¥20 java项目连接sqlserver时报ssl相关错误
    • ¥15 一道python难题3
    • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
    • ¥15 牛顿斯科特系数表表示
    • ¥15 arduino 步进电机
    • ¥20 程序进入HardFault_Handler
    • ¥15 oracle集群安装出bug
    • ¥15 关于#python#的问题:自动化测试