dralezero

Wordpress Standalone Page Load Example

Mar 16th, 2014
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.73 KB | None | 0 0
  1. <!-- a standalone mobile page with menu links to specific post_id (pages) for loading content -->
  2. <html>
  3. <head>
  4. <meta name="HandheldFriendly" content="true" />
  5. <meta name="viewport" content="width=device-width, height=device-height, user-scalable=no" />
  6. <meta name="ROBOTS" content="NOINDEX,NOFOLLOW" />
  7. <link rel="stylesheet" type="text/css" href="style.css" />
  8. </head>
  9. <body>
  10. <?php
  11.  
  12. require_once('../wp-load.php');
  13.  
  14. if(isset($_GET['p'])){
  15.  
  16.     $rb_page_id = $_GET['p'];
  17.    
  18.     switch($_GET['p']){
  19.    
  20.     case "schedule":
  21.         $rb_page_id = 43;
  22.     break;
  23.     case "contact":
  24.         $rb_page_id = 14;
  25.     break;
  26.     case "directions":
  27.         $rb_page_id = 12;
  28.     break;
  29.     case "newsletter":
  30.         $rb_page_id = 32;
  31.     break;
  32.     case "training":
  33.         $rb_page_id = 4;
  34.     break;
  35.    
  36.     }
  37.    
  38.     $post_id_rb = get_post($rb_page_id);
  39.  
  40.     $title = $post_id_rb->post_title;
  41. }
  42.  
  43.  
  44. ?>
  45. <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;" >
  46. <?php
  47. if(isset($_GET['p'])){
  48. echo $title;
  49. }else{ echo "Site Slogan"; }
  50. ?>
  51. </strong><br clear="all" /></header>
  52. <nav>
  53. <ul>
  54. <li><a href="/">Home</a></li>
  55. <li><a href="?p=schedule">Schedule</a></li>
  56. <li><a href="?p=newsletter">Newsletter</a></li>
  57. <li><a href="?p=training">Training</a></li>
  58. <li><a href="?p=directions">Directions</a></li>
  59. <li><a href="?p=contact">Contact</a></li>
  60. </ul>
  61. </nav>
  62. <br clear="both" />
  63. <section>
  64. <?php
  65.  
  66. if(isset($_GET['p'])){
  67.  
  68.     $content = $post_id_rb->post_content;
  69.     $content = apply_filters('the_content', $content);
  70.     $content = str_replace(']]>', ']]>', $content);
  71.     echo $content;
  72.  
  73. }else{
  74.  
  75. ?>
  76.  
  77. <p>stuff</p>
  78. <p>stuff</p>
  79. <p>stuff</p>
  80.  
  81. <?php } ?>
  82. </section>
  83. </body>
  84. </html>
Advertisement
Add Comment
Please, Sign In to add comment