Last active
May 8, 2018 09:48
-
-
Save AnatoliyAkhmatov/efa66984580bb39e3c0499ae59b86ccd to your computer and use it in GitHub Desktop.
This file contains 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
$posts = get_posts([ 'category_name' => 'about_features', // slug или name категории | |
'numberposts' => '-1' ]); // кол-во постов -1 без лимита, 0 лимит заданный в админке | |
function post_by_slug($posts, $slug) { | |
for ($x = 0, $len = count( $posts ); $x < $len; $x++) { | |
if ($posts[$x]->post_name == $slug) { | |
return $posts[$x]; | |
} | |
} | |
return false; | |
} | |
$post = post_by_slug( $posts, 'about_quote' ); // обязательно использовать глобальую переменную $post | |
if ($post): setup_postdata( $post ); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment