Skip to content

Commit 325170d

Browse files
committed
added links.
1 parent ba4b724 commit 325170d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

roots-nextdatagov/template-feed-atom.php

+22
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,28 @@
1616
?>
1717
<title type="text"><?php bloginfo_rss('name'); wp_title_rss(); ?></title> <subtitle type="text"><?php bloginfo_rss("description") ?></subtitle> <updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></updated> <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('url') ?>" /> <id><?php bloginfo_rss('url') ?><?php bloginfo('atom_url'); ?></id><link rel="self" type="application/atom+xml" href="<?php self_link(); ?>" />
1818
<?php
19+
$category_name= "";
20+
if(!empty($wp_query->query['category_name']))
21+
$category_name = "/".$wp_query->query['category_name'];
22+
$count_posts = $wp_query->found_posts;
23+
echo '<link rel="first" href="'.get_bloginfo('url').$category_name.'/feed/atom/" ></link>'."\n";
24+
$postsperpage = get_option('posts_per_rss');
25+
$total_pages = ceil($count_posts/$postsperpage);
26+
$currentpage = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
27+
if ($currentpage > $total_pages)
28+
$currentpage = $total_pages;
29+
if ($currentpage < 1)
30+
$currentpage = 1;
31+
if ($currentpage > 1) {
32+
$prevpage = $currentpage - 1;
33+
echo '<link rel="previous" href="'.get_bloginfo('url').$category_name.'/feed/atom?paged='.$prevpage.'" ></link>'."\n";
34+
35+
}
36+
if ($currentpage != $total_pages) {
37+
$nextpage = $currentpage + 1;
38+
echo '<link rel ="next" href="'.get_bloginfo('url').$category_name.'/feed/atom?paged='.$nextpage.'" ></link>'."\n";
39+
echo '<link rel ="last" href="'.get_bloginfo('url').$category_name.'/feed/atom?paged='.$total_pages.'" ></link>'."\n";
40+
}
1941
do_action( 'atom_head' );
2042
while ( have_posts() ) : the_post();
2143
?>

0 commit comments

Comments
 (0)