|
problem with wpml and post child translation
Started by: massimilianop
in: Toolset Professional Support
Quick solution available
Problem: I have a parent post type and a child post type. In the site's main language, the child post does not appear in the parent post editor's post relationship panel. However, the parent appears correctly in the child post editor. In the translated languages, the child post appears as expected in the parent post editor's post relationship panel.
Solution: Remove the parent relationship from the child's post relationship panel, save, and then re-apply the parent relationship and save again.
|
|
2 |
5 |
7 years, 1 month ago
massimilianop
|
|
Previous / Next within parent/child relationship
Started by: emilyT
in: Toolset Professional Support
Quick solution available
Problem: I would like to include pagination on my single post pages that allows a user to navigate between posts that are children of the same parent post.
Solution:
FOR AN UPDATED SOLUTION WITH RELATIONSHIPS IN TYPES 3.0+: https://toolset.com/forums/topic/next-and-previous-sibling-posts-in-a-one-to-many-post-relationship/
Legacy Relationships: Add a pagination shortcode that will output the next and previous links based on the parent and child post types:
// Add Pagination Shortcode
function pagination() {
$next_post = wpv_child(1, 'exhibition', 'painting');
$previous_post = wpv_child(-1, 'exhibition', 'painting');
$prev_pagination= '';
$next_pagination = '';
if($previous_post ){
$prev_pagination = "<div class='navigation'><div class='previousnav'> <a href='".get_permalink($previous_post->ID)."'> << ".get_the_title($previous_post->ID)."</a></div>";
}
if($next_post){
$next_pagination = "<div class='nextnav'><a href='".get_permalink($next_post->ID)."'> ".get_the_title($next_post->ID).">></a></div>";
}
$pagination = "<div class='currentexb'><a href='http://www.neilpinkett.co.uk/npwp/exhibition/''>GALLERY</a> >".get_the_title()."</div>";
return $prev_pagination.$pagination.$next_pagination;
}
add_shortcode( 'pagination', 'pagination' );
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];
}
|
|
3 |
11 |
7 years, 2 months ago
alexd-6
|
|
custom search across two post types, enabling user filter to select one or other
Started by: Cam Macduff
in: Toolset Professional Support
Quick solution available
|
|
2 |
5 |
7 years, 2 months ago
Cam Macduff
|