Tentative: ignore sticky posts everywhere

This commit is contained in:
nikolark committed 2016-05-04 22:07:34 +02:00
1 parent deea39372f
commit 98a4e4495b
5 files changed
+168 -148

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
<h2><a href="<?php echo home_url('/aktuelt/'); ?>"><?php _e('Articles', 'neuf'); ?></a></h2>
<?php
$fp_articles = new WP_Query( 'posts_per_page=4' );
$fp_articles = new WP_Query( array('posts_per_page' => 4, 'ignore_sticky_posts' => 1) );
if ( $fp_articles->have_posts() ) : while ( $fp_articles->have_posts() ) : $fp_articles->the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php neuf_post_class(); ?>>
+6 -5
View File
@@ -10,11 +10,12 @@
$args = array(
'post_type' => 'event',
'meta_query' => array( $meta_query ),
'posts_per_page' => 12,
'orderby' => 'meta_value_num',
'meta_key' => '_neuf_events_starttime',
'order' => 'ASC'
'meta_query' => array( $meta_query ),
'posts_per_page' => 12,
'orderby' => 'meta_value_num',
'meta_key' => '_neuf_events_starttime',
'order' => 'ASC',
'ignore_sticky_posts' => 1
);
$fp_events = new WP_Query( $args );
@@ -15,164 +15,181 @@
* Ref: http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters
*/
$meta_query = array(
'key' => '_neuf_events_starttime',
'value' => date( 'U' , strtotime( '-30 minutes' ) ),
'compare' => '>',
'type' => 'numeric'
'key' => '_neuf_events_starttime',
'value' => date('U', strtotime('-30 minutes')),
'compare' => '>',
'type' => 'numeric'
);
$args = array(
'post_type' => 'event',
'meta_query' => array( $meta_query ),
'posts_per_page' => 1,
'orderby' => 'meta_value_num',
'meta_key' => '_neuf_events_starttime',
'order' => 'ASC'
'post_type' => 'event',
'meta_query' => array($meta_query),
'posts_per_page' => 1,
'orderby' => 'meta_value_num',
'meta_key' => '_neuf_events_starttime',
'order' => 'ASC',
'ignore_sticky_posts' => 1
);
$args['offset'] = get_query_var( 'page' ) - 1 >= 0 ? get_query_var( 'page' ) - 1 : 0;
$args['offset'] = get_query_var('page') - 1 >= 0 ? get_query_var('page') - 1 : 0;
$events = new WP_Query( $args );
$events = new WP_Query($args);
if ($events->have_posts() ) : while ( $events->have_posts() ) : $events->the_post();
if ($events->have_posts()) : while ($events->have_posts()) : $events->the_post();
$bg = wp_get_attachment_image_src( get_post_thumbnail_id() , 'extra-large' );
$bg = $bg[0];
$bg = wp_get_attachment_image_src(get_post_thumbnail_id(), 'extra-large');
$bg = $bg[0];
$event_array = get_the_terms( $post->ID , 'event_type' );
$post->event_types = array();
foreach ( $event_array as $event_type ) {
$post->event_types[] = $event_type->name;
$post->post_classes[] = 'event-type-' . $event_type->slug;
}
$post->event_types_comma = implode( ', ' , $post->event_types );
$event_array = get_the_terms($post->ID, 'event_type');
$post->event_types = array();
foreach ($event_array as $event_type) {
$post->event_types[] = $event_type->name;
$post->post_classes[] = 'event-type-' . $event_type->slug;
}
$post->event_types_comma = implode(', ', $post->event_types);
?>
<!doctype html>
<html>
<head>
<title>Snart på Studentersamfundet</title>
<link href='https://fonts.googleapis.com/css?family=Arvo:700,400italic' rel='stylesheet' type='text/css'>
<style media="screen" type="text/css">
/**
* reset
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
?>
<!doctype html>
<html>
<head>
<title>Snart på Studentersamfundet</title>
<link href='https://fonts.googleapis.com/css?family=Arvo:700,400italic' rel='stylesheet' type='text/css'>
<style media="screen" type="text/css">
/**
* reset
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/**
* styles
*/
html,body,#event {
width:100%;
height:100%;
position:relative;
overflow:hidden;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
#event {
width:100%;
height:100%;
background-size:cover;
background-image:url('<?php echo $bg; ?>');
background-position:center;
background-attachment:static;
color:white;
text-shadow:black 0 0 14px;
font-family:Arial,Helvetica,sans;
}
body {
line-height: 1;
}
#title,#timeplace,#price {
position:absolute;
bottom:0;
padding-bottom:30px;
font-size:32px;
}
#title {
width:100%;
text-align:center;
}
#timeplace {
left:30px;
}
#price{
right:30px;
}
h1 {
max-width:60%;
margin:auto;
font-size:64px;
font-family:Arvo;
}
</style>
</head>
<body>
ol, ul {
list-style: none;
}
<div id="event">
<div id="title">
<small id="eventtypes"><?php echo( $post->event_types_comma ); ?></small>
<h1><?php the_title(); ?></h1>
</div>
<div id="timeplace">
<p id="loc"><?php echo $post->neuf_events_venue; ?></p>
<p id="time"><?php echo( ucfirst( date_i18n( 'l \k\l G.i' , $post->neuf_events_starttime) ) ); ?></p>
</div>
<div id="price">
<p><?php echo neuf_format_price($post); ?></p>
</div>
</div> <!-- #event -->
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/**
* styles
*/
html, body, #event {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
}
#event {
width: 100%;
height: 100%;
background-size: cover;
background-image: url('<?php echo $bg; ?>');
background-position: center;
background-attachment: static;
color: white;
text-shadow: black 0 0 14px;
font-family: Arial, Helvetica, sans;
}
#title, #timeplace, #price {
position: absolute;
bottom: 0;
padding-bottom: 30px;
font-size: 32px;
}
#title {
width: 100%;
text-align: center;
}
#timeplace {
left: 30px;
}
#price {
right: 30px;
}
h1 {
max-width: 60%;
margin: auto;
font-size: 64px;
font-family: Arvo;
}
</style>
</head>
<body>
<div id="event">
<div id="title">
<small id="eventtypes"><?php echo($post->event_types_comma); ?></small>
<h1><?php the_title(); ?></h1>
</div>
<div id="timeplace">
<p id="loc"><?php echo $post->neuf_events_venue; ?></p>
<p id="time"><?php echo(ucfirst(date_i18n('l \k\l G.i', $post->neuf_events_starttime))); ?></p>
</div>
<div id="price">
<p><?php echo neuf_format_price($post); ?></p>
</div>
</div> <!-- #event -->
</body>
</html>
</body>
</html>
<?php endwhile; else: ?>
<?php endwhile;
else: ?>
<html><head><title>Ingen flere arrangementer</title></head><body>
<h1>Ingen flere arrangementer</h1><p>Bli aktiv i Studentersamfundet, og lag flere arrangementer.</p><p style="font-size:2em;">blimedlem@studentersamfundet.no</p>
</body></html>
<html>
<head><title>Ingen flere arrangementer</title></head>
<body>
<h1>Ingen flere arrangementer</h1>
<p>Bli aktiv i Studentersamfundet, og lag flere arrangementer.</p>
<p style="font-size:2em;">blimedlem@studentersamfundet.no</p>
</body>
</html>
<?php endif; ?>
@@ -29,7 +29,8 @@ $args = array(
'posts_per_page' => 50,
'orderby' => 'meta_value_num',
'meta_key' => '_neuf_events_starttime',
'order' => 'ASC'
'order' => 'ASC',
'ignore_sticky_posts' => 1
);
$events = new WP_Query( $args );
@@ -16,7 +16,8 @@ $args = array(
'posts_per_page' => 300,
'orderby' => 'meta_value_num',
'meta_key' => '_neuf_events_starttime',
'order' => 'ASC'
'order' => 'ASC',
'ignore_sticky_posts' => 1
);
?>
<?php get_header(); ?>