Skip Navigation

[Fermé] prev next navigation shortcode inner parent

This support ticket is created Il y a 4 années. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Christian Cox Il y a 4 années.

Assisté par: Christian Cox.

Auteur
Publications
#1845577

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

#1846557
Screen Shot 2020-11-16 at 2.47.23 PM.png

Hi, can you tell me if your site has migrated to the new Post Relationships system? You would be able to tell by going to Toolset > Relationships. If you see a list of Post Relationships as shown in the screenshot here, your site has been migrated. If you see a message that you must migrate to use the new relationships system, your site has not been migrated.

If you have migrated to the new system, this code will not be effective because it is written for the old relationships system. New APIs are available to help you query post relationships now. I can help you modify this code to work in the new relationships system if necessary, but I need to know if this is required or not before we go further. Please let me know what you find out in Toolset > Relationships and we can go from there.

Le sujet ‘[Fermé] prev next navigation shortcode inner parent’ est fermé à de nouvelles réponses.