Get current post’s child page?

$ancestors = array(); $ancestors = get_ancestors($post->ID,’page’); $parent = (!empty($ancestors)) ? array_pop($ancestors) : $post->ID; $parent should be the topmost page parent. However, if you are using a WordPress generated menu there is a pretty good chance that there is already a item identified by a CSS class as the parent. Take a good look at the … Read more

How to use page metadata while using wp_list_pages()?

You can do it easily with jQuery by using .eq() to add a specific class to each i element. Example: Add a class to your i element from PHP. <?php wp_list_pages(‘link_before=<i class=”retina_icon”></i>&link_after=<br >’); ?> Then add another class to it with jQuery. jQuery(‘.retina-icon:eq(0)’).addClass(“retina-icon-1”); jQuery(‘retina-icon:eq(1)’).addClass(“retina-icon-2”);

wp_list_pages change of children and anchor of parent

You can use Walker: extend the Walker_Nav_Menu class in your functions.php class custom_nav extends Walker_Nav_Menu { function start_el (&$output, $item, $depth, $args) { $item_output=”<a href=”” . $item->url. ‘” someattr=”somevalue”>’ . $item->title . ‘</a>’; $output .= ‘<li>’ . apply_filters (‘walker_nav_menu_start_el’, $item_output, $item, $depth, $args); } } and call it in wp_list_pages <?php wp_list_pages(array( ‘walker’ => new … Read more

wp_list_pages, links only for pages with no children

To create the menu in the first place, feel free to use the shortcode [AVIA_tree_menu root=”your_root_document_title”] by adding this to functions.php: function sc_AVIA_tree_menu($atts) { extract(shortcode_atts(array(‘root’ => ‘Start’,), $atts)); //default if empty. $page = get_page_by_title($root); $args = array( ‘child_of’ => $page->ID, ‘date_format’ => get_option(‘date_format’), ‘depth’ => 0, ‘echo’ => 0, ‘post_type’ => ‘page’, ‘post_status’ => ‘publish’, … Read more

How To List Sibling Pages And Include The Featured Image?

wp_list_pages only displays page title and link in list. Try following code to fetch page content and thumbnail. <ul class=”pages-list”> <?php $our_pages = get_pages($args); ?> <?php if (!empty($our_pages)): ?> <?php foreach ($our_pages as $key => $page_item): ?> <li> <a href=”https://wordpress.stackexchange.com/questions/147745/<?php echo esc_url(get_permalink($page_item->ID)); ?>”><?php echo $page_item->post_title ; ?></a> <?php echo get_the_post_thumbnail($page_item->ID,’thumbnail’); ?> </li> <?php endforeach ?> … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)