Skip to content

Instantly share code, notes, and snippets.

@kostiantyn-petlia
Last active August 29, 2015 14:26
Show Gist options
  • Save kostiantyn-petlia/1f975886d8a02351de9d to your computer and use it in GitHub Desktop.
Save kostiantyn-petlia/1f975886d8a02351de9d to your computer and use it in GitHub Desktop.
WP: get someone post (p=123)
query_posts('p=3547'); // - записи присвоен идентификатор, равный 3547.
if (have_posts()) : // - если есть вообще указанная запись.
while (have_posts()) : the_post(); // - начинаем традиционный цикл WordPress.
print '<div id="post-'; the_ID(); // - выводим ID записи и её класс.
print '"'; post_class(); print '>';
print '<h4>'. get_the_title(). '</h4>'; // - выводим заголовок.
print get_the_content(); // - выводим содержимое.
print '</div>';
endwhile;
endif;
// or
query_posts('name="Здесь должен быть прописан титл искомого поста блога"');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment