sliding door with post thumbnail
-
Hi Wayne,
I found your sliding door theme interesting, but wondering, why not using post thumbnails as sliding images, which could be uploaded and edited simply in the WP-mediathek.
There has to be made only some small changes in the function.php and the header.php.In header.php change
<?php slider_menuparse(wp_list_pages(‘sort_column=ID&depth=1&number=7&title_li=&echo=0’)); ?>
to
<?php slider_menuparse(get_pages(‘sort_column=menu_order&child_of=0&parent=0&hierarchical=0&number=7’)); ?>
(btw: For me it was better to sort the pages acc. to the menu_order)In function.php add at the beginning
<?php if ( function_exists( ‘add_theme_support’ ) ) {
add_theme_support( ‘post-thumbnails’ );
}
?>
to initialise post thumbs in the theme.In function.php change the function slider_menuparse() to
function slider_menuparse($pages){
$output = “”;
foreach ($pages as $page){
$thumbnail_url = wp_get_attachment_image_src(get_post_thumbnail_id($page->ID), ‘full’);
$output .= ‘<li class=”page-item page-item-‘ . $page->ID .'”>ID) . ‘” title=”‘ . $page->post_title . ‘” style=”background: url(‘ . $thumbnail_url[0] . ‘) no-repeat;”>’ . $page->post_title . ‘‘;
}
echo $output;
}Greetings
Bernhard
- The topic ‘sliding door with post thumbnail’ is closed to new replies.