Last active
December 11, 2015 11:39
-
-
Save surefirewebserv/4595700 to your computer and use it in GitHub Desktop.
This snippet strips the URI of the web address no matter what page your on. Then adds a meta description according to that page name. So in the case of 'connect' the web page would actually be www.sitename.com/whatever/connect.php and anything you put within that case, would only effect that page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$thisPage = $_SERVER["REQUEST_URI"]; | |
function get_page_name ( $page ) | |
{ | |
$array = explode( "/", $page ); | |
for ( $i = 0; $i < count( $array ); $i++ ) | |
{ | |
$name = $array[ $i ]; | |
} | |
$x = strpos( $name, ".php" ); | |
$name = substr( $name, 0, $x ); | |
$name = strtolower( $name ); | |
return $name; | |
} | |
switch (get_page_name($thisPage)) { | |
case 'connect': | |
echo'<meta name="description" content="">'; | |
break; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment