admin管理员组文章数量:1026989
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?
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 asked Jul 17, 2014 at 12:28 Priya jainPriya jain 1211 gold badge1 silver badge5 bronze badges 1- Here is a similar [link][1] which might solve your problem. [1]: wordpress.stackexchange/questions/67732/… – TBI Infotech Commented Jul 17, 2014 at 13:39
1 Answer
Reset to default 0$mypages = get_pages( array(
'parent' => get_the_ID(),
'sort_column' => 'ID',
'sort_order' => 'ASC',
);
foreach( $mypages as $page ) {
// Modify this line to include ID of page where want to change the link
if ($page->ID == $ID_OF_PAGE_THAT_SHOULD_BE_PDF_LINK) {
// Modify this line to include your PDF link
echo '<li><a href="YOUR_PDF_LINK_HERE">' . $page->post_title . '</a></li>';
}
else {
echo '<li><a href="' . get_page_link( $page->ID ) .'">' . $page->post_title . '</a></li>'; }
}
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?
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 asked Jul 17, 2014 at 12:28 Priya jainPriya jain 1211 gold badge1 silver badge5 bronze badges 1- Here is a similar [link][1] which might solve your problem. [1]: wordpress.stackexchange/questions/67732/… – TBI Infotech Commented Jul 17, 2014 at 13:39
1 Answer
Reset to default 0$mypages = get_pages( array(
'parent' => get_the_ID(),
'sort_column' => 'ID',
'sort_order' => 'ASC',
);
foreach( $mypages as $page ) {
// Modify this line to include ID of page where want to change the link
if ($page->ID == $ID_OF_PAGE_THAT_SHOULD_BE_PDF_LINK) {
// Modify this line to include your PDF link
echo '<li><a href="YOUR_PDF_LINK_HERE">' . $page->post_title . '</a></li>';
}
else {
echo '<li><a href="' . get_page_link( $page->ID ) .'">' . $page->post_title . '</a></li>'; }
}
本文标签: How to Change the path of a child page
版权声明:本文标题:How to Change the path of a child page? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745656777a2161642.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论