Show child by slug, while knowing parent ID

this is how i solved my problem: <?php $pageid = $post->ID; $pageslug = $post->post_name; $pos = $post->post_parent; $posname = get_post_field( ‘post_name’, $pos );; $arg1 = array( ‘post_type’ => ‘page’, ‘posts_per_page’ => 1, ‘pagename’ => $posname.”https://wordpress.stackexchange.com/”.$pageslug.’/infraestructura’, ); $child = new WP_Query( $arg1 ); ?> <div class=”wrapp”> <?php if ($child->have_posts()) :?> <?php while ($child->have_posts()) : $child->the_post(); ?> … Read more

Populate select list with meta values from all posts of a Custom Post Type

Here is the solution I came up with, that works properly. <form method=”get” action=”” onchange=”submit();”> <div class=”input-group”> <?php global $wpdb; $meta_key = ‘item_oem’; $data = $wpdb->get_results($wpdb->prepare( “SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s”, $meta_key) , ARRAY_N ); ?> <select class=”custom-select” id=”oems” aria-label=”oems” name=”item_oem” > <option selected>Search By OEM</option> <?php foreach( $data as $value … Read more