'label' => 'Tweet',
'public' => true,
'has_archive' => true,
'taxonomies' => array( 'category' ),
'rewrite' => array( 'slug' => 'tweet', 'with_front' => true ),
'supports' => array( 'title', 'thumbnail', 'editor', 'author' )
$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
$args = array(
'post_type' => array( 'post', 'tweet' ),
'posts_per_page' => 4,
'orderby'=> 'menu_order',
'paged' => $paged
);
$the_query = new WP_Query( $args );
?>
<div class="col-md-6 col-md-offset-3">
<?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="page-header">
<h1><?php the_title(); ?></h1>
<?php if(get_post_type() === 'post') : ?>
<p><?php the_excerpt(); ?></p>
<?php else: ?>
<p><?php the_content(); ?></p>
<?php endif; ?>
</div>
<?php endwhile; endif; ?>
<?php
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $the_query->max_num_pages
) );
?>
</div>
]]><?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array( 'posts_per_page' => 3 ,'paged'=>$paged);
$the_query = new WP_Query( $args );
while ($the_query ->have_posts()) : $the_query -> the_post();
?>
<div id="pbox">
<div id="pthumb"><a href="<?php the_permalink(); ?>" class="ptitle"><?php the_post_thumbnail('thumbnail', array('class' => 'mythumbnail')); ?></a></div>
<div id="pcontent">
<a href="<?php the_permalink(); ?>" class="ptitle"><?php the_title(); ?></a>
<?php the_excerpt(); ?><br />
Post Category: <b><?php the_category( ', ' ); ?></b>
</div>
</div>
<?php
endwhile;
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '/page/%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $the_query->max_num_pages
) );
echo $paged;
wp_reset_query(); ?>
]]>I want to get zemanta related post to appear after the wordpress pagination in 2014 wordpress theme. I have tried to insert <?php wp_related_posts()?> above and below “// Previous/next post navigation.” in the single.php file and then my site will not load. It will display a blank page.
Also I am using child theme, is there a way to have <?php wp_related_posts()?> used in the child theme to guard against theme upgrades.
Below is a paste of my single.php file
***********************************************************************
<?php
/**
* The Template for displaying all single posts
*
* @package WordPress
* @subpackage Twenty_Fourteen
* @since Twenty Fourteen 1.0
*/
get_header(); ?>
<div id=”primary” class=”content-area”>
<div id=”content” class=”site-content” role=”main”>
<?php
// Start the Loop.
while ( have_posts() ) : the_post();
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( ‘content’, get_post_format() );
// Previous/next post navigation.
twentyfourteen_post_nav();
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
comments_template();
}
endwhile;
?>
</div><!– #content –>
</div><!– #primary –>
<?php
get_sidebar( ‘content’ );
get_sidebar();
get_footer();
***********************************************************************
Thanks in advance.
https://www.ads-software.com/plugins/zemanta/
]]>the pagination on the homepage does not work…..the pagination on category pages work but not on the homepage….also pls give me a step by step…i am kind of a newbie…thanks !
this is the pagination code
`
if ( !function_exists( ‘pagination’ ) ) {
function pagination($pages = ”, $range = 4)
{
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == ”)
{
global $wp_query;
$pages = $wp_query->max_num_pages;
if(!$pages)
{
$pages = 1;
}
}
if(1 != $pages)
{
echo “<div class=\”pagination\”><span>Page “.$paged.” of “.$pages.”</span>”;
if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo “« First“;
if($paged > 1 && $showitems < $pages) echo “‹ Previous“;
for ($i=1; $i <= $pages; $i++)
{
if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
{
echo ($paged == $i)? “<span class=\”current\”>”.$i.”</span>”:”“.$i.”“;
}
}
if ($paged < $pages && $showitems < $pages) echo “Next ›“;
if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo “Last »“;
echo “</div>\n”;
}
}
}
]]><?php if ( have_posts() ) : ?>
<?php query_posts(‘cat=20&posts_per_page=2’);
while (have_posts()) : the_post();
?>
<?php
$thumbnail_id = get_post_thumbnail_id();
$thumbnail_url = wp_get_attachment_image_src ( $thumbnail_id,
‘thumbnail-size’, TRUE );
$thumbnail_meta = get_post_meta( $thumbnail_id, ‘_wp_attachment_image_alt’, TRUE );
?>
<div class=”col-md-5″>
“>
<h4><?php the_title(); ?></h4>
<img alt=”<?php echo $thumbnail_meta; ?>” class=”img-responsive” src=”<?php echo $thumbnail_url[0]; ?>” />
</div>
<?php endwhile; ?>
<div class=”nav-previous”>
<?php previous_posts_link( ‘Older posts’ ); ?>
</div>
<div class=”nav-next”>
<?php next_posts_link( ‘newer posts’ ); ?>
</div>
<?php else : ?>
<p><?php _e(‘Sorry, no posts matched your criteria’) ?></p>
<?php endif; ?>
<?php wp_reset_query(); ?>
]]>I’m having a difficult time displaying my wordpress blog’s pagination on the homepage.
Can someone help me fix it – any advice would be greatly appreciated.
How do I fix pagination on my blog, so that the “older posts” and “new posts” can show up to my readers?
Please help me out.
Thank you.
Michael
]]>$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query(‘showposts=1&cat=44′.’&paged=’.$paged);
while ( $wp_query->have_posts() ) : $wp_query->the_post();
the_title();
endwhile;
if(function_exists(‘wp_pagenavi’)) {
wp_pagenavi();
}