Create Multi Related Posts in WordPress
Create a Post with Posts List
# <Post Title> - Posts List
<Post contain>
## References
[<SubPost_Title1>](<SubPost_URL1>)
[<SubPost_Title2>](<SubPost_URL2>)
[<SubPost_Title3>](<SubPost_URL3>)
[<SubPost_Title4>](<SubPost_URL4>)
SubPost
Add following script after each subpost summary.
Note: The 8888 is the subpost id, 9999 is the index post (Posts List) id. This will create a button on current page (8888) to display Posts List
# <Post Title>
<Post contain>
<div><button id='related_posts_8888'>Display Learning Posts</button>
<script type="text/javascript">
(function($) {
$(document).ready(function() {
$("#related_posts_8888").click(function(event) {
el = $(document.getElementById( $(this).attr('id') ).parentElement);
$.get("?p=9999", function(data, status) {
el.html(/h2>References<\/h2>([\s\S]*?)<\/div>/.exec(data)[1]);
});
});
});
}) (jQuery);
</script>
</div>