开发者

Page title show "page not found" on wordpress

开发者 https://www.devze.com 2023-04-13 03:17 出处:网络
i made a couple of php pages开发者_开发百科 and integrated them into wordpress. The first page is fine, but the second one show \"page not found\" on the title when it is loaded.

i made a couple of php pages开发者_开发百科 and integrated them into wordpress. The first page is fine, but the second one show "page not found" on the title when it is loaded. You can find the first page here: http://www.stefanovirgulti.it/spese.php then click on "Aggiungi Negozio" to go to second page.

code of first page:

(suppressed wordpress template code)
//if ( is_user_logged_in() ){
if ( true ){
    $index=linkBuilder("Aggiungi Negozio",$_SERVER['PHP_SELF']."?p=1");
    $appPath="./moneym/";
    //$page=$_GET["p"];
    switch ($_GET["p"])
    {
            case 1:   
                $page="negozi.php";
            break;
            default:   
                echo "this is the first page<br>";
                echo $index;
            break;
    } 
    if ($page != "") include $appPath.$page;
}
else {
    echo "This is a private page.<br>";
}
function linkBuilder($name,$path){
    return sprintf("<a href=\"%s\">%s</a> ",$path,$name);
}
(suppressed wordpress template code)

The code of the second page contains only an echo.

How do i fix this?

PS: the second page works, but if you check the title page, it says "page not found" and i can't change that, this is my problem.


How did you create these pages? Without looking at your header.php file I'll assume your using some sort of default code to get the page title. To create new pages in wordpress you need to create them in the backend admin panel. if your just loading in files, the wordpress enviroment will see this as a page that doesn't exist.


Solved!

I found the "page custom template" functionality. I just made a template with all my code, then used it as template for a wp static page. I have done the custom template starting from page.php of my current template, took off the code that handles the content, and replace it with my php/sql stuff. I have made a new page inside wp and used this custom template. In this way i have a page that does what i want, but act as a real wp page, i can even add it to menus and apply whatever plugin to it. I left the title funcionality so i can change the title of my cutom page from wp admin.


THe reason for this is that one of your included phps includes a check for wordpress environment and displays that title when the condition is satisfied.

The solution is to use php to output "" tags before the included file is loaded.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号