{"id":4785,"date":"2009-02-18T11:24:58","date_gmt":"2009-02-18T11:24:58","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/smarter-navigation\/"},"modified":"2015-09-18T22:24:06","modified_gmt":"2015-09-18T22:24:06","slug":"smarter-navigation","status":"publish","type":"plugin","link":"https:\/\/scn.wordpress.org\/plugins\/smarter-navigation\/","author":180901,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.4","stable_tag":"1.4","tested":"3.5.2","requires":"3.2","requires_php":"","requires_plugins":"","header_name":"Smarter Navigation","header_author":"scribu, versusbassz","header_description":"","assets_banners_color":"","last_updated":"2015-09-18 22:24:06","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"http:\/\/wordpress.org\/extend\/plugins\/smarter-navigation\/","header_author_uri":"","rating":4.7,"author_block_rating":0,"active_installs":300,"downloads":19415,"num_ratings":10,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":"1","3":0,"4":0,"5":"9"},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.1.2","1.2.1","1.3.1","1.3.2","1.4"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1753,3980,3981,4131],"plugin_category":[36,43],"plugin_contributors":[77621,82055],"plugin_business_model":[],"class_list":["post-4785","plugin","type-plugin","status-publish","hentry","plugin_tags-navigation","plugin_tags-next","plugin_tags-previous","plugin_tags-referrer","plugin_category-analytics","plugin_category-customization","plugin_contributors-scribu","plugin_contributors-versusbassz","plugin_committers-scribu","plugin_committers-versusbassz"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/smarter-navigation.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>When displaying a single post, you might want to show links to the previous and next posts in the same category.<\/p>\n\n<p>That's fine; WordPress let's you do this with <code>previous_post_link()<\/code> and <code>next_post_link()<\/code>.<\/p>\n\n<p>But what if that post is in multiple categories?<\/p>\n\n<p>What if the user came to that post from a tag page or from an author page? Wouldn't it make more sense to display previous \/ next posts from that particular set?<\/p>\n\n<p>Well, you can do this with a similar pair of functions, provided by this plugin: <code>previous_post_smart()<\/code> and <code>next_post_smart()<\/code>.<\/p>\n\n<p>Here's how it works:<\/p>\n\n<p>Whenever a visitor goes to an archive page (category, tag, date, author, search etc.), the plugin notes which archive it is in a browser cookie.<\/p>\n\n<p>Then, if the visitor goes to a single post from that archive page, the plugin generates the prev \/ next links based on the information in the cookie.<\/p>\n\n<p>Links: <a href=\"http:\/\/scribu.net\/wordpress\/smarter-navigation\">Plugin News<\/a> | <a href=\"http:\/\/scribu.net\">Author's Site<\/a><\/p>\n\n<!--section=installation-->\n<ol>\n<li>Unzip the archive and put the folder into your plugins folder (\/wp-content\/plugins\/).<\/li>\n<li>Activate the plugin from the Plugins admin menu.<\/li>\n<\/ol>\n\n<h4>Basic usage<\/h4>\n\n<p>Go to your theme directory and open single.php.<\/p>\n\n<p>Replace<\/p>\n\n<pre><code>previous_post_link( with `previous_post_smart(` \n<\/code><\/pre>\n\n<p>and<\/p>\n\n<pre><code>next_post_link( with `next_post_smart(`\n<\/code><\/pre>\n\n<h4>Referrer link<\/h4>\n\n<p>If you also want to display a link back to the list of posts, add this line (also in single.php):<\/p>\n\n<pre><code>&lt;?php referrer_link(); ?&gt;\n<\/code><\/pre>\n\n<h4>Posts with multiple categories<\/h4>\n\n<p>If you want for example to <a href=\"http:\/\/wordpress.org\/support\/topic\/366588\">higlight the category<\/a> that the user came from, you can use <code>get_referrer_category()<\/code> to retrieve the category object.<\/p>\n\n<p>For further reference, all the template tags are located in <a href=\"http:\/\/plugins.trac.wordpress.org\/browser\/smarter-navigation\/trunk\/template-tags.php\">smarter-navigation\/template-tags.php<\/a>.<\/p>\n\n<!--section=faq-->\n<dl>\n<dt>\"Parse error: syntax error, unexpected...\" Help!<\/dt>\n<dd><p>Make sure your host is running PHP 5. Add this line to wp-config.php to check:<\/p>\n\n<pre><code>var_dump(PHP_VERSION);\n<\/code><\/pre><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>1.4<\/h4>\n\n<ul>\n<li>added support for custom taxonomies. props badfeather<\/li>\n<li>fixed strict standards errors. props badfeather<\/li>\n<\/ul>\n\n<h4>1.3.2<\/h4>\n\n<ul>\n<li>fix case when plugin worked incorrect with pagination<\/li>\n<\/ul>\n\n<h4>1.3.1<\/h4>\n\n<ul>\n<li>fix case when multiple browser tabs are involved<\/li>\n<li>fix case when multiple posts have the exact same date<\/li>\n<\/ul>\n\n<h4>1.3<\/h4>\n\n<ul>\n<li>store query vars in cookie instead of individual post ids<\/li>\n<li>fix referer link<\/li>\n<li><a href=\"http:\/\/scribu.net\/wordpress\/smarter-navigation\/sn-1-3.html\">more info<\/a><\/li>\n<\/ul>\n\n<h4>1.2.1<\/h4>\n\n<ul>\n<li>enable $in_same_cat by default<\/li>\n<\/ul>\n\n<h4>1.2<\/h4>\n\n<ul>\n<li>moved to PHP5 syntax<\/li>\n<li>added get_referrer_category() and get_referrer_url() template tags<\/li>\n<li>added $in_same_cat and $excluded_categories arguments to previous_post_smart() &amp; next_post_smart()<\/li>\n<li><a href=\"http:\/\/scribu.net\/wordpress\/smarter-navigation\/sn-1-2.html\">more info<\/a><\/li>\n<\/ul>\n\n<h4>1.1.2<\/h4>\n\n<ul>\n<li>added $fallback parameter to *_post_smart()<\/li>\n<\/ul>\n\n<h4>1.1.1<\/h4>\n\n<ul>\n<li>better SQL limit<\/li>\n<\/ul>\n\n<h4>1.1<\/h4>\n\n<ul>\n<li>handles posts split on multiple pages<\/li>\n<li>better behaviour when multiple tabs open<\/li>\n<li><a href=\"http:\/\/scribu.net\/wordpress\/smarter-navigation\/sn-1-1.html\">more info<\/a><\/li>\n<\/ul>\n\n<h4>1.0<\/h4>\n\n<ul>\n<li>initial release<\/li>\n<li><a href=\"http:\/\/scribu.net\/wordpress\/smarter-navigation\/sn-1-0.html\">more info<\/a><\/li>\n<\/ul>","raw_excerpt":"Generates more specific previous \/ next post links based on referrer.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/4785","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=4785"}],"author":[{"embeddable":true,"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/scribu"}],"wp:attachment":[{"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=4785"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=4785"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=4785"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=4785"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=4785"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/scn.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=4785"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}