• FammentiGrafici

    (@fammentigrafici)


    This plugin is very nice, but has little documentation.
    This is a help in getting started …
    php code in the template with the addition of custom field
    recovered from the pages related.

    <?php
    	$related_posts = MRP_get_related_posts($post->ID,false, true, 'yourPostType');
    	foreach($related_posts as $key => $value) {
    	$related_post = get_post($key);
    	$custom_field = get_post_meta($related_post->ID, 'yourCustomField', true);
    
    	echo get_the_post_thumbnail($related_post->ID, 'thumbnail');
    	echo '<br>';
    	echo $related_post->post_title;
    	echo '<br>';
    	echo $related_post->post_content;
    	echo '<br>';
    	echo get_permalink($related_post->ID);
    	echo '<br>';
    	echo $custom_field;
    	echo '<br>';
    	echo '<hr>';
    	}
    ?>

    https://www.ads-software.com/extend/plugins/microkids-related-posts/

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘PHP code for Template add Custom Field’ is closed to new replies.