WordPress Logo

WordPress Beginners Tutorial – Building a Theme Options Page

WordPress Beginners Tutorial – Building a Theme Options Page

After many hours of searching the web, looking for some great WordPress admin theme options page tutorials, I have found a lot of different methods which became confusing and complicated. So after many hours of learning and understanding how to create an options page, and after including an options page for some of my clients, I decided to create the most BASIC tutorial on this issue. I will try to be as basic and simple as possible so beginners can follow along easily. This tutorial expects the user to have a beginner background in html, php and WordPress. This tutorial will show the very minimal things to code to get a working options page in your WordPress theme. After you start to understand and learn the basics, then you can branch out and find some more advanced tutorials. So here we go. To set this up, say we are creating a brand new WordPress theme called Blitz. If there already is a WordPress theme called Blitz, this tutorial has no relationship to that theme and is purely by coincidence. Of course with our new Blitz theme, we have a folder called Blitz under our themes folder and includes the very basic files that are required for a WordPress Theme. The files we have in our Blitz folder are index.php, header.php, footer.php, style.css and functions.php.

Read More

Blog, Web Development, WordPress,
Internet Explorer Logo

IE 10 Drops Conditional Comments

OK, Everyone. Do not FREAK OUT yet. Yes, IE 10 Drops Conditional Comments. What is up Microsoft? What does this means to web designers and developers that have to support IE. It just means the old way of conditional commenting to target a specific IE version and then use a IE specific css stylesheet will not work. For example, the old way:

<!--- code for using different IE stylesheets --->
 
 <!--[if IE 8]>
       <link rel="stylesheet" type="text/css" href="http://library.utsouthwestern.edu/css/ie8.css" />
 < ![endif]-->
 <!--[if IE 9]>
    	<link rel="stylesheet" type="text/css" href="http://library.utsouthwestern.edu/css/ie.css" />
 < ![endif]-->

 

So here is the new way that I found that worked great for me.

In my main stylesheet, I use a media query to set the IE specific css style as such:

/**** IE 10 sepcific styles ***/ 
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) 
{ 
    #footer { 
        width: 525px; 
    } 
}

 

You can still use the old way if you have to support older versions of IE(7, 8, 9). But no dice for IE 10. For more information regrading this new issue check out this great article at SitePoint by Craig Butler.

Blog, Web Design, Web Development,
ColdFusion Logo

Cold Fusion CF Forms injecting javascript into head of webpage….

So, for those new to Cold Fusion or maybe someone that have not ran across this issue before, here it is. Cold Fusion cfforms tag automatically injects javascript code into the head of your webpage. Most of the time this might not be a real issue. But if you are like some us out there that still have to deal with supporting older versions of IE, then this can be a real headache. OK, here is the problem that I ran into and would like to share this to hopefully save someone else some precious time that I spent debugging.

We are redesigning our Cold Fusion website and decided to use more modern design elements such as HTML 5 along with a responsive design for our users with more up to date browsers. Now the problem is IE 7 & 8 has this dumb thing called compatibility mode. As IE looks at the webpage and it does not recognize doctypes and other things that are not compatible then it gets pushed down and the webpage is then displayed in the lower IE versions. Of course, older versions of IE does not understand HTML5 so if a user has compatibly mode enabled, it will break our new beautiful responsive website. Another thing in IE, is that if the website is considered an intranet site, it will automatically enable compatibly view. Working in an academic setting, our website is viewed on campus gets pushed to an intranet site. Off campus, it is not an intranet site. So as you can see our dilemma. But wait, there is a fix. There is a line of code that must be placed in the head of your webpage that will disable compatibly view and force IE to render the webpage in whatever IE version you are using. EXCELLENT! Here is that magic line of code:

<meta http-equiv="X-UA-Compatible" content="IE=edge"/>

 

There are many articles out there explaining this line of code so I will not go into details. So our problems are solved, now whenever someone views our website using IE 7 or 8, IE will stay in IE 7 or 8.

“STOP THE CLOCK”. After placing this code in the webpage’s header, it is still not working. What the heck. After doing many hours of research, I found an article that stated that this line must be placed right after your head tag. OK, no problem. I then placed our magic code right after my head tag. OK. this has to be it. But unfortunately, no luck. Still does not fix our issue. What is going on, I then looked back at the page source view and I see that javascript code from the cfform tag being placed right above my IE magic line of code. I start to scratch my head and said maybe this is causing this issue. So I disabled my cfform tag and guess what. BOOM, THERE GOES THE DYNAMITE! It worked! So now I have figured out the cause and now I need to find a fix.

There are a couple of different ways to fix this. One, DON”T USE the cfform tag. Use, regular html form tags. So for our main searchbox on our home page, I had to convert our cfform to normal html form tag. But that only solved our header section. Since this form sits in our header file and all of the rest of our hundred of pages call that same header file, then most pages are fixed. NOT SO FAST! This solved most of our pages except our Forms section.

We have a Forms section on the website that has about 20+ online forms. Do we really want to change all of this forms from cfforms to normal html forms(We have some very detailed forms using some special cfform tag options, cfform binding and heavy javascript) . But doesn’t that kill our point of using Cold Fusion. We choose to use Cold Fusion for all of its greatness and its many tags, that save us many hours of coding time. So how could we fix our code on all of our online forms, to take advantage of the greatness of Cold Fusion and its cfform tag but fix our IE issue. What we did was just re-code our forms and actually did a bit of hacking.

We hard-coded these two lines on each form page

<!doctype html>
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"/>

before we call our main header file. Of course this is not very good coding in terms of semantics and validation, but we need the forms to work in all browsers and having to support older versions of IE, sometimes there is not much you can do. So now all of our Form pages use the cfform tag and all display perfectly in IE 7 &8.

To wrap this up, I am writing this post to hopefully have this land into the hands of some CF Developer and will hopefully save them many hours of debugging research. This might not be the only way to fix this issue but this is what we did to solve our issues.

Blog, Cold Fusion, Web Design, Web Development,