WordPress Blog Context Help Mode Toggler Primer Tutorial

Wordpress Blog Context Help Mode Toggler Primer Tutorial

Wordpress Blog Context Help Mode Toggler Primer Tutorial

On this WordPress Blog we’ve had a policy of providing default Ajax inspired contextual help as the default setting. However it may be that you want to skip this contextual help if you “know the ropes” regarding navigating this blog, and so, we, today, offer the turning off of contextual help as an alternative, and if chosen, that mode of use stays for all visits (using that same Web Browser) for the computer you are using, until you reset the “toggler” to the other context help mode of use.

So what facilitates this change in functionality? Well, it is to do with whether the Javascript homegrown external file called wajax.js is loaded between <head> and </head> or not. It is far easier to change “wajax.js” to “nothing.js” (our homegrown “was going to be empty … but realized we need to keep a bit” Javascript external file created to help with today’s tutorial) using PHP (a server side language) rather than Javascript (where using something like “document.head.innerHTML=document.head.innerHTML.replace(‘waj’ + ‘ax.js’, ‘noth’ + ‘ing.js’);” does not appear to work nearly as well as you might, naively, imagine (but it may have been yet another bad hair day).

And where might you add such functionality? Well, we wanted it above the “fold” somewhere, and we figured it affected lots of postings, so why not put it as a suboption or submenu of the All Posts menu.

We make it effectively a single link to work, but give you the chance to refuse to do it with a Javascript prompt window, where we explain the implications in a little more detail than is applicable for a suboption submenu wording.

So you can see the Add Page that that menu suboption required, and the piece of independent PHP programming source code required to make all this possible is context_help.php. Go to another webpage on the blog and it should retain your last setting in a similar fashion … until you use the new submenu suboption to toggle it.

If you want to see how good old header.php changed it is in three parts below (with bold bits of change) … up near the top (before anything significant happens in the code), then the decision about whether the homegrown external Javascript file should be “wajax.js” or “nothing.js”, and then around courseCookies (as per usual) versus, if you don’t have course functionality you can go <body onload=” ajaxcontexthelp_mode(); “> … just below, the nonbold bit is nonbold, because it first came into play with WordPress Blog Download Mode Toggler Primer Tutorial


function my_t_d_server_remote_addr() {
$rma = $_SERVER['REMOTE_ADDR'];
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
// you can add different browsers with the same way ..
if(preg_match('/(chromium)[ /]([w.]+)/', $ua))
$rma = '000000'.$rma;
elseif(preg_match('/(chrome)[ /]([w.]+)/', $ua))
$rma = '00000'.$rma;
elseif(preg_match('/(safari)[ /]([w.]+)/', $ua))
$rma = '0000'.$rma;
elseif(preg_match('/(opera)[ /]([w.]+)/', $ua))
$rma = '000'.$rma;
elseif(preg_match('/(msie)[ /]([w.]+)/', $ua))
$rma = '00'.$rma;
elseif(preg_match('/(mozilla)[ /]([w.]+)/', $ua))
$rma = '0'.$rma;
return $rma;
}

$ajaxjs = "wajax.js";
if (file_exists("c_h_" . my_t_d_server_remote_addr() . "huh")) {
$ajaxjs = "nothing.js";
}

… the bold bit below used to be … wajax.js …


<script type='text/javascript' src='//www.rjmprogramming.com.au/wordpress/wp-admin/js/<?php echo $ajaxjs; ?>'></script>

… and now the onload logic, in header.php …



function ajaxcontexthelp_mode() {
var chdmjk=0;
<?php
if (file_exists("c_h_" . my_t_d_server_remote_addr() . "huh")) {
echo "n" . ' var choxli=document.getElementsByClassName("page-item-12212"); if (choxli[0] != null) { var chns=choxli[0].innerHTML.replace(' . "'Toggle Context Help Mode t' + 'o o' + 'ff', 'Toggle Context Help Mode t' + 'o o' + 'n'" . ').replace(' . "'Toggle Context Help Mode t' + 'o o' + 'ff', 'Toggle Context Help Mode t' + 'o o' + 'n'" . '); choxli[0].innerHTML=chns; } ' . "n";
echo "n" . ' var chcoxli=document.getElementsByClassName("entry-title"); if (chcoxli[0] != null) { chcoxli[0].innerHTML=chcoxli[0].innerHTML.replace(' . "'Toggle Context Help Mode t' + 'o o' + 'ff', 'Toggle Context Help Mode t' + 'o o' + 'n'" . ').replace(' . "'Toggle Context Help Mode t' + 'o o' + 'ff', 'Toggle Context Help Mode t' + 'o o' + 'n'" . '); } ' . "n";
}
?>
}

function courseCookies() {

ajaxcontexthelp_mode(); // Check on Context Help mode

download_mode(); // Check on Download mode
checkpt(); // category and tag "oldest"
rptwo(); // Recent Post images

Our contextual help Javascript source code (all in the one place) can be downloaded by wajax.js which changed as per wajax.js for these modifications today.

Hope you enjoy today’s tutorial and will leave you with a link to Wikipedia’s “take” on Ajax … lots of different interesting references here.

If this was interesting you may be interested in this too.

This entry was posted in Ajax, eLearning, Tutorials and tagged , , , , , , , , . Bookmark the permalink.

25 Responses to WordPress Blog Context Help Mode Toggler Primer Tutorial

  1. I cling on to listening to the news bulletin lecture about getting free online grant applications so I have been looking around for the most excellent site to get one. Could you advise me please, where could i acquire some?

  2. Louise says:

    Hello, fajny rozdział. Określony czas nie pisałem tak interesującego dzieła

  3. I’m still learning from you, but I’m making my way to the top as well. I certainly love reading all that is posted on your website.Keep the tips coming. I loved it!

  4. Healthy Life says:

    As I website possessor I believe the content matter here is rattling wonderful , appreciate it for your hard work. You should keep it up forever! Good Luck.

  5. Thanks for sharing superb informations. Your web-site is so cool. I am impressed by the details that you¡¦ve on this blog. It reveals how nicely you perceive this subject. Bookmarked this website page, will come back for more articles. You, my pal, ROCK! I found just the info I already searched everywhere and just couldn’t come across. What an ideal web-site.

  6. Insurance says:

    My wife and i have been really comfortable Raymond managed to carry out his researching by way of the precious recommendations he discovered using your blog. It’s not at all simplistic just to be giving out ideas which usually many others have been selling. So we do know we have the writer to be grateful to for this. These explanations you made, the easy site navigation, the relationships your site assist to foster – it’s got most great, and it’s aiding our son and the family feel that this theme is enjoyable, which is certainly extremely fundamental. Thank you for the whole lot!

  7. Louis says:

    Cześć, ciekawy wpis. Określony czas nie pisałem tak interesującego dzieła

  8. Wow, superb weblog layout! How long have you ever been blogging for? you made blogging glance easy. The whole look of your site is great, let alone the content!

  9. Hey, you used to write magnificent, but the last several posts have been kinda boring¡K I miss your tremendous writings. Past several posts are just a bit out of track! come on!

  10. Thank you for some other informative web site. Where else could I am getting that type of information written in such an ideal means? I have a challenge that I am simply now working on, and I’ve been at the glance out for such information.

  11. recognize says:

    What i do not realize is in reality how you are no longer actually much more well-preferred than you may be now. You’re very intelligent. You already know therefore considerably in relation to this matter, made me personally consider it from a lot of numerous angles. Its like women and men don’t seem to be involved except it is one thing to do with Woman gaga! Your personal stuffs outstanding. At all times care for it up!

  12. Definitely, what a splendid website and illuminating posts, I will bookmark your blog.Have an awsome day!

  13. Cool says:

    Supporting the article.. thanks a bunch So happy to possess located this submit.. So content to have located this submit.. Is not it terrific after you acquire a very good article?

  14. Easy says:

    I appreciate you writing your viewpoint.. Truly appreciate the entry you delivered.. I enjoy you revealing your perspective.. So pleased to get identified this post..

  15. I truly wanted to make a small comment to appreciate you for some of the great solutions you are posting at this website. My time consuming internet lookup has at the end of the day been honored with incredibly good facts to share with my partners. I ‘d assume that most of us site visitors are undoubtedly lucky to live in a remarkable network with very many lovely individuals with good suggestions. I feel very happy to have seen your website and look forward to many more amazing minutes reading here. Thanks a lot once more for everything.

  16. Hey rather cool internet web-site!! Man .. Beautiful .. Amazing .. I’ll bookmark your internet website and take the feeds also’I’m happy to uncover numerous beneficial details appropriate here inside the submit, we will want develop far far more strategies in this regard, thanks for sharing. . . . . .

  17. graceful says:

    Thank you for every one of your efforts on this website. My niece really likes going through internet research and it is easy to see why. All of us know all concerning the dynamic tactic you present both useful and interesting guidance via the website and encourage response from other ones on the concept so my child is actually studying a great deal. Take pleasure in the remaining portion of the new year. You are performing a fabulous job.

  18. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You clearly know what youre talking about, why throw away your intelligence on just posting videos to your blog when you could be giving us something informative to read?|

  19. I¡¦m not positive where you’re getting your info, however great topic. I needs to spend a while finding out much more or working out more. Thank you for great info I used to be searching for this information for my mission.

  20. youtube says:

    It’s amazing for me to have a website, which is useful for my experience. thanks admin|

  21. Pretty! This has been a really wonderful article. Thank you for providing this
    information.

  22. In tem vo says:

    Why people still use to read news papers when in this technological globe everything is accessible on web?

  23. I am really thankful to the owner of this website who has shared this fantastic
    piece of writing at at this time.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>