Skip Navigation

[Geschlossen] Previous / Next within parent/child relationship

This support ticket is created vor 3 Jahre, 9 Monate. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 Antwort, has 2 Stimmen.

Last updated by Christian Cox vor 3 Jahre, 9 Monate.

Assisted by: Christian Cox.

Author
Artikel
#1688023

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'> <a href='".get_permalink($next_post->ID)."'> << ".get_the_title($next_post->ID)."</a></div>";
}

//$pagination = "<a href='javascript:history.back()'>zurück</a> >";

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'><a href='".get_permalink($previous_post->ID)."'> ".get_the_title($previous_post->ID)." >> </a></div>";
}

//$pagination = "<a href='javascript:history.back()'>zurück</a> >";

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>

can you help me again?

thx and best regards - alex

#1688027

Hello alexd-6, I have split your question into a separate ticket so we can follow up in more detail. Just to be clear, is this site using the new post relationships system, or legacy relationships? From wp-admin, go to Toolset > Relationships. You should see a page with a message about your site containing legacy relationships if you have not yet converted to the new relationships system. On the other hand, if you have converted to the new relationships system, you should see a dashboard with a list of post relationships, just like you see a list of posts at wp-admin > Posts > All Posts.

Which do you see?

Das Thema „[Geschlossen] Previous / Next within parent/child relationship“ ist für neue Antworten geschlossen.