php - How to Get wordpress page icon and permalink with title -
hello evryone new on wordpress. , m facing problem that, want access child page title , icon image (which uploaded in page icon) in page. title of pages permalink , icon image hard me. please... please me.my code here
<div class="vwt_single_blog_box_tab"> <?php if ( is_page() ) { if($post->post_parent) { $id = $post->post_parent; } else { $id = $post->id; } //$children = wp_list_pages('title_li=&child_of='.$id.'&echo=0'); $args = array( 'sort_order' => 'asc', 'sort_column' => 'post_title', 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '', 'child_of' => 1, 'parent' => $id, 'exclude_tree' => '', 'number' => '', 'offset' => 0, 'post_type' => 'page', 'post_status' => 'publish' ); $pages = get_pages($args); ?> <ul> <?php foreach($pages $page) { ?> <li> <div class="software-part"> <div class="soft-part"> <?php echo get_the_post_thumbnail( $page->id, 'thumbnail' ); ?> <h1><?php echo apply_filters( 'the_title', $page->post_title, $page->id ); ?></h1> <?php echo apply_filters( 'the_content', $page->post_content ); ?> <div class="software-part-right"> <h2><?php echo $page->post_title; ?></h2> </div> <p><?php $page->post_content = get_the_content(); $page->post_content = strip_tags($page->post_content); echo substr($page->post_content, 0, 100); ?> </p> </div> </div> </li> <?php } ?> </ul> <?php } ?> </div>
`
thank you.
this should trick:
<div class="vwt_single_blog_box_tab"> <?php if ( is_page() ) { if($post->post_parent) { $id = $post->post_parent; } else { $id = $post->id; } //$children = wp_list_pages('title_li=&child_of='.$id.'&echo=0'); $args = array( 'sort_order' => 'asc', 'sort_column' => 'post_title', 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '', 'child_of' => 1, 'parent' => $id, 'exclude_tree' => '', 'number' => '', 'offset' => 0, 'post_type' => 'page', 'post_status' => 'publish' ); $pages = get_pages($args); ?> <ul> <?php foreach($pages $page) { ?> <li> <div class="software-part"> <div class="soft-part"> <?php echo get_the_post_thumbnail( $page->id, 'thumbnail' ); ?> <h1><a href="<?php echo get_permalink( $page->id ); ?>"><?php echo get_the_title( $page->id ); ?> </a></h1> </div> </li> <?php } ?> </ul> <?php } ?> </div>
you calling permalink , title in wrong way. use get_permalink() , title get_the_title();
i've tested output , it's working.
ps - there's no such thing icon. want thumbnail can featured image or not.
Comments
Post a Comment