Talk to friends,
I would like to know if you have any way to view the search made on a wordpress site like this:
Post ="x" format, and Page ="
Thanks!
Talk to friends,
I would like to know if you have any way to view the search made on a wordpress site like this:
Post ="x" format, and Page ="
Thanks!
In the search.php file of your WordPress theme, you can use the get_post_type (); method to check the content type of the post.
Example:
<?php
get_header();
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
//verifica se é post ou página
if (get_post_type() == "page") {
//exibe título da página em um retangulo
echo "<div class='retangulo'>";
the_title();
echo "</div>";
}
else if (get_post_type() == "post") {
//exibe título do post em um quadrado
echo "<div class='quadrado'>";
the_title();
echo "</div>";
}
}
}