Last active
October 5, 2015 22:18
-
-
Save hissy/2886468 to your computer and use it in GitHub Desktop.
#WordPress Is current page? by page path
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 | |
/* | |
Usage: | |
if ( is_current_page_by_path( '/hoge' ) ) { | |
// is hoge page | |
} else { | |
// is not hoge page | |
} | |
*/ | |
function is_current_page_by_path( $path ){ | |
$post = get_post(); | |
$check_page = get_page_by_path( $path ); | |
if ( $post == $check_page ) { return true; } | |
else { return false; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment