英文:
Use my index page as a different page in WordPress
问题
我理解您的问题是如何将现有的 index.php
页面更名为 architects.php
并创建一个新的 index.php
页面,其中包含四个按钮,其中一个按钮将访问新的 architects.php
页面,同时保持 architects.php
的设计和动画效果。
要实现这个目标,您可以按照以下步骤操作:
- 将
index.php
重命名为architects.php
。 - 创建一个新的
index.php
文件,其中包含您想要的四个按钮作为锚点。 - 在新的
index.php
文件中,使用 HTML 和链接标签 (<a>
) 创建这些按钮,并将其中一个按钮的链接指向architects.php
,其他按钮链接到其他页面。 - 确保您在
architects.php
中保留所需的动画效果和设计元素。
这样,您就可以实现您的目标,将 architects.php
作为一个独立的页面,并从新的 index.php
页面中链接到它。
英文:
I understand there's been a number of similar questions about this subject in the past years therefore I will try my best to be as descriptive as possible so my query can be understood from the get go. I am working on my WordPress site via my local machine, rolling on XAMPP and using Visual Studio Code as my code editor. I have my index.php set as my home page, this is the beginning of the code for such page:
<?php get_header(); ?>
<?php if (!post_password_required($post)) { ?>
<?php
//get theme option
$options = get_option('sample_theme_options');
//echo "wow" . $options['sometext'];
?>
<script>
var bgvidsrc = "<?php echo $options['bgv1']; ?>";
var bgvidsrc2 = "<?php echo $options['bgv2']; ?>";
var bgvidsrc3 = "<?php echo $options['bgv3']; ?>";
var bgvidsrc4 = "<?php echo $options['bgv4']; ?>";
var bgvidsrc5 = "<?php echo $options['bgv5']; ?>";
var bgvidsrc6 = "<?php echo $options['bgv6']; ?>";
</script>
<?php $path = get_template_directory_uri() . "/"; ?>
<!-- <body onload="init()"> -->
<body class="loading">
<div id="pt-main" class="pt-perspective">
My aim is to use this page as a different page which I want to rename as architects.php and access it via a new index page I am going to create, which will contain 4 buttons as anchors, and one of those will take the visitor to the new architects.php (the other 3 buttons will be for other 3 categories as pages which I will spin up too).
I need to maintain the design for the new architects.php as it contains animations I want to display, just not as the index page but as its unique page (architects.php)
How can I do this?
答案1
得分: 1
文件名architects.php
可以使用,但为了清晰起见,您可能想要在文件名前加上template-
前缀。关键是要向文件添加模板标头:
/**
* 模板名称:建筑师
*/
添加此标头将在“添加新页面”屏幕上的模板元框中的下拉菜单中添加“建筑师”。
英文:
The filename architects.php
will be fine, though you may want to prefix the filename with template-
for clarity. The key is to add a template header to the file:
/**
* Template name: Architects
*/
Adding that header will add "Architects" to the dropdown in the Template meta box on the "Add New Page" screen.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论