Last active
March 1, 2022 00:53
-
-
Save LeoLopesWeb/215048855f7aac5e694c7b8dc8ecad83 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
function lista_paginas($atts) { | |
ob_start(); | |
$a = shortcode_atts( array( | |
'categoria' => '', | |
), $atts ); | |
echo'<div class="">'; | |
global $post; | |
$args = array( | |
'post_type' => 'page', | |
'posts_per_page' => -1, | |
'post_parent' => $post->ID, | |
'order' => 'DESC', | |
'orderby' => 'meta_value', | |
'ignore_sticky_posts' => true, | |
'post__not_in' => array( $post->ID ) | |
); | |
$query = new WP_Query( $args ); | |
if ( $query->have_posts() ) : | |
while ( $query->have_posts() ) : $query->the_post(); | |
echo '<div class="item">'; | |
echo '<a href="'.get_the_permalink().'">'; | |
echo '<p><img src="'.wp_get_attachment_url( get_post_thumbnail_id() ).'"></p>'; | |
echo '<h3>'.get_the_title().'</h3>'; | |
//echo '<p>'.get_the_content().'</p>'; | |
echo '</a>'; | |
echo '</div>'; | |
endwhile; | |
endif; | |
wp_reset_postdata(); | |
echo'</div>'; | |
$content = ob_get_contents(); | |
ob_end_clean(); | |
return $content; | |
} | |
add_shortcode('lista-paginas', 'lista_paginas'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment