Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am displaying the list of child pages of the current page. but at one child page i want to give a path to pdf. how can it be possible? Please help.

Here is my code:

$args = array(
        'child_of'     => get_the_ID(),
        'date_format'  => get_option('date_format'),
        'depth'        => 0,
        'sort_column'  => 'ID',
        'sort_order'   => 'ASC',
        'title_li'     => ''
        ); ?>
   <?php wp_list_pages( $args ); ?>

output is-

 **current page**
    child page1
    child page2
    child page3 (..it should be link to pdf..)
    child page4
    child page5

Please help me to find out the solution?

share|improve this question
    
Here is a similar [link][1] which might solve your problem. [1]: wordpress.stackexchange.com/questions/67732/… –  TBI Infotech Jul 17 at 13:39

1 Answer 1

You can store the result in an array like so:

$children = wp_list_pages( $args ); 

And then iterate through them like so:

foreach ($children as $child) {
  if ($child->ID == $ID_OF_PAGE_THAT_SHOULD_BE_PDF_LINK) {
     echo $YOUR_PDF_LINK;
  }
  else {
     /* Whatever else you wanted to echo */ 
  }
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.