我是wordpress的初学者,因为我正在使用论文主题而且我被停在一个地方并且不知道那个地方的解决方案。
问题是:
我想在论文主题中创建自定义页面模板,所以不知道如何做到这一点。那么如何在wordpress中创建自定义模板?提前致谢
您可以在Wordpress中创建自定义模板并将其存储在您正在使用的当前主题中
<?php
/* Template Name: ContactTemplate (like this try giving any logical name so that while using this template you can Remember it by name, this is for Contact page Template)
?>
<?php get_header(); //this will call your header files ?>
<?php
//your content goes here
//you can run custom Query here, try running query_posts(); if you want to show posts
?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
注意: - 此处页眉,页脚和侧边栏将对所有页面保持相同
用于在激活的主题文件夹中创建自定义模板创建文件。例如,如果您的自定义模板名称是“home_custom_template”。在您的文件中编写代码:
<?php
/*
Template Name: home_custom_template
*/
get_header();
?>
/*
Your Php and html code here...
*/
<?php get_footer();?>
1))
/*
Template Name: home_custom_template
*/
这段代码定义为wordpress这是模板。
2))创建新页面在wordpress中,页面右侧为模板下拉列表。你可以在那里找到你的模板。因此,请选择您的自定义模板和发布页面。