I have a more link, but it only resolves to page 2 continually (wordpress is set to have 1 post per page, for testing)
The loop will only show the second post, and will let me get to page 2, but not give me the back link to page 1. It shows the second post on both the first and second pages.
the database has 4 posts, which all display when I put the post limit to 4 or above
Edit: I have updated the prize as it appears it is a much larger job than I thought, a lot of people are giving me the same fix which is not working.
[[LINK href="http://drop.io/pagination"]]here is a link[[/LINK]] to the site as a zip, it is not live and i don't want it to be live yet. The database is in the zip folder. Password is 'pagination'
theme is salf-v4
PLEASE comment any changes with the string 'wpquestions' so I can trace any changes.
EDIT 2: Simplified Script Below AND updated zip file!
<?php
/*
Template Name: Front Page
*/
?>
<?php get_header(); ?>
<div class="news">
<div id="news-feed">
<?php
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('showposts=1'.'&paged='.$paged);
if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();?>
<div class="new-entry">
<a href="<?php the_permalink();?>"><h2><?php the_title(); ?></h2></a>
<?php the_content(" Read More...");?>
</div>
<?php endwhile; ?>
<div class="custom-pagination">
<div class="alignleft"><?php previous_posts_link('« Previous') ?></div>
<div class="alignright"><?php next_posts_link('More »') ?></div>
<?php endif;
//Reset Query
rewind_posts(); ?>
<?php $wp_query = null; $wp_query = $temp;?>
</div>
</div><!--End news-feed-->
</div>
<?php get_footer(); ?>
Rashad Aliyev answers:
For example that's default loop:
<?php
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("cat=-5&showposts=3&paged=$page");
?>
You disabled your $paged in your code.
//query('post_type=post&paged='.$paged);
change: <strong>query_posts('post_type=post');</strong> to
query_posts('post_type=post&paged='.$paged);
test again..
John Farrow comments:
tried
if (have_posts()) :
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('post_type=post&paged='.$paged);
fb::log($wp_query);
while (have_posts()) : the_post(); ?>
as the start of loop, no joy
Rashad Aliyev comments:
Try this one please.
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("post_type=post&paged=$paged"); ?>
John Farrow comments:
that's just different syntax for the same thing. I have tried it though, and no joy as predicted.
I have updated the original post with more details.
Baki Goxhaj answers:
Replace this line:
query_posts('post_type=post');
With this line:
query_posts('post_type=post&paged='$page);
John Farrow comments:
loop not begins thus:
if (have_posts()) :
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("post_type=post&paged=$paged");
fb::log($wp_query);
while (have_posts()) : the_post(); ?>
same effect
I have updated the question with more details.
John Farrow comments:
*now, not not
Baki Goxhaj comments:
Look at the bolded text - the variables need to be the same - you are missing an "d".
if (have_posts()) :
<strong>$page</strong> = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("post_type=post&paged=<strong>$paged</strong>");
fb::log($wp_query);
while (have_posts()) : the_post(); ?>
Baki Goxhaj comments:
Working copy of you code:
<div class="news">
<a class="news-top" href="<?php bloginfo('rss_url'); ?>"><img src="<?php echo bloginfo('template_url'); ?>/style/images/news-top.png" alt="News Top"></a><span style="opacity: 0;"class="subscribe-hint">Get RSS Feed <img style="float: right;"src="<?php echo bloginfo('template_url'); ?>/style/images/social/feed.png" width="16" height="16" alt="Feed"></span>
<div id="news-feed">
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts( "paged=$paged" );
//fb::log($wp_query);
if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="new-entry">
<a href="<?php the_permalink();?>"><h2><?php the_title(); ?></h2></a><div class="post-details"><?php the_time('l, F jS, Y') ?><?php comments_number('',' - 1 comment',' - % comments'); ?></div>
<?php the_post_thumbnail();?>
<?php
//global $more; // Declare global $more (before the loop).
//$more = 0; // Set (inside the loop) to display content above the more tag.
the_excerpt();
?>
<?php endwhile; endif; //wp_reset_query(); ?>
<div class="custom-pagination">
<div class="alignleft"><?php previous_posts_link('« Previous') ?></div>
<div class="alignright"><?php next_posts_link('More »') ?></div>
</div>
</div><!--End news-feed-->
<div id="stream-tweet">
<div class="dsc_tweet tweets"><H2><img src="<?php echo bloginfo('template_url');?>/style/images/tweets-from.png" width="150" height="25" alt="TWEETS FROM US"></H2></div>
<div class="query_tweet tweets"><H2><img src="<?php echo bloginfo('template_url');?>/style/images/tweets-about.png" width="150" height="25" alt="TWEETS ABOUT US"></H2></div>
</div>
</div><!--End news-feed-->
I removed the JavaScript part just for speed. You need to add that again.
John Farrow comments:
see updated question
Baki Goxhaj comments:
I downloaded the theme zip too and spent some good time hunting around. The theme seems to be a mess. Very hard to debug.
paul de wouters answers:
Maybe try WP_Query?
http://weblogtoolscollection.com/archives/2008/04/13/define-your-own-wordpress-loop-using-wp_query/
John Farrow comments:
see updated question
Tobias Nyholm answers:
if (have_posts()) : //checks if the current query has any posts
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('post_type=post');//replace the current query with a new one, it takes all posts from the beginning
Try to remove this:
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('post_type=post');//
Is the page acting as expected now?
John Farrow comments:
see updated question
Peter Bouwmeester answers:
Hi!
If this is a custom loop, as you write, you should not be using query_posts; ref http://codex.wordpress.org/Function_Reference/query_posts where it says "Use of query_posts on Loops other than the main one can result in your main Loop becoming incorrect and possibly displaying things that you were not expecting."
In stead you could use get_posts (ref http://codex.wordpress.org/Template_Tags/get_posts) or WP_Query (ref http://codex.wordpress.org/Template_Tags/query_posts for vars in array) like so:
$my_query = new WP_Query( array(
'cat' => 8, // portfolio
'showposts' => 9,
'orderby' => 'title',
'order' => 'ASC',
'nopaging' => 0,
'post_status' => 'publish',
'post_type' => 'post'
) );
if ( $my_query->found_posts == 0 ) // do what is needed, eg return false;
while ($my_query->have_posts()) : $my_query->the_post();
// do what is needed
// postdata is loaded so the_content() etc are all available
endwhile;
wp_reset_query();
Apart from that you shouldnt use query_posts for a custom loop, in your sample code it says
[...]
if (have_posts()) :
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('post_type=post');
[...]
while (have_posts()) : the_post(); ?>
[...]
That can never work properly;
"if (have_posts()) :" refers to the outcome of query_posts (of the build-in loop)
"query_posts('post_type=post');" next you attempt to change and rerun that same query_posts
Results will be unpredicatble - like pagination that doesnt work.
Good luck!
John Farrow comments:
see updated question
Peter Bouwmeester comments:
John,
I downloaded your installation and had a look at the code. Your template does not adhere to WordPress standards which will make it quite a hard task to sort out this issue.
Some observations:
a) you use query_posts on several places in the template; these will all interfere with processing and should actually all not be there. so change them to custom loops.
b) you use 'echo bloginfo(...)' but bloginfo will already echoes causing errors; remove 'echo' from all bloginfo() commands.
c) the pagination is not working since that is controled by the built-in loop (query_posts). So even if you add a custom loop, that still won't make the prev and next functions work.
d) what is it exactly that you are trying to achieve? Should the next and previous post links flip through the posts on the home page or could they lead to just another page?
In the first case, i think you should fundamentally change your setup (make your post category the home page in Settings | Reading, setup a category template that might be pretty much same as the current holding-page template).
In the latter case, you could possibly do something with a custom link in stead of using the prev next post functions.
e) you could still get the prev next functions to work by specifying 1 query_posts command before get_header.php. Thus, you set the built-in loop to use different settings. This is allowed and can work but when i try it seems to break a number of other things.
Still a bit too many variables, i'm affraid.
Zafer Durmuş answers:
Use a plugin for better pagination. I strongly recommend this one;
[[LINK href="http://wordpress.org/extend/plugins/wp-pagenavi/"]]http://wordpress.org/extend/plugins/wp-pagenavi/[[/LINK]]
John Farrow comments:
using a plugin is masking the problem. I wish to understand it.
Khanh Cao answers:
Removing query_posts('post_type=post'); should make it work :)
John Farrow comments:
that would fail. It would remove necessary specificity from the loop
Khanh Cao comments:
This works on my end. Moved query_posts() up before have_posts():
query_posts('post_type=post&paged=' . get_query_var('paged'));
if (have_posts()):
...
John Farrow comments:
that doesn't work in my theme, something deeper is at fault.
Khanh Cao comments:
I've activated salf-v4 in a test site, it added a bunch of new post types and had some layout bug but the posts and paginations worked properly. It could be some plugin that is causing your problem I guess.
John Farrow comments:
deactivated all the plugins, no joy
Tiago Duarte answers:
Hello there,
I have found this little code, which might solve your problem:
add_filter( 'pre_get_posts', 'my_get_posts' );
function my_get_posts( $query ) {
if ( is_home() )
$query->set( 'post_type', array( 'post', 'page', 'album', 'movie', 'quote', 'attachment' ) );
return $query;
}
Add it to your functions.php, and you can have the "normal" posts query in your file :)
Hope it works ;)
Nilesh shiragave answers:
Hi
Just replace holding-page.php code with following code. I tested this code it works.
<?php
ob_start();
/*
Template Name: Holding Page
*/
?>
<?php get_header(); ?>
<div class="post" id="home">
<h2><img src="<?php echo bloginfo('template_url'); ?>/style/images/home-page-header-para.png" alt="Britain's first major festival celebrating South Asian literature" ></img></h2>
<div class="news">
<a class="news-top" href="<?php bloginfo('rss_url'); ?>"><img src="<?php echo bloginfo('template_url'); ?>/style/images/news-top.png" alt="News Top"></a><span style="opacity: 0;"class="subscribe-hint">Get RSS Feed <img style="float: right;"src="<?php echo bloginfo('template_url'); ?>/style/images/social/feed.png" width="16" height="16" alt="Feed"></span>
<div id="news-feed">
<?php
$allposts = new WP_Query( array( 'post_type' => 'post') );
if ( $allposts->have_posts() ) : while ( $allposts->have_posts() ) : $allposts->the_post();?>
<div class="new-entry">
<a href="<?php the_permalink();?>"><h2><?php the_title(); ?></h2></a><div class="post-details"><?php the_time('l, F jS, Y') ?><?php comments_number('',' - 1 comment',' - % comments'); ?></div>
<?php mf_post_thumbnail('med-cropped');?>
<?php
global $more; // Declare global $more (before the loop).
$more = 0; // Set (inside the loop) to display content above the more tag.
the_content(" Read More...");
?>
<script type="text/javascript">
function getTinyUrl($url) {
$tinyurl = file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
return $tinyurl;
}
var twtTitle = "Just reading '<?php the_title(); ?>'";
var tinyUrl = "<?php
echo getTinyUrl(get_permalink(get_the_ID()));?>";
var twtLink = 'http://twitter.com/home?status='+encodeURIComponent(twtTitle + ' ' + tinyUrl + " #salf");
document.write('<a class="twitter" href="'+twtLink+'" target="_blank"'+'><img src="<?php echo bloginfo('template_url')?>/style/images/social/twitter.png" border="0" alt="Tweet This!" /'+'><'+'/a>');
</script>
<noscript><a class="twitter" href="http://twitter.com/home?status=<?php echo getTinyUrl(get_permalink(get_the_ID()));?>" target="_blank"'+'><img src="<?php echo bloginfo('template_url')?>/style/images/social/twitter.png" border="0" alt="Tweet This!" /></a></noscript>
<span class="facebook-connect">
<a href=# target="_blank" class="facebook"><img src="<?php echo bloginfo('template_url')?>/style/images/social/facebook.png" width="16" height="16" alt="Facebook" /></a>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: '130496703654288', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<div class="fb-iframe"><fb:like action='like' href="<?php the_permalink();?>"colorscheme='light'
layout='standard' show_faces='true' width='200'/></div>
</span>
</div>
<?php
endwhile;
?>
<div class="custom-pagination">
<div class="alignleft"><?php previous_posts_link('« Previous') ?></div>
<div class="alignright"><?php next_posts_link('More »') ?></div>
<?php
endif;
//Reset Query
rewind_posts();
?>
</div>
</div><!--End news-feed-->
<div id="stream-tweet">
<div class="dsc_tweet tweets"><H2><img src="<?php echo bloginfo('template_url');?>/style/images/tweets-from.png" width="150" height="25" alt="TWEETS FROM US"></H2></div>
<div class="query_tweet tweets"><H2><img src="<?php echo bloginfo('template_url');?>/style/images/tweets-about.png" width="150" height="25" alt="TWEETS ABOUT US"></H2></div>
</div>
</div><!--End news-feed-->
</div>
<a class="top" href="#" title="Top">BACK TO TOP</a>
<?php// edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
<div id="partners" class="post">
<h2><img class="text" src="<?php echo bloginfo('template_url'); ?>/style/images/partners-blurb.png" alt="the list of partners continues to grow" ></img></h2>
<img class="logos" src="<?php echo bloginfo('template_url'); ?>/style/images/partners-logo.png" alt="Partners Logo" ></img>
<ul id="partner-links">
<li><a href="http://www.foyles.co.uk/">Foyles</a></li>
<li><a href="http://www.ipg.uk.com/">IPG</a></li>
<li><a href="http://www.britishcouncil.org">British Council</a></li>
<li><a href="http://www.applesandsnakes.org/">Apples & Snakes</a></li>
<li><a href="http://www.open.ac.uk/">The Open University</a></li>
<li><a href="http://www.amg.biz/">AMG</a></li>
<li><a href="http://www.nehrucentre.org.uk/">The Nehru Centre</a></li>
<li><a href="http://www.readingagency.org.uk/">The Reading Agency</li>
<li><a href="http://www.freewordonline.com/">Free Word Centre</a></li>
<li><a href="http://www.publishers.org.uk/en/home/">The Publishers Association</a></li>
<li><a href="http://www.wasafiri.org/">Wasafiri</a></li>
<li><a href="http://www.bl.uk/">British Library</a></li>
<li><a href="http://www.granta.com/">Granta</a></li>
<li><a href="http://www.vayunaiducompany.org.uk/">Vaya Naidu Company</a></li>
<li><a href="http://www.spinebreakers.co.uk/Pages/Home.aspx">Spine Breakers</a></li>
<li><a href="http://www.richmix.org.uk/">Rich Mix</a></li>
<li><a href="http://www.dipnet.org.uk/">DIPNET</a></li>
<li><a href="http://www.kingsplace.co.uk/">Kings Place</a></li>
<li><a href="http://www.artscouncil.org.uk/">Arts Council England</a></li>
<li><a href="http://www.livity.co.uk/">Livity</a></li>
<li><a href="http://www.booksellers.org.uk/">The Booksellers Association</a></li>
<li><a href="http://www.cii.in/">CII</a></li>
<li><a href="http://www.saadhak.co.uk/">Saadhak</a></li>
<li><a href="http://www.thesyp.org.uk/">SYP</a></li>
</ul>
</div>
<a class="top" href="#" title="Top">BACK TO TOP</a>
<div id="venues" class="post">
<h2><img src="<?php echo bloginfo('template_url'); ?>/style/images/venues_blurb.png" alt="Events taking place across London" ></img></h2>
<div id="venue_images">
<?php
$venue_query = new WP_Query( array( 'post_type' => 'Venues') );
//query_posts( array( 'post_type' => 'Venues') );
if ( $venue_query->have_posts() ) : while ( $venue_query->have_posts() ) : $venue_query->the_post();?>
<div class="venue-box">
<a class='venue' href="<? the_permalink();?>">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('venue-images');
}
?>
<p><?php the_title();?></p>
</a>
</div>
<?php endwhile; else:?>
<?php endif;
//Reset Query
rewind_posts();
?>
</div>
</div>
<a class="top" href="#" title="Top">BACK TO TOP</a>
<div id="enquiries" class="post">
<img src="<?php echo bloginfo('template_url'); ?>/style/images/contact-blurb.png" alt="Contact Blurb" ></img>
<?php echo do_shortcode('[contact-form 1 "Contact form 1"]') ?>
</div>
<a class="top" href="#" title="Top">BACK TO TOP</a>
<?php if(function_exists('add_custom_background')):?>
<div id="events" class="post">
<img src="<?php echo bloginfo('template_url'); ?>/style/images/Events-title.png" alt="Events Title">
<div id="event-type-boxes">
<?php
$event_query = new WP_Query( array( 'post_type' => 'Events') );
query_posts( array( 'post_type' => 'Events') );
if ( $event_query->have_posts() ) : while ( $event_query->have_posts() ) : $event_query->the_post();?>
<div class="event-type-box">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
?>
<h3><?php the_title();?> </h3>
<p style="float: right"><?php the_content();?></p>
</div>
<?php endwhile; else:?>
<?php endif;
//Reset Query
rewind_posts();
?>
</div>
</div>
<a class="top" href="#" title="Top">BACK TO TOP</a>
<?php endif;?>
<?php if(function_exists('add_custom_background')):?>
<div id="about" class="post">
<?php
$about_query = new WP_Query('post_type=Partners&pages=about&orderby=menu_order');
if ( $about_query->have_posts() ) : while ( $about_query->have_posts() ) : $about_query->the_post();?>
<div class="partner-box">
<h2>
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('partner-titles');
} else {
the_title();
}
?>
</h2>
<div class='partner-content'>
<?php the_content();?>
<?php
/*People Loop
--------------*/
$taxonomies=get_the_term_list($post->ID,'Partners','','','');
$taxonomies = explode('>',$taxonomies);
$taxonomies = $taxonomies[1];
$people = new WP_Query('post_type=People&partners='.$taxonomies.'&orderby=menu_order');?>
<?php if ($people->have_posts()) : while ($people->have_posts()) : $people->the_post(); ?>
<div class="people-bio-content">
<h3><?php the_title();?></h3>
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
?>
<?php the_content();?>
</div>
<?php endwhile; else:?>
<?php endif;?>
<?php
/*--------------
People Loop End*/?>
</div><!--partner-content end-->
<img style="
display: block;
margin: 0 auto;
" src="<?php echo bloginfo('template_url'); ?>/style/images/partner-border.png" width="900" height="1" />
</div><!--partner-box end-->
<?php endwhile; else:?>
<?php endif;
//Reset Query
rewind_posts();
?>
</div>
<a class="top" href="#" title="Top">BACK TO TOP</a>
<?php endif;?>
<div id="volunteer" class="post">
<img src="<?php echo bloginfo('template_url');?>/style/images/volunteer.png" alt="Volunteer" />
<div class="intro-copy">
<p>We are looking for volunteers with the right passion for literature and events to join our team in the busy period from now through to the Festival, which begins mid-October. Relevant experience and a degree are important, but we welcome applications of interest from anyone who believes they have the skills, energy and time to successfully carry out specific roles.</p>
<p>We’ll also be posting up roles that will only be required during the main Festival period, if you want to help but don’t have too much time to commit. </p>
<p>In return you get the chance to work with a brilliant team of people, meet some fantastic authors and gain some great experience working with some of the best arts venues, people and organisations in the business.</p>
<p>If you have tons of initiative, are highly organised with good people skills and love working in a busy environment then get in touch by emailing <a href="mailto:[email protected]">[email protected]</a>, referencing which roles you would like to apply for.</p>
</div>
<ul id="volunteer-jump-menu">
<li><h3>Opportunities Available</h3></li>
<?php $volunteer_menu_query = new WP_Query('post_type=Volunteer&orderby=menu_order&posts_per_page=-1');
if ( $volunteer_menu_query->have_posts() ) : while ( $volunteer_menu_query->have_posts() ) : $volunteer_menu_query->the_post();?>
<li><a href="#oppurtunity-<?php the_ID();?>"><?php the_title(); ?></a></li>
<?php endwhile; else:?>
<?php endif;
//Reset Query
rewind_posts();
?>
</ul>
<img style="
display: block;
margin: 0 auto;
" src="<?php echo bloginfo('template_url'); ?>/style/images/partner-border.png" width="900" height="1" />
<div id="volunteer-options">
<?php
$volunteer_query = new WP_Query('post_type=Volunteer&orderby=menu_order&posts_per_page=-1');
if ( $volunteer_query->have_posts() ) : while ( $volunteer_query->have_posts() ) : $volunteer_query->the_post();?>
<div class="volunteer-content" id="oppurtunity-<?php the_ID();?>">
<h2>
<?php the_title(); ?>
</h2>
<a href="mailto:[email protected]?subject=Volunteer:<?php urlencode(the_title());?>">Contact Us</a>
<div class="volunteer-text">
<?php the_content(); ?>
</div>
</div>
<?php endwhile; else:?>
<?php endif;
//Reset Query
rewind_posts();
?>
</div>
</div>
<a class="top" href="#" title="Top">BACK TO TOP</a>
<?php get_footer(); ?>
Nilesh shiragave comments:
Hi just wait for some more time..
i got solution.. will update.. my answer
Nilesh shiragave comments:
<blockquote><strong>HI here is my final code. I tested this code.. and the pagination is working..</strong></blockquote>
<?php
ob_start();
/*
Template Name: Holding Page
*/
?>
<?php get_header(); ?>
<div class="post" id="home">
<h2><img src="<?php echo bloginfo('template_url'); ?>/style/images/home-page-header-para.png" alt="Britain's first major festival celebrating South Asian literature" ></img></h2>
<div class="news">
<a class="news-top" href="<?php bloginfo('rss_url'); ?>"><img src="<?php echo bloginfo('template_url'); ?>/style/images/news-top.png" alt="News Top"></a><span style="opacity: 0;"class="subscribe-hint">Get RSS Feed <img style="float: right;"src="<?php echo bloginfo('template_url'); ?>/style/images/social/feed.png" width="16" height="16" alt="Feed"></span>
<div id="news-feed">
<?php
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('showposts=1'.'&paged='.$paged);
if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();?>
<div class="new-entry">
<a href="<?php the_permalink();?>"><h2><?php the_title(); ?></h2></a><div class="post-details"><?php the_time('l, F jS, Y') ?><?php comments_number('',' - 1 comment',' - % comments'); ?></div>
<?php mf_post_thumbnail('med-cropped');?>
<?php
global $more; // Declare global $more (before the loop).
$more = 0; // Set (inside the loop) to display content above the more tag.
the_content(" Read More...");
?>
<script type="text/javascript">
function getTinyUrl($url) {
$tinyurl = file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
return $tinyurl;
}
var twtTitle = "Just reading '<?php the_title(); ?>'";
var tinyUrl = "<?php
echo getTinyUrl(get_permalink(get_the_ID()));?>";
var twtLink = 'http://twitter.com/home?status='+encodeURIComponent(twtTitle + ' ' + tinyUrl + " #salf");
document.write('<a class="twitter" href="'+twtLink+'" target="_blank"'+'><img src="<?php echo bloginfo('template_url')?>/style/images/social/twitter.png" border="0" alt="Tweet This!" /'+'><'+'/a>');
</script>
<noscript><a class="twitter" href="http://twitter.com/home?status=<?php echo getTinyUrl(get_permalink(get_the_ID()));?>" target="_blank"'+'><img src="<?php echo bloginfo('template_url')?>/style/images/social/twitter.png" border="0" alt="Tweet This!" /></a></noscript>
<span class="facebook-connect">
<a href=# target="_blank" class="facebook"><img src="<?php echo bloginfo('template_url')?>/style/images/social/facebook.png" width="16" height="16" alt="Facebook" /></a>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: '130496703654288', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<div class="fb-iframe"><fb:like action='like' href="<?php the_permalink();?>"colorscheme='light'
layout='standard' show_faces='true' width='200'/></div>
</span>
</div>
<?php
endwhile;
?>
<div class="custom-pagination">
<div class="alignleft"><?php previous_posts_link('« Previous') ?></div>
<div class="alignright"><?php next_posts_link('More »') ?></div>
<?php
endif;
//Reset Query
rewind_posts();
?>
<?php $wp_query = null; $wp_query = $temp;?>
</div>
</div><!--End news-feed-->
<div id="stream-tweet">
<div class="dsc_tweet tweets"><H2><img src="<?php echo bloginfo('template_url');?>/style/images/tweets-from.png" width="150" height="25" alt="TWEETS FROM US"></H2></div>
<div class="query_tweet tweets"><H2><img src="<?php echo bloginfo('template_url');?>/style/images/tweets-about.png" width="150" height="25" alt="TWEETS ABOUT US"></H2></div>
</div>
</div><!--End news-feed-->
</div>
<a class="top" href="#" title="Top">BACK TO TOP</a>
<?php// edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
<div id="partners" class="post">
<h2><img class="text" src="<?php echo bloginfo('template_url'); ?>/style/images/partners-blurb.png" alt="the list of partners continues to grow" ></img></h2>
<img class="logos" src="<?php echo bloginfo('template_url'); ?>/style/images/partners-logo.png" alt="Partners Logo" ></img>
<ul id="partner-links">
<li><a href="http://www.foyles.co.uk/">Foyles</a></li>
<li><a href="http://www.ipg.uk.com/">IPG</a></li>
<li><a href="http://www.britishcouncil.org">British Council</a></li>
<li><a href="http://www.applesandsnakes.org/">Apples & Snakes</a></li>
<li><a href="http://www.open.ac.uk/">The Open University</a></li>
<li><a href="http://www.amg.biz/">AMG</a></li>
<li><a href="http://www.nehrucentre.org.uk/">The Nehru Centre</a></li>
<li><a href="http://www.readingagency.org.uk/">The Reading Agency</li>
<li><a href="http://www.freewordonline.com/">Free Word Centre</a></li>
<li><a href="http://www.publishers.org.uk/en/home/">The Publishers Association</a></li>
<li><a href="http://www.wasafiri.org/">Wasafiri</a></li>
<li><a href="http://www.bl.uk/">British Library</a></li>
<li><a href="http://www.granta.com/">Granta</a></li>
<li><a href="http://www.vayunaiducompany.org.uk/">Vaya Naidu Company</a></li>
<li><a href="http://www.spinebreakers.co.uk/Pages/Home.aspx">Spine Breakers</a></li>
<li><a href="http://www.richmix.org.uk/">Rich Mix</a></li>
<li><a href="http://www.dipnet.org.uk/">DIPNET</a></li>
<li><a href="http://www.kingsplace.co.uk/">Kings Place</a></li>
<li><a href="http://www.artscouncil.org.uk/">Arts Council England</a></li>
<li><a href="http://www.livity.co.uk/">Livity</a></li>
<li><a href="http://www.booksellers.org.uk/">The Booksellers Association</a></li>
<li><a href="http://www.cii.in/">CII</a></li>
<li><a href="http://www.saadhak.co.uk/">Saadhak</a></li>
<li><a href="http://www.thesyp.org.uk/">SYP</a></li>
</ul>
</div>
<a class="top" href="#" title="Top">BACK TO TOP</a>
<div id="venues" class="post">
<h2><img src="<?php echo bloginfo('template_url'); ?>/style/images/venues_blurb.png" alt="Events taking place across London" ></img></h2>
<div id="venue_images">
<?php
$venue_query = new WP_Query( array( 'post_type' => 'Venues') );
//query_posts( array( 'post_type' => 'Venues') );
if ( $venue_query->have_posts() ) : while ( $venue_query->have_posts() ) : $venue_query->the_post();?>
<div class="venue-box">
<a class='venue' href="<? the_permalink();?>">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('venue-images');
}
?>
<p><?php the_title();?></p>
</a>
</div>
<?php endwhile; else:?>
<?php endif;
//Reset Query
rewind_posts();
?>
</div>
</div>
<a class="top" href="#" title="Top">BACK TO TOP</a>
<div id="enquiries" class="post">
<img src="<?php echo bloginfo('template_url'); ?>/style/images/contact-blurb.png" alt="Contact Blurb" ></img>
<?php echo do_shortcode('[contact-form 1 "Contact form 1"]') ?>
</div>
<a class="top" href="#" title="Top">BACK TO TOP</a>
<?php if(function_exists('add_custom_background')):?>
<div id="events" class="post">
<img src="<?php echo bloginfo('template_url'); ?>/style/images/Events-title.png" alt="Events Title">
<div id="event-type-boxes">
<?php
$event_query = new WP_Query( array( 'post_type' => 'Events') );
query_posts( array( 'post_type' => 'Events') );
if ( $event_query->have_posts() ) : while ( $event_query->have_posts() ) : $event_query->the_post();?>
<div class="event-type-box">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
?>
<h3><?php the_title();?> </h3>
<p style="float: right"><?php the_content();?></p>
</div>
<?php endwhile; else:?>
<?php endif;
//Reset Query
rewind_posts();
?>
</div>
</div>
<a class="top" href="#" title="Top">BACK TO TOP</a>
<?php endif;?>
<?php if(function_exists('add_custom_background')):?>
<div id="about" class="post">
<?php
$about_query = new WP_Query('post_type=Partners&pages=about&orderby=menu_order');
if ( $about_query->have_posts() ) : while ( $about_query->have_posts() ) : $about_query->the_post();?>
<div class="partner-box">
<h2>
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('partner-titles');
} else {
the_title();
}
?>
</h2>
<div class='partner-content'>
<?php the_content();?>
<?php
/*People Loop
--------------*/
$taxonomies=get_the_term_list($post->ID,'Partners','','','');
$taxonomies = explode('>',$taxonomies);
$taxonomies = $taxonomies[1];
$people = new WP_Query('post_type=People&partners='.$taxonomies.'&orderby=menu_order');?>
<?php if ($people->have_posts()) : while ($people->have_posts()) : $people->the_post(); ?>
<div class="people-bio-content">
<h3><?php the_title();?></h3>
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
?>
<?php the_content();?>
</div>
<?php endwhile; else:?>
<?php endif;?>
<?php
/*--------------
People Loop End*/?>
</div><!--partner-content end-->
<img style="
display: block;
margin: 0 auto;
" src="<?php echo bloginfo('template_url'); ?>/style/images/partner-border.png" width="900" height="1" />
</div><!--partner-box end-->
<?php endwhile; else:?>
<?php endif;
//Reset Query
rewind_posts();
?>
</div>
<a class="top" href="#" title="Top">BACK TO TOP</a>
<?php endif;?>
<div id="volunteer" class="post">
<img src="<?php echo bloginfo('template_url');?>/style/images/volunteer.png" alt="Volunteer" />
<div class="intro-copy">
<p>We are looking for volunteers with the right passion for literature and events to join our team in the busy period from now through to the Festival, which begins mid-October. Relevant experience and a degree are important, but we welcome applications of interest from anyone who believes they have the skills, energy and time to successfully carry out specific roles.</p>
<p>We’ll also be posting up roles that will only be required during the main Festival period, if you want to help but don’t have too much time to commit. </p>
<p>In return you get the chance to work with a brilliant team of people, meet some fantastic authors and gain some great experience working with some of the best arts venues, people and organisations in the business.</p>
<p>If you have tons of initiative, are highly organised with good people skills and love working in a busy environment then get in touch by emailing <a href="mailto:[email protected]">[email protected]</a>, referencing which roles you would like to apply for.</p>
</div>
<ul id="volunteer-jump-menu">
<li><h3>Opportunities Available</h3></li>
<?php $volunteer_menu_query = new WP_Query('post_type=Volunteer&orderby=menu_order&posts_per_page=-1');
if ( $volunteer_menu_query->have_posts() ) : while ( $volunteer_menu_query->have_posts() ) : $volunteer_menu_query->the_post();?>
<li><a href="#oppurtunity-<?php the_ID();?>"><?php the_title(); ?></a></li>
<?php endwhile; else:?>
<?php endif;
//Reset Query
rewind_posts();
?>
</ul>
<img style="
display: block;
margin: 0 auto;
" src="<?php echo bloginfo('template_url'); ?>/style/images/partner-border.png" width="900" height="1" />
<div id="volunteer-options">
<?php
$volunteer_query = new WP_Query('post_type=Volunteer&orderby=menu_order&posts_per_page=-1');
if ( $volunteer_query->have_posts() ) : while ( $volunteer_query->have_posts() ) : $volunteer_query->the_post();?>
<div class="volunteer-content" id="oppurtunity-<?php the_ID();?>">
<h2>
<?php the_title(); ?>
</h2>
<a href="mailto:[email protected]?subject=Volunteer:<?php urlencode(the_title());?>">Contact Us</a>
<div class="volunteer-text">
<?php the_content(); ?>
</div>
</div>
<?php endwhile; else:?>
<?php endif;
//Reset Query
rewind_posts();
?>
</div>
</div>
<a class="top" href="#" title="Top">BACK TO TOP</a>
<?php get_footer(); ?>
also if you want you can change the post per page count from admin as i already set it to one on this holding-page.php so you dont have to set it in the admin.
<strong>
I tested this code and navigation is working</strong>
Nilesh shiragave comments:
You have to add this code in your holding-page.php
Nilesh shiragave comments:
Did you tried that code which i sent in my previous message. Check and let me know
Nilesh shiragave comments:
did you check code sent by me...
John Farrow comments:
I have shorted my home page to make it simpler, but you're code is not working on my database
<?php
ob_start();
/*
Template Name: Front Page
*/
?>
<?php get_header(); ?>
<div class="post" id="home">
<h2><img src="<?php echo bloginfo('template_url'); ?>/style/images/home-page-header-para.png" alt="Britain's first major festival celebrating South Asian literature" ></img></h2>
<div class="news">
<a class="news-top" href="<?php bloginfo('rss_url'); ?>"><img src="<?php echo bloginfo('template_url'); ?>/style/images/news-top.png" alt="News Top"></a><span style="opacity: 0;"class="subscribe-hint">Get RSS Feed <img style="float: right;"src="<?php echo bloginfo('template_url'); ?>/style/images/social/feed.png" width="16" height="16" alt="Feed"></span>
<div id="news-feed">
<?php
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('showposts=1'.'&paged='.$paged);
if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();?>
<div class="new-entry">
<a href="<?php the_permalink();?>"><h2><?php the_title(); ?></h2></a><div class="post-details"><?php the_time('l, F jS, Y') ?><?php comments_number('',' - 1 comment',' - % comments'); ?></div>
<?php mf_post_thumbnail('med-cropped');?>
<?php
global $more; // Declare global $more (before the loop).
$more = 0; // Set (inside the loop) to display content above the more tag.
the_content(" Read More...");
?>
<script type="text/javascript">
function getTinyUrl($url) {
$tinyurl = file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
return $tinyurl;
}
var twtTitle = "Just reading '<?php the_title(); ?>'";
var tinyUrl = "<?php
echo getTinyUrl(get_permalink(get_the_ID()));?>";
var twtLink = 'http://twitter.com/home?status='+encodeURIComponent(twtTitle + ' ' + tinyUrl + " #salf");
document.write('<a class="twitter" href="'+twtLink+'" target="_blank"'+'><img src="<?php echo bloginfo('template_url')?>/style/images/social/twitter.png" border="0" alt="Tweet This!" /'+'><'+'/a>');
</script>
<noscript><a class="twitter" href="http://twitter.com/home?status=<?php echo getTinyUrl(get_permalink(get_the_ID()));?>" target="_blank"'+'><img src="<?php echo bloginfo('template_url')?>/style/images/social/twitter.png" border="0" alt="Tweet This!" /></a></noscript>
<span class="facebook-connect">
<a href=# target="_blank" class="facebook"><img src="<?php echo bloginfo('template_url')?>/style/images/social/facebook.png" width="16" height="16" alt="Facebook" /></a>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: '130496703654288', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<div class="fb-iframe"><fb:like action='like' href="<?php the_permalink();?>"colorscheme='light'
layout='standard' show_faces='true' width='200'/></div>
</span>
</div>
<?php
endwhile;
?>
<div class="custom-pagination">
<div class="alignleft"><?php previous_posts_link('« Previous') ?></div>
<div class="alignright"><?php next_posts_link('More »') ?></div>
<?php
endif;
//Reset Query
rewind_posts();
?>
<?php $wp_query = null; $wp_query = $temp;?>
</div>
</div><!--End news-feed-->
<div id="stream-tweet">
<div class="dsc_tweet tweets"><H2><img src="<?php echo bloginfo('template_url');?>/style/images/tweets-from.png" width="150" height="25" alt="TWEETS FROM US"></H2></div>
<div class="query_tweet tweets"><H2><img src="<?php echo bloginfo('template_url');?>/style/images/tweets-about.png" width="150" height="25" alt="TWEETS ABOUT US"></H2></div>
</div>
</div>
<?php get_footer(); ?>
Nilesh shiragave comments:
I tested that code.. it works when you not select that page as home page from reading. It stop 's working when you select that page as home page.
John Farrow comments:
that's no use then, as the page IS the home page
vipul jariwala answers:
Hi the correct solution may be,
Please copy and paste below code in functions.php file (at bottom) and your page will rock.
No need of query_post().
<?php
add_action('init','do_settings_cat');
function do_settings_cat(){
global $posts_per_page,$wp_query;
$posts_per_page=1;
add_filter('post_limits', 'posts_per_page_fun' );
}
function posts_per_page_fun(){
if(is_archive()) {
global $wpdb,$paged,$query_string,$posts_per_page; if($_REQUEST['paged']){$paged=$_REQUEST['paged'];}
if($paged){ if($posts_per_page>1){$paged=$paged;}else{$paged=$paged-1;}}else{$paged=0;}
$limit = " limit $paged,$posts_per_page ";
return $limit;
}
}
?>
Thanks