Hey - in my code if i in first Item - it shows in paginationprev child from other Parent. Here is my code and URL where you can see it:
hidden link
// Add Pagination Shortcode
function paginationprev() {
$next_post = wpv_child(1, 'projekt', 'objekt');
// $previous_post = wpv_child(-1, 'projekt', 'objekt');
// $prev_pagination= '';
$next_pagination = '';
if($next_post ){
$next_pagination = "<div class='previousnav'> << ".get_the_title($next_post->ID)."</div>";
}
//$pagination = "zurück >";
return '<div class="objektpagination">'.$next_pagination;
}
add_shortcode( 'paginationprev', 'paginationprev' );
### Child Navigation ###
// Add Pagination Shortcode
function paginationnext() {
//$next_post = wpv_child(1, 'projekt', 'objekt');
$previous_post = wpv_child(-1, 'projekt', 'objekt');
$prev_pagination= '';
//$next_pagination = '';
if($previous_post){
$prev_pagination = "<div class='nextnav'> ".get_the_title($previous_post->ID)." >> </div>";
}
//$pagination = "zurück >";
return $prev_pagination.'</div>';
}
add_shortcode( 'paginationnext', 'paginationnext' );
function wpv_child($step, $parentslug, $childslug) {
global $post;
$parent = get_post_meta($post->ID, '_wpcf_belongs_' . $parentslug
. '_id', true);
$children = get_posts(array('post_type' => $childslug, 'meta_key' => '_wpcf_belongs_' . $parentslug . '_id', 'meta_value' => $parent, 'numberposts' => -1));
$i = 0;
foreach ($children as $i => $child) {
if ($child->ID == $post->ID) break;
}
$i += $step;
if (isset($children[$i])) return $children[$i];
}
/code>
but it isnt in same parent. Is it possible?
can you help me again?
thx and best regards - alex