jeudi 11 février 2016

How to get the sub-links inside a post using get_children on loop in homepage in wordpress

I am using a WordPress 4.4 in my homepage I show all posts in grids and inside posts ,I placed around 3 to 5 links <a>.

The thing is I want to show count of all the sub-links which is inside posts in the homepage.

I tried using the following code, but it fetches only attachments but mine is links. Please help me with it.

<?php 
$attachments = get_children(array('post_parent'=>$post->ID));
$nbImg = count($attachments);
echo $nbImg.'&nbsp; Files';
?>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire