{"id":47174,"date":"2019-11-16T03:32:50","date_gmt":"2019-11-15T17:32:50","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=47174"},"modified":"2019-11-17T16:28:43","modified_gmt":"2019-11-17T06:28:43","slug":"wordpress-bold-within-code-styling-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-bold-within-code-styling-primer-tutorial\/","title":{"rendered":"WordPress Bold Within Code Styling Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/bold_code_wp.jpg\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"WordPress Bold Within Code Styling Primer Tutorial\" src=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/bold_code_wp.jpg\" title=\"WordPress Bold Within Code Styling Primer Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">WordPress Bold Within Code Styling Primer Tutorial<\/p><\/div>\n<p>Can&#8217;t remember when it happened, but the HTML &lt;b&gt; <b>bold text<\/b> &lt;\/b&gt; is under threat of deprecation, and this has affected how it no longer &#8220;packs a punch&#8221;, in WordPress blog styling, within a &lt;code&gt; <code>code tag text<\/code> &lt;\/code&gt; as it used to.<\/p>\n<p>This has been annoying news for us trying to link a concept with a code snippet.  But all is not lost, as we can try flagging the link in another way, independent of text line thickness (by the way, the &lt;strong&gt; &lt;\/strong&gt; HTML is an alternative to &lt;b&gt; &lt;\/b&gt;, here).  We read about the concept of Text Gradient at <a target=_blank title='Useful link regarding Text Gradient, thanks' href='https:\/\/cssgradient.io\/blog\/css-gradient-text\/'>this useful link<\/a>, thanks, and applied it to our WordPress TwentyTen themed header.php file <b>as per<\/b> the CSS (code) snippet (within the PHP) &#8230;<\/p>\n<p><code><br \/>\n&lt;style&gt;<br \/>\n\/* Thanks to https:\/\/cssgradient.io\/blog\/css-gradient-text\/ below *\/<br \/>\n<br \/>\n<b>b:not(.dyk) { <\/b><br \/>\n<b>  background: -webkit-linear-gradient(#eee, #333);<\/b><br \/>\n<b>  -webkit-background-clip: text;<\/b><br \/>\n<b>  -webkit-text-fill-color: transparent;<\/b><br \/>\n<b>}<\/b><br \/>\n<b>code b { <\/b><br \/>\n<b>  background: -webkit-linear-gradient(#eee, #333);<\/b><br \/>\n<b>  -webkit-background-clip: text;<\/b><br \/>\n<b>  -webkit-text-fill-color: transparent;<\/b><br \/>\n<b>}<\/b><br \/>\n&lt;\/style&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; the result of the deployment of which shows you this very affect, to look above <font size=1>(as our golden retriever, Nala, is apt to do &#8230;<br \/>\n<img src='\/\/farm8.staticflickr.com\/7328\/11972198873_0cde4c496f.jpg' title='Nala'><\/img><br \/>\n)<\/font>.<\/p>\n<p>Notice the use of a <a target=_blank title='CSS Combinator' href='https:\/\/www.w3schools.com\/css\/css_combinators.asp'>CSS Combinator<\/a> &#8220;code b&#8221; (ie. the &#8220;descendant selector&#8221;, specifically &#8220;Selects all &lt;b&gt; elements inside &lt;code&gt; elements&#8221;)<br \/>\n &#8230;<\/p>\n<blockquote cite='https:\/\/www.w3schools.com\/css\/css_combinators.asp'><p>\nA CSS selector can contain more than one simple selector. Between the simple selectors, we can include a combinator.<br \/>\n<br \/>\nThere are four different combinators in CSS:<br \/>\n<br \/>\ndescendant selector (space)<br \/>\nchild selector (&gt;)<br \/>\nadjacent sibling selector (+)<br \/>\ngeneral sibling selector (~)\n<\/p><\/blockquote>\n<p> &#8230; CSS Selector above, as a tool for that more forensic CSS styling on your webpages!<\/p>\n<p><b><i>Stop Press<\/i><\/b><\/p>\n<p>We found with mobile platforms, that within code elements, when a bold (ie. b element tag) had multiple lines to it, the CSS above caused it to only show the first line, so in TwentyTen theme&#8217;s header.php we had to add onload=&#8221; lookforbincode(); &#8221; code as per &#8230;<\/p>\n<p><code><br \/>\nfunction lookforbincode() {<br \/>\n  var cdsis, bsis, icdsa, jcdsa, xbsis, repwith='', kdsis, vparts;<br \/>\nif (navigator.userAgent.match(\/Android|BlackBerry|iPad|iPhone|iPod|Opera Mini|IEMobile\/i)) { \/\/ it is a mobile device<br \/>\n  cdsis=document.getElementsByTagName('code');<br \/>\n  for (icdsa=0; icdsa&lt;cdsis.length; icdsa++) {<br \/>\n    bsis=cdsis[icdsa].innerHTML.split('&lt;\/b&gt;');<br \/>\n    for (jcdsa=0; jcdsa&lt;eval(-1 + bsis.length); jcdsa++) {<br \/>\n       vparts=bsis[jcdsa].split('&lt;b&gt;');<br \/>\n       if (vparts[eval(-1 + vparts.length)].indexOf(String.fromCharCode(10)) != -1) {<br \/>\n         xbsis=vparts[eval(-1 + vparts.length)].split(String.fromCharCode(10));<br \/>\n         repwith=\"\";<br \/>\n         if (xbsis.length &gt; 2) {<br \/>\n           for (kdsis=0; kdsis&lt;xbsis.length; kdsis++) {<br \/>\n             repwith+=xbsis[kdsis] + '&lt;\/b&gt;' + String.fromCharCode(10) + '&lt;b&gt;';<br \/>\n           }<br \/>\n           if (repwith != '') {<br \/>\n             \/\/cdsis[icdsa].innerHTML=cdsis[icdsa].innerHTML.replace('&lt;b&gt;' + vparts[eval(-1 + vparts.length)] + '&lt;\/b&gt;', '&lt;b&gt;' + repwith + '&lt;\/b&gt;');<br \/>\n             \/\/if (cdsis[icdsa].innerHTML.indexOf('&lt;b&gt;' + vparts[eval(-1 + vparts.length)] + '&lt;\/b&gt;') != -1) { alert(repwith); } else {   alert('0:' + repwith);   }<br \/>\n             cdsis[icdsa].innerHTML=cdsis[icdsa].innerHTML.replace('&lt;b&gt;' + vparts[eval(-1 + vparts.length)] + '&lt;\/b&gt;', '&lt;strong&gt;' + vparts[eval(-1 + vparts.length)] + '&lt;\/strong&gt;');<br \/>\n           }<br \/>\n         }<br \/>\n       }<br \/>\n    }<br \/>\n  }<br \/>\n}<br \/>\n}<br \/>\n<\/code><\/p>\n<p> &#8230; changing b tags into strong tags in this mobile platform &#8220;b within code&#8221; scenario.<\/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='#d47147' onclick='var dv=document.getElementById(\"d47174\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/css\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d47147' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Can&#8217;t remember when it happened, but the HTML &lt;b&gt; bold text &lt;\/b&gt; is under threat of deprecation, and this has affected how it no longer &#8220;packs a punch&#8221;, in WordPress blog styling, within a &lt;code&gt; code tag text &lt;\/code&gt; as &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-bold-within-code-styling-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,3147,218,3146,281,2242,3148,1953,1200,3149,1456],"class_list":["post-47174","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-blog","tag-bold","tag-code","tag-combinator","tag-css","tag-flag","tag-gradient","tag-selector","tag-stop-press","tag-text-gradient","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/47174"}],"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=47174"}],"version-history":[{"count":12,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/47174\/revisions"}],"predecessor-version":[{"id":47205,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/47174\/revisions\/47205"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=47174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=47174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=47174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}