打开自定义php文件时保持WordPress主题和布局


Keeping WordPress theme and layout when opening custom php file

我正在尝试将一些定制的php文件合并到WordPress网站中。在这些文件中创建了指向其他文件的链接。

<?
    echo "<a href=show.php?x=" . $row['Name'] . ">" $row['Name'] . "</a><br> ";
?>

这适用于WordPress的php执行插件。唯一的问题是show.php打开时没有WordPress主题和布局。

我如何制作一个链接,以便在与WordPress页面布局相同的(侧)栏/框架中打开一个新的php文件?

you need to create a custom template for that
The syntax is something like this:
<?php
/*
Template Name: My Custom Page
*/
get_header();
?>
Here your HTML coding goes
<?php get_footer(); ?>
This will give you the look and feel you are looking for!!

找到了我自己关于的工作

在WordPress中创建一个页面(page_id=x),并包含一个execphp插件。在页面上包含此代码。

<? 
$page_include =$_GET["page_include"];
include $page_include; 
?>

如果你想在wordpress中显示自定义页面,请制作以下链接:

<? 
echo "<a href=?page_id=x&page_include=" . $page_link . "> link </a>"
?>