henter pages fra menyen og legger de i forskjellige blokker

This commit is contained in:
Øyvind Bakkeli committed 2011-07-22 14:05:40 +02:00
1 parent 8014062b33
commit f508131a50
4 files changed
+205 -79

No files matched your search

+123 -66
View File
@@ -1,74 +1,131 @@
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.0
*/
get_header();
global $wp_query;
$wp_query->is_archive = true;
?>
<div id="container" >
get_header(); ?>
<style type="text/css">
#container
{
background-color:transparent;
padding:0px;
}
.content
{
margin-bottom:50px;
background-color:#12b259;
background-color:rgba(18,178,89,0.8);
padding:10px;
}
</style>
<div id="container">
<div id="content" role="main">
<?php
/* Run the loop to output the posts.
* If you want to overload this in a child theme then include a file
* called loop-index.php and that will be used instead.
*/
the_post();
?>
<div id="post-<?php the_ID(); ?>" <?php post_class('first'); ?>>
<a rel="shadowbox" href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" class="lightbox">
<div class="entry-image">
<?php echo get_the_post_thumbnail( $post->ID, array(550,550) ) ?>
</div>
<h2 class="entry-title"><?php the_title(); ?></h2>
</a>
<?php //endif; ?>
<?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
<?php endif; ?>
<div class="entry-utility">
<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-utility -->
</div><!-- #post-## -->
<div class="therest">
<?php
get_template_part( 'loop', 'index' );
?></div>
</div><!-- #content -->
<div id="front-feed">
<?php dynamic_sidebar( 'front-page-right' ) ?>
$items = wp_get_nav_menu_items('5');
foreach($items as $item)
{
wp_reset_postdata();
$pre = '';
switch($item->object)
{
case 'page':
$loop = 'page';
$query = array('page_id'=>$item->object_id);
break;
case 'post':
$loop = 'post';
$query = array('p'=>$item->object_id);
break;
case 'category':
$cat = get_category($item->object_id);
$pre = '<h1>' . $cat->name . '</h1>';
$loop = 'category';
$query = array('cat'=>$item->object_id,'posts_per_page'=>5);
if($wp->query_vars['paged'])
$query['paged'] = $wp->query_vars['paged'];
break;
default:
$query = false;
}
if($query)
{
$id = strtolower(preg_replace('#[^\w]+#', '', $item->title));
echo "<div class=\"content\" id=\"{$id}\">";
if($pre) echo $pre;
query_posts($query);
get_template_part( 'loop', $loop);
echo '</div>';
}
}
?>
<script type="text/javascript">
$j(function()
{
var $ = $j;
$j("#right-menu a").click(function(e){
if(this.href.match(/^<?php echo preg_quote(home_url(),'/') ?>\/#/))
{
e.preventDefault();
id="#" + $(this).text().replace(/[^\w]/g, "").toLowerCase();
items = $j(id);
var from = $j("body").scrollTop();
if(!from) from = $j("html").scrollTop();
window.location = this.href;
$j("body,html").scrollTop(from);
var targetOffset = items.offset().top - 30;
$j("html,body").animate({scrollTop:targetOffset}, 500);
}
});
$(".content .navigation a").live('click', function(e)
{
e.preventDefault();
p = this.parentNode;
while(p != null && p.className != "content")
p = p.parentNode;
/*
durl = $("a[href^=\"<?php echo home_url()?>/category/\"]",p).attr('href');
durl += this.href.substr((window.location.origin + window.location.pathname).length);
*/
/*
$.get(this.href, function(html){
nev = '<div class="scroller" style="float:left;">' + $("#" + p.id, html).html() + '</div>';
first = $('' + $(p).html() + '</div>')
$(p).html(first);
if(this.parentNode.className == 'nav-previous')
first.css('position','absolute');
first.animate({left:800},500);
});
*/
$.get(this.href, function(html){
$(p).html($("#" + p.id, html).html());
});
});
});
</script>
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
+10
View File
@@ -172,3 +172,13 @@ function thumbnail_in_header($title)
}
add_filter('the_title', 'thumbnail_in_header');*/
function menu_links($items, $args)
{
foreach($items as &$item)
if(in_array($item->object, array('page','post','category')))
$item->url = home_url() . '/#' . strtolower(preg_replace('#[^\w]+#','',$item->title));
return $items;
}
add_filter('wp_nav_menu_objects', 'menu_links');
-13
View File
@@ -228,19 +228,6 @@ body {
margin-left:20px;
}
.widget-container
{
/*-moz-box-shadow: 0px -3px 6px rgba(0,0,0,0.35);
-webkit-box-shadow: 3px -3px 6px rgba(0,0,0,0.35);
box-shadow: 0px -3px 6px rgba(0,0,0,0.35);*/
}
#container
{
/*-moz-box-shadow: 0px -3px 6px rgba(0,0,0,0.75);
-webkit-box-shadow: 3px -3px 6px rgba(0,0,0,0.75);
box-shadow: 0px -3px 6px rgba(0,0,0,0.75);*/
}
#container
{
width: 550px;
+72
View File
@@ -0,0 +1,72 @@
<?php
/*
Template Name: Studio frontpage
*/
global $post, $wp_locale;
$items = wp_get_nav_menu_items('5');
function onlyPagePost($item)
{
return $item->object == 'page' || $item->object == 'post';
}
foreach($items as $item)
{
wp_reset_postdata();
$pre = '';
switch($item->object)
{
case 'page':
$loop = 'page';
$query = array('page_id'=>$item->object_id);
break;
case 'post':
$loop = 'post';
$query = array('p'=>$item->object_id);
break;
case 'category':
$cat = get_category($item->object_id);
$pre = '<h1>' . $cat->name . '</h1>';
$loop = 'category';
$query = array('cat'=>$item->object_id);
break;
default:
$query = false;
}
if($query)
{
echo "<a id=\"item-$item->ID\"></a>";
if($pre) echo $pre;
query_posts($query);
get_template_part( 'loop', $loop);
}
}
?>
<script type="text/javascript">
$j(function()
{
var $ = $j;
$j("#right-menu a").click(function(e){
li = this.parentNode;
id = this.parentNode.className.match(/menu-item-(\d+)/)[1];
e.preventDefault();
href = this.href;
items = $j("#item-" + id);
var targetOffset = items.offset().top - 30;
$j("html,body").animate({scrollTop: targetOffset}, 'fast');
});
});
</script>