Quantcast
Viewing all articles
Browse latest Browse all 20145

Reply To: [Waiting for user confirmation] Same child post in each Parent

Sorry Louy,

Still nothing showing. When I remove the '!' from the first if statement then I can see 'See media coverage of this in'… and the emtpy ul.

I am sorry I am not PHP savvy enough to work this out myself.

Just to be clear, here is the code as it stands

<?php $childargs=array (
							'post_type'=>'ssnlink',
							'numberposts'=> -1,
							'meta_query'=>array(
								array(
									'key'=>'wpcf_belongs_ssinnews_id','value'=>get_the_ID()
									)
								)
							);
						$child_posts=get_posts($childargs);
						
						if (!empty($child_posts)):?>
							<div class="ssn-related-links">
								<span>See media coverage of this in </span>
								<?php
									$commas = count($child_posts) -2;
									$count = 0;?>
									<ul>
                                        <?php
                                        foreach ($child_posts as $child_post) {
                                            $post_id = $child_post->ID;
                                            $related_link_url = get_post_meta($post_id, 'wpcf-related-link-url', true);
                                            echo '<a href="' .  $related_link_url . '" target="_blank">' . $child_post->post_title . '</a>';
											if($count <= $commas);echo ', ';
											echo'</li>';
											$count++;
										};
										?>
									</ul>
							</div><!--end ssn-realted-links-->
						<?php endif; ?>

Thanks
G


Viewing all articles
Browse latest Browse all 20145

Trending Articles