Posts tagged PHP
Something else I missed when looking at themes for my new blog was post template options.
Seems as though the Twenty Eleven theme won’t display the sidebar when viewing a post/article.
Thankfully, it’s not a huge modification and there is lot’s out there on how to do it.
Basically, you modify the theme’s single.php file and add the get_sidebar() function. But that in itself will not be enough, you need to adjust some CSS as well.
I had tried with just the get_sidebar() modification… but after a quick search I found an example.
Check out Zeaks “ADD SIDEBAR TO POST VIEW IN TWENTY ELEVEN THEME” for an example on how to modify the CSS to make this work.
I used it as a reference and it worked great.
I’m setting up a new personal blog and settled on using WordPress’s Twenty Eleven theme that ships with current downloads.
I wanted to create custom banners to be displayed in the “Header” settings under the “Appearance” menu.
I thought they could be uploaded, this was something I simply presumed and didn’t actually check. I had seen the options to display a random header but hadn’t actually tried it… or read everything for that matter… 😉
There aren’t any uploaders. If you do upload a custom banner it is set as the banner for all pages.
The work around was quite easy, if you can follow PHP code of course.
First, create the banners you want to have on the blog, at appropriate sizes of course (defaults are 1000 × 288 pixels for the banners on the Twenty Eleven Theme out of the box). Then, your thumbnails (230×66 pixles, less important as it’s for the admin panel)…. then go into the theme’s image folder (unless you want to change those settings, but we won’t get into that here). Theme folder should be in:
Upload your banners and thumbnail images.
Once that is there, you must open the theme’s functions.php file (in twentyeleven’s root folder). In there, find the register_default_headers() function. You’ll want to configure your custom banners in the arrays as such:
register_default_headers( array( 'every-man-lives' => array( 'url' => '%s/images/headers/first-banner.jpg', 'thumbnail_url' => '%s/images/headers/first-banner-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Banner 1', 'twentyeleven' ) ), 'love-dies' => array( 'url' => '%s/images/headers/second-banner.jpg', 'thumbnail_url' => '%s/images/headers/second-banner-thumbnail.jpg', /* translators: header image description */ 'description' => __( 'Banner 2', 'twentyeleven' ) ) ) );
Once you’ve registered the new banners, refresh the admin panel Header or Custom Header page and check out the public site.
Was nice and simple.
Today, I started backing up a Magento based site that will be moved in coming days. I did a bit of reading around to try to get a feel for what kind of an endeavor this would become.
The process of backing up the database and all web files were quite straight forward (as they should have been).
I decided to attempt the get this version of Magento running on my local dev box using MAMP before setting it on the newer server and repointing the DNS entries. So I imported the database and transfered all Magento files into the web directory.
Following some instructions found in the Magento forums, I modified the /app/etc/local.xml file with the new database settings in my MAMP install.
Then, I changed 2 rows in the core_config_data tables. (more…)
At first when I looked into using Kohana I was quite happy and comfortable to use it. As a matter of fact, I still am.
Routing was one thing that I had some trouble with.
Now I don’t know if it was because when I read through some of the articles online and/or forum posts that my mind was hazy with coffee… could be.
Recently I was once again into some code that had been worked on for a project using Kohana v3. And at once the issue of routes had come to mind….. I had always thought about making some kind of “catch all” to avoid errors and such for missing controllers…etc.
But while reading a bit (with a fresh cup of coffee I might add) it just struck me in a different way. I don’t know why I didn’t seem to understand it before…. but I now understood that I could set up various routes allowing access to controllers and also using a “catch all” of sorts. And the way Kohana uses it’s modules, I could create an init.php file inside each module directory to define the routes instead of messing with the bootstrap.php file.
I’m very thankful for the internet. Actually, if it weren’t for the very existence of the internet… I suppose I wouldn’t encounter half the challenges and problems that I do…. in code of course.
I come from a Web development background and for the better part of the last 9 years I’ve spent countless hours reading through ColdFusion code (mostly). In 2010 so far, almost every job I’ve done has involved PHP in some form or another. If it was adding a feature to a previously coded site.. or building a site from scratch (it was direct requirements!)…. this year it’s been PHP.
I’ve been learning in 2010. On many levels actually.
So here I am reading through drupal code, learning how things are organized and where methods are calling other methods… still getting familiar with reading the code. I programmed a plugin for a Drupal module and everything was going well. Then after adding some processing to a form with file upload I had a problem. After submitting the form, it was a blank screen.
I was putting a site on a production server today and found some very strange errors. At least, I thought they were a bit strange.
The Server is Windows 2003 and IIS6. This is a leased server… leased by a small business I sometimes do work for.
At the end of 2009 I really wasn’t sure what direction I was going in anymore.
Being primarily self-employed for the previous year and a half and a total of 4 years of the last 6 I was feeling burnt out.
I had begun to consider looking for full time employment but had found that the opportunities were few and far between for “the job” that I would have liked to land.
You see, for the last 9 years I’ve worked primarily with ColdFusion. Working with ColdFusion has always been a joy and it continues to be my first love.
But unfortunately the job opportunities weren’t plentyful.
So what does a guy do??