dralezero icon

Wordpress Standalone Page Load Example

dralezero | PRO | 03/16/14 06:26:30 AM UTC | 0 ⭐ | 517 👁️ | Never ⏰ | []
PHP |

1.73 KB

|

None

|

0 👍

/

0 👎

<!-- a standalone mobile page with menu links to specific post_id (pages) for loading content -->
<html>
<head>
<meta name="HandheldFriendly" content="true" />
<meta name="viewport" content="width=device-width, height=device-height, user-scalable=no" />
<meta name="ROBOTS" content="NOINDEX,NOFOLLOW" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<?php
 
require_once('../wp-load.php');
 
if(isset($_GET['p'])){
 
    $rb_page_id = $_GET['p'];
    
    switch($_GET['p']){
    
    case "schedule":
        $rb_page_id = 43;
    break;
    case "contact":
        $rb_page_id = 14;
    break;
    case "directions":
        $rb_page_id = 12;
    break;
    case "newsletter":
        $rb_page_id = 32;
    break;
    case "training":
        $rb_page_id = 4;
    break;
    
    }
    
    $post_id_rb = get_post($rb_page_id);
 
    $title = $post_id_rb->post_title;
}
 
 
?>
<header><a href="./"><img src="logo.jpg" alt="Site logo" id="logo" align="left" style="margin:0px 10px 0px 0px" /></a><strong align="left" style="padding-top:8%;display:block;" >
<?php
if(isset($_GET['p'])){
echo $title; 
}else{ echo "Site Slogan"; }
?>
</strong><br clear="all" /></header>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="?p=schedule">Schedule</a></li>
<li><a href="?p=newsletter">Newsletter</a></li>
<li><a href="?p=training">Training</a></li>
<li><a href="?p=directions">Directions</a></li>
<li><a href="?p=contact">Contact</a></li>
</ul>
</nav>
<br clear="both" />
<section>
<?php
 
if(isset($_GET['p'])){
 
    $content = $post_id_rb->post_content;
    $content = apply_filters('the_content', $content);
    $content = str_replace(']]>', ']]>', $content);
    echo $content;
 
}else{
 
?>
 
<p>stuff</p>
<p>stuff</p>
<p>stuff</p>
 
<?php } ?>
</section>
</body>
</html>

Comments