{"id":9963,"date":"2014-10-05T05:06:13","date_gmt":"2014-10-04T18:06:13","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=9963"},"modified":"2014-10-05T05:06:13","modified_gmt":"2014-10-04T18:06:13","slug":"wordpress-blog-course-design-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-blog-course-design-primer-tutorial\/","title":{"rendered":"WordPress Blog Course Design Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/wpblog_course_design.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" id=\"wbcdi\" onmouseover=\" this.src=this.src.replace('.jpg','.PNG').replace('.png','.jpg').replace('.PNG','.png'); \" alt=\"Wordpress Blog Course Design Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/wpblog_course_design.jpg\" title=\"Wordpress Blog Course Design Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Wordpress Blog Course Design Primer Tutorial<\/p><\/div>\n<p>This WordPress blog could benefit from a directed order of tutorials studied for a particular topic.   This may not suit everybody, but it may suit some, and if a system is created that is optional, that can sit on top of what functionality is already there, all the better.<\/p>\n<p>When you want to add PHP (or HTML, for that matter) functionality, with web work, I personally find the get parameters useful, and this is usually fine as long as the data required of this functionality &#8230;<\/p>\n<ul>\n<li>is not too long<\/li>\n<li>is not sensitive (ie. not a password or username)<\/li>\n<\/ul>\n<p>&#8230; otherwise it is better to use post parameters or a database or a file arrangement of some sort.<\/p>\n<p>Step one in our Course Design ideas is to introduce two new ideas with two new get parameters, so that:<\/p>\n<ul>\n<li>&amp;pp=[blog id of previous blog post of interest to current one]<\/li>\n<li>&amp;pn=[blog id of next blog post of interest to current one]<\/li>\n<\/ul>\n<p>Here&#8217;s a first draft of a PHP snippet of code to use (though over time it may change):<\/p>\n<p><code><br \/>\nif ( ! function_exists( 'previous_next' ) ) :<br \/>\n\/**<br \/>\n * Allow for next and previous via &pn= and &pp= respectively.<br \/>\n *<br \/>\n * @since October 2014 by RJM Programming<br \/>\n *\/<br \/>\nfunction previous_next($both = true) {<br \/>\n  if (isset($_GET['pp']) || isset($_GET['pn'])) {<br \/>\n      echo \"&lt;table style='width:98%; background-color: #F6F5F1;'&gt;&lt;tbody&gt;&lt;tr&gt;\";<br \/>\n      if (isset($_GET['pp'])) {<br \/>\n        echo \"&lt;th&gt;&lt;a target=_blank title='Previous' href='\" . str_replace(\"?\" . $_SERVER['QUERY_STRING'], \"\", $_SERVER['REQUEST_URI']) . \"?p=\" . $_GET['pp'] . \"&pn=\" . $_GET['p'] . \"'&gt;Previous Suggestion&lt;\/a&gt;&lt;\/th&gt;\";<br \/>\n      }<br \/>\n      if (isset($_GET['pn'])) {<br \/>\n        echo \"&lt;th&gt;&lt;a target=_blank title='Next' href='\" . str_replace(\"?\" . $_SERVER['QUERY_STRING'], \"\", $_SERVER['REQUEST_URI']) . \"?p=\" . $_GET['pn'] . \"&pp=\" . $_GET['p'] . \"'&gt;Next Suggestion&lt;\/a&gt;&lt;th&gt;\";<br \/>\n      }<br \/>\n      if ($both) {<br \/>\n       echo \"&lt;\/tr&gt;&lt;tr&gt;\";<br \/>\n       if (isset($_GET['pp'])) {<br \/>\n        echo \"&lt;td&gt;&lt;iframe src='\" . str_replace(\"?\" . $_SERVER['QUERY_STRING'], \"\", $_SERVER['REQUEST_URI']) . \"?p=\" . $_GET['pp'] . \"#content' width=400 height=800&gt;&lt;\/iframe&gt;&lt;\/td&gt;\";<br \/>\n       }<br \/>\n       if (isset($_GET['pn'])) {<br \/>\n        echo \"&lt;td&gt;&lt;iframe src='\" . str_replace(\"?\" . $_SERVER['QUERY_STRING'], \"\", $_SERVER['REQUEST_URI']) . \"?p=\" . $_GET['pn'] . \"#content' width=400 height=800&gt;&lt;\/iframe&gt;&lt;\/td&gt;\";<br \/>\n       }<br \/>\n      }<br \/>\n      echo \"&lt;\/tr&gt;&lt;\/tbody&gt;&lt;\/table&gt;\";<br \/>\n  }<br \/>\n}<br \/>\nendif;<br \/>\n<\/code><\/p>\n<p>So where does the code above belong in the WordPress source code?  Well, for the TwentyOne theme of this blog, the answer is wp-content\/themes\/twentyten\/functions.php off the WordPress Blog&#8217;s document root directory (where PHP functions go, generally).<\/p>\n<p>And the plan will be to call it, for the top and bottom of current posting respectively:<\/p>\n<ul>\n<li>&lt;?php previous_next(false); ?&gt;<\/li>\n<li>&lt;?php previous_next(true); ?&gt;<\/li>\n<\/li>\n<\/ul>\n<p>So where does this code go?  Well, for the TwentyOne theme of this blog, the answer is, in WordPress terminology, in <a target=_blank title='The Loop' href='http:\/\/codex.wordpress.org\/The_Loop'>The Loop<\/a>, for the particular scenario, and the scenario here is the display of a single WordPress Blog posting, as typically happens via the Search Engine links or relevant dropdown links within this rjmprogramming.com.au domain &#8230; and this pans out to be within wp-content\/themes\/twentyten\/single.php off the WordPress Blog&#8217;s document root directory &#8230; after these two lines of PHP code respectively &#8230;<\/p>\n<ul>\n<li>&lt;?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?&gt;<\/li>\n<li>&lt;?php endwhile; \/\/ end of the loop. ?&gt;<\/li>\n<\/ul>\n<p>&#8230; for these two looks respectively &#8230;<\/p>\n<ul>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/wpblog_course_design.png\" title=\"At top of posting\">At top of posting<\/a><\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/wpblog_course_design.jpg\" title=\"At bottom of posting\">At bottom of posting<\/a><\/li>\n<\/ul>\n<p>Try an example of a <a target=_blank title='Live run' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=2699&#038;pp=1582&#038;pn=9944'>live run<\/a> of the use of this new functionality here at this WordPress Blog &#8230; but there is more to do &#8230; and we will visit these other &#8220;things to do&#8221; over time &#8230; thanks for visiting &#8230; bye for now.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d9963' onclick='var dv=document.getElementById(\"d9963\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=Wordpress\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d9963' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This WordPress blog could benefit from a directed order of tutorials studied for a particular topic. This may not suit everybody, but it may suit some, and if a system is created that is optional, that can sit on top &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-blog-course-design-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[151,268,932,997,1268,1319,1325,1456],"class_list":["post-9963","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-blog","tag-course-design","tag-php","tag-programming","tag-theme","tag-tutorial","tag-twentyten-theme","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/9963"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=9963"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/9963\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=9963"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=9963"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=9963"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}