{"id":23051,"date":"2016-06-26T03:01:26","date_gmt":"2016-06-25T17:01:26","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=23051"},"modified":"2016-06-25T21:17:40","modified_gmt":"2016-06-25T11:17:40","slug":"wordpress-temporary-window-print-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-temporary-window-print-primer-tutorial\/","title":{"rendered":"WordPress Temporary Window Print Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a title='WordPress Temporary Window Print Primer Tutorial' href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/all-posts\/temporary-windows-print-button\/\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"WordPress Temporary Window Print Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/windows_print.jpg\" title=\"WordPress Temporary Window Print Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">WordPress Temporary Window Print Primer Tutorial<\/p><\/div>\n<p>A few different themes contribute to today&#8217;s tutorial about presenting a Print button, for a temporary timeframe for the current user only, for our WordPress Blog &#8230;<\/p>\n<ul>\n<li>document <a target=_blank title='Fidelity information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Fidelity'>fidelity<\/a> and the role of (hardcopy) <a target=_blank title='Portable document format (PDF) information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Portable_Document_Format'>PDF<\/a> which we&#8217;ve discussed here <a target=_blank title='Document fidelity blog postings here' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/document-fidelity'>before<\/a><\/li>\n<li>Print Screen snapshot ideas, we last talked about with <a target=_blank title='Windows Screenshot AutoHotKey Automation Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/windows-screenshot-autohotkey-automation-primer-tutorial\/'>Windows Screenshot AutoHotKey Automation Primer Tutorial<\/a><\/li>\n<li>temporary WordPress functionality specific to a user for a WordPress &#8220;session&#8221; &#8230; but note, our &#8220;session&#8221; is different to PHP&#8217;s $_SESSION[] scope, instead working with $_GET[] as the &#8220;session&#8221; mechanism &#8230; about which you can read more at <a title='WordPress Temporary User CSS Primer Tutorial' href='#wtucpt'>WordPress Temporary User CSS Primer Tutorial<\/a> as shown below<\/p>\n<\/li>\n<li>limits of HTML <a target=_blank title='HTML iframe element information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_iframe.asp'>iframe<\/a> applicability, about which you can read more <a target=_blank title='Informative link' href='http:\/\/stackoverflow.com\/questions\/21009084\/cant-display-an-iframe-of-a-file-protocol-url-src-when-the-html-is-load-with'>here<\/a>, thanks &#8230; an &#8220;http[s]:\/\/&#8221; URL cannot <i>iframe<\/i> a &#8220;file:\/\/&#8221; URL, as much as we&#8217;d love to be able to do so today &#8230; it is a security risk to allow this &#8230; otherwise we&#8217;d have designed an instantly reactionary caller of Mac OS X (client computer) \/usr\/sbin\/<a target=_blank title='screencapture command information from Apple' href='https:\/\/developer.apple.com\/legacy\/library\/documentation\/Darwin\/Reference\/ManPages\/man1\/screencapture.1.html'><i>screencapture<\/i><\/a> command to instantly snapshot the client screen &#8230; maybe you remember us not instantly using Mac OS X (client computer) \/usr\/sbin\/<i>screencapture<\/i> command with <a target=_blank title='crontab' href='http:\/\/www.computerhope.com\/unix\/ucrontab.htm'><i>crontab<\/i><\/a> when we presented <a target=_blank title='Mac OS X MAMP Timekeeping Web Application Email Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/mac-os-x-mamp-timekeeping-web-application-email-tutorial\/'>Mac OS X MAMP Timekeeping Web Application Email Tutorial<\/a> recently<\/li>\n<li>similar PHP WordPress Twenty Ten theme (good ol&#8217;) header.php New Page submenu as shown below with <a title='WordPress Temporary User CSS Primer Tutorial' href='#wtucpt'>WordPress Temporary User CSS Primer Tutorial<\/a> &#8230; as <b>below<\/b> &#8230;<br \/>\n<code><br \/>\n&lt;head&gt;<br \/>\n<b><\/b><br \/>\n\/\/ Lots of other Javascript and CSS work<br \/>\n\/\/ ...<br \/>\n<b><\/b><br \/>\n&lt;style&gt;<br \/>\n<b><\/b><br \/>\n\/\/ Lots of other CSS work<br \/>\n\/\/ ...<br \/>\n<b><\/b><br \/>\n<b><br \/>\n   if (isset($_SESSION['ourprint'])) {<br \/>\n     echo str_replace('&lt;' . 'style&gt;','',str_replace('&lt;' . '\/style&gt;','',$_SESSION['ourprint']));<br \/>\n   } else if (file_exists(\"localprint_\" . my_t_d_server_remote_addr() . \".yzy\")) {<br \/>\n     $lprint = str_replace('&lt;' . 'style&gt;','',str_replace('&lt;' . '\/style&gt;','',file_get_contents((\"localprint_\" . my_t_d_server_remote_addr() . \".yzy\"))));<br \/>\n     $_SESSION['ourprint'] = $lprint;<br \/>\n     echo $lprint;<br \/>\n     unlink(\"localprint_\" . my_t_d_server_remote_addr() . \".yzy\");<br \/>\n   } else if (isset($_GET['printask'])) {<br \/>\n   } else if (isset($_GET['ourprint'])) {<br \/>\n     $_SESSION['ourprint'] = urldecode($_GET['ourprint']);<br \/>\n     echo $_SESSION['ourprint'];<br \/>\n   } else if (isset($_GET['printextra'])) {<br \/>\n     $_SESSION['ourprint'] = urldecode($_GET['printextra']);<br \/>\n     echo $_SESSION['ourprint'];<br \/>\n   } else if (strpos($_SERVER['QUERY_STRING'],'printextra=')) {<br \/>\n     $sbits=explode(\"printextra=\", str_replace('#','&',$_SERVER['QUERY_STRING']) . '&');<br \/>\n     $ssbits=explode(\"&\",$sbits[1]);<br \/>\n     $_SESSION['ourprint'] = urldecode($ssbits[0]);<br \/>\n     echo $_SESSION['ourprint'];<br \/>\n   } else if (strpos($_SERVER['QUERY_STRING'],'ourprint=')) {<br \/>\n     $sbits=explode(\"ourprint=\", str_replace('#','&',$_SERVER['QUERY_STRING']) . '&');<br \/>\n     $ssbits=explode(\"&\",$sbits[1]);<br \/>\n     $_SESSION['ourprint'] = urldecode($ssbits[0]);<br \/>\n     echo $_SESSION['ourprint'];<br \/>\n   }<br \/>\n<\/b><br \/>\n&lt;\/style&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; and &#8230;<\/p>\n<p><code><br \/>\nfunction cookie_fonts() {<br \/>\n<b><\/b><br \/>\n\/\/ Lots of other Javascript Cookie based work helping with control of some user styling settings discussed at ...<br \/>\n\/\/ <a target=_blank title='WordPress User Body Background Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-user-body-background-primer-tutorial\/'>https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-user-body-background-primer-tutorial\/<\/a><br \/>\n\/\/ ...<br \/>\n<b><\/b><br \/>\n<b><br \/>\n&lt;?php<br \/>\n   if (isset($_SESSION['ourprint'])) {<br \/>\n     echo \"\\n\" . ' appendtoa(\"printextra\", \"\" + encodeURIComponent(\"' . $_SESSION['ourprint'] . '\"));  ' . \"\\n\";<br \/>\n   }<br \/>\n?&gt;<br \/>\n<\/b><br \/>\n}<br \/>\n\/\/ ...<br \/>\n\/\/ and then lots more down to (unchanged) end of <i>head<\/i> section and document.body <i>onload<\/i> (where <i>cookie_fonts<\/i>() is the last <i>onload<\/i> functionality) as per ...<br \/>\n\/\/ ...<br \/>\n&lt;\/script&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body onload=\" setTimeout(initpostedoncc, 3000);  sdescih();  widgetcon(); precc(); courseCookies(); <i>cookie_fonts();<\/i> \" &lt;?php body_class(); ?&gt;&gt;<br \/>\n<\/code>\n<\/li>\n<\/ul>\n<p> &#8230; and we realize that all the web browsers give this same &#8220;Print button&#8221; functionality available in their File -&gt; Print submenus, but not reminding the user as much as today&#8217;s WordPress addition does to remind the user of this powerful means of communication and sharing with other users and email contacts, utilizing &#8230;<\/p>\n<p><code><br \/>\n<a target=_blank title='Javascript window.print information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/met_win_print.asp'>window.print<\/a>();<br \/>\n<\/code><\/p>\n<p> &#8230; Javascript client-side web application functionality.<\/p>\n<p>We&#8217;ll leave you with today&#8217;s <a title='WordPress Temporary Window Print Primer Tutorial' href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/all-posts\/temporary-windows-print-button\/\">live run<\/a> link to a new WordPress submenu page.<\/p>\n<hr>\n<p id='wtucpt'>Previous relevant <a target=_blank title='WordPress Temporary User CSS Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-temporary-user-css-primer-tutorial\/'>WordPress Temporary User CSS Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a title='WordPress Temporary User CSS Primer Tutorial' href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/all-posts\/temporary-user-css\/\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"WordPress Temporary User CSS Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/temporary_user_css.jpg\" title=\"WordPress Temporary User CSS Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">WordPress Temporary User CSS Primer Tutorial<\/p><\/div>\n<p><a target=_blank title='Cascading Style Sheet information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Cascading_Style_Sheets'>CSS<\/a> is, perhaps, best learnt with a varied <i>palette<\/i> to work with, to see how an effect you want to create both &#8230;<\/p>\n<ol>\n<li>works itself, as the concept you want to see &#8230; and &#8230;<\/li>\n<li>interacts with a wide variety of other cascading styling settings, in terms of its robustness, and hierarchy of usefulness &#8230; in other words, your CSS positioning may be very important regarding its workings<\/li>\n<\/ol>\n<p>Today we introduce some functionality that allows you to use this blog, with its default styling as your <i>palette<\/i> as an experimental tool, perhaps, for your CSS testing.<\/p>\n<p>In these terms we try to have your own CSS be last in the order of CSS interpreted by the web browser, but it is really up to you to see for yourself what you need to do to make things happen.<\/p>\n<p>This change involved &#8230; you probably guessed it &#8230; <b><i>tweaking<\/i><\/b> WordPress TwentyTen theme&#8217;s good ol&#8217; header.php &#8230; in <b>two parts<\/b> &#8230;<\/p>\n<p><code><br \/>\n&lt;head&gt;<br \/>\n<b><\/b><br \/>\n\/\/ Lots of other Javascript and CSS work<br \/>\n\/\/ ...<br \/>\n<b><\/b><br \/>\n&lt;style&gt;<br \/>\n<b><\/b><br \/>\n\/\/ Lots of other CSS work<br \/>\n\/\/ ...<br \/>\n<b><\/b><br \/>\n<b><br \/>\n   if (isset($_SESSION['ourcss'])) {<br \/>\n     echo str_replace('&lt;' . 'style&gt;','',str_replace('&lt;' . '\/style&gt;','',$_SESSION['ourcss']));<br \/>\n   } else if (file_exists(\"localcss_\" . my_t_d_server_remote_addr() . \".yzy\")) {<br \/>\n     $lcss = str_replace('&lt;' . 'style&gt;','',str_replace('&lt;' . '\/style&gt;','',file_get_contents((\"localcss_\" . my_t_d_server_remote_addr() . \".yzy\"))));<br \/>\n     $_SESSION['ourcss'] = $lcss;<br \/>\n     echo $lcss;<br \/>\n     unlink(\"localcss_\" . my_t_d_server_remote_addr() . \".yzy\");<br \/>\n   } else if (isset($_GET['cssask'])) {<br \/>\n   } else if (isset($_GET['ourcss'])) {<br \/>\n     $_SESSION['ourcss'] = str_replace('&lt;' . 'style&gt;','',str_replace('&lt;' . '\/style&gt;','',urldecode($_GET['ourcss'])));<br \/>\n     echo $_SESSION['ourcss'];<br \/>\n   } else if (isset($_GET['cssextra'])) {<br \/>\n     $_SESSION['ourcss'] = str_replace('&lt;' . 'style&gt;','',str_replace('&lt;' . '\/style&gt;','',urldecode($_GET['cssextra'])));<br \/>\n     echo $_SESSION['ourcss'];<br \/>\n   } else if (strpos($_SERVER['QUERY_STRING'],'cssextra=')) {<br \/>\n     $sbits=explode(\"cssextra=\", str_replace('#','&',$_SERVER['QUERY_STRING']) . '&');<br \/>\n     $ssbits=explode(\"&\",$sbits[1]);<br \/>\n     $_SESSION['ourcss'] = str_replace('&lt;' . 'style&gt;','',str_replace('&lt;' . '\/style&gt;','',urldecode($ssbits[0])));<br \/>\n     echo $_SESSION['ourcss'];<br \/>\n   } else if (strpos($_SERVER['QUERY_STRING'],'ourcss=')) {<br \/>\n     $sbits=explode(\"ourcss=\", str_replace('#','&',$_SERVER['QUERY_STRING']) . '&');<br \/>\n     $ssbits=explode(\"&\",$sbits[1]);<br \/>\n     $_SESSION['ourcss'] = str_replace('&lt;' . 'style&gt;','',str_replace('&lt;' . '\/style&gt;','',urldecode($ssbits[0])));<br \/>\n     echo $_SESSION['ourcss'];<br \/>\n   }<br \/>\n<\/b><br \/>\n&lt;\/style&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; and &#8230;<\/p>\n<p><code><br \/>\nfunction cookie_fonts() {<br \/>\n<b><\/b><br \/>\n\/\/ Lots of other Javascript Cookie based work helping with control of some user styling settings discussed at ...<br \/>\n\/\/ <a target=_blank title='WordPress User Body Background Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-user-body-background-primer-tutorial\/'>https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-user-body-background-primer-tutorial\/<\/a><br \/>\n\/\/ ...<br \/>\n<b><\/b><br \/>\n<b><br \/>\n&lt;?php<br \/>\n   if (isset($_SESSION['ourcss'])) {<br \/>\n     echo \"\\n\" . ' appendtoa(\"cssextra\", \"\" + encodeURIComponent(\"' . $_SESSION['ourcss'] . '\"));  ' . \"\\n\";<br \/>\n   }<br \/>\n?&gt;<br \/>\n<\/b><br \/>\n}<br \/>\n\/\/ ...<br \/>\n\/\/ and then lots more down to (unchanged) end of <i>head<\/i> section and document.body <i>onload<\/i> (where <i>cookie_fonts<\/i>() is the last <i>onload<\/i> functionality) as per ...<br \/>\n\/\/ ...<br \/>\n&lt;\/script&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body onload=\" setTimeout(initpostedoncc, 3000);  sdescih();  widgetcon(); precc(); courseCookies(); <i>cookie_fonts();<\/i> \" &lt;?php body_class(); ?&gt;&gt;<br \/>\n<\/code><\/p>\n<p id='myownul'>So if you want to try your own CSS try this <a target=_blank title='Click picture' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/all-posts\/temporary-user-css\/'>live run<\/a> link, and see, below, some other suggestions (which simulate what the All Posts -&gt; Temporary User CSS submenu does), that, if you click, and you want to reset use this <a target=_blank title='Reset link' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-temporary-user-css-primer-tutorial\/?cssextra='>reset link<\/a> here.<\/p>\n<ul>\n<li><a target=_blank title='*{font-family: \"Comic Sans MS\", \"Comic Sans\", cursive;}' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-temporary-user-css-primer-tutorial\/?cssextra=*%7Bfont-family%3A+%22Comic+Sans+MS%22%2C+%22Comic+Sans%22%2C+cursive%3B%7D%0D%0A'>*{font-family: &#8220;Comic Sans MS&#8221;, &#8220;Comic Sans&#8221;, cursive;}<\/a><\/li>\n<li><a target=_blank title='p{background-color:silver;}' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-temporary-user-css-primer-tutorial\/?cssextra=p%257Bbackground-color%253Asilver%253B%257D'>p{background-color:silver;}<\/a><\/li>\n<li><a target=_blank title='ul li:nth-child(3):before{background-color: violet;}' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-temporary-user-css-primer-tutorial\/?cssextra=ul+li%3Anth-child%283%29%3Abefore%7Bbackground-color%3A+violet%3B%7D#myownul'>ul li:<\/a><a target=_blank title='CSS nth-child information' href='https:\/\/css-tricks.com\/how-nth-child-works\/'>nth-child(3)<\/a><a target=_blank title='CSS before property attribute information from w3schools' href='http:\/\/www.w3schools.com\/cssref\/sel_before.asp'>:before<\/a><a target=_blank title='p{background-color:silver;}' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-temporary-user-css-primer-tutorial\/?cssextra=ul+li%3Anth-child%283%29%3Abefore%7Bbackground-color%3A+violet%3B%7D#myownul'>{background-color: violet;}  \/* violet will show under emoji to left *\/<\/a><\/li>\n<\/ul>\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='#d22879' onclick='var dv=document.getElementById(\"d22879\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/blog\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d22879' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\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='#d23051' onclick='var dv=document.getElementById(\"d23051\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/print\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d23051' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>A few different themes contribute to today&#8217;s tutorial about presenting a Print button, for a temporary timeframe for the current user only, for our WordPress Blog &#8230; document fidelity and the role of (hardcopy) PDF which we&#8217;ve discussed here before &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-temporary-window-print-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,14,37],"tags":[151,281,350,554,587,770,913,932,1924,1925,997,1319,1323,1325,1345,1456],"class_list":["post-23051","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-blog","tag-css","tag-document-fidelity","tag-hardcopy","tag-iframe","tag-menu","tag-pdf","tag-php","tag-print","tag-print-screen","tag-programming","tag-tutorial","tag-twenty-ten","tag-twentyten-theme","tag-url","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/23051"}],"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=23051"}],"version-history":[{"count":7,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/23051\/revisions"}],"predecessor-version":[{"id":23058,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/23051\/revisions\/23058"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=23051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=23051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=23051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}