365 Stories

flowing with the tides of life in 2010, an online journal
Browsing SELF-HELP

Custom sidebar blues finally dispelled

August8

For close to 3 months, I’ve been agonizing about creating custom sidebars for specific pages on the Diliman Prep website.

After long hours of searching for similar situations, diverted attention to the inspiring design pages of Smashing Magazine, passing through the learning curve of self-taught on-the-job training for basic php coding, too many sleepless nights and several dreams of solutions, I finally did it.

All the blogs and documents I was able to refer to tackled my concern in portions, perhaps because they too were writing only about their own concerns. Fact is, all of them were IT developers, while I have been introduced to php only when I decided to change certain portions of the wordpress themes I was using for my websites. I wish I can link to those sites that helped me understand the process, and will do so when I run across them again.

I desperately need to document the process that lead to the solution, if only so I could easily refer to this blog again whenever I wish to create custom sidebars to this blog site (which obviously needs the work) and to the other sites I will be creating.

Now if a reader finds this record useful for the php novice, that will be an exceptional bonus.

Creating Custom Sidebars in WordPress

Objective: Create custom right sidebars for different departments and concerns featured on the website. The left sidebar and the horizontal menu on top will be retained for overall site navigation.

Rationale: The same sidebar for all pages will eventually make the eye go blind on the items, notices, lists, that are on that sidebar, so that even if the items are quite important for the school to share, the reader will not consider it as such. He becomes blind to the item, unless it’s a list that need to be referred to every so often, like a category list or a topic list. But fixed images, and ads tend to be disregarded by the eye.

Also, the school also has myriad details that could be useful to the reader of certain pages, but these information would otherwise be hidden under and behind other material on the side. For example, readers interested in the Athletics Department would more likely be interested on who the coaches are and how to contact them directly. If this information was on the custom sidebar, the site is able to immediate meet the need of the reader.

Step 1: REGISTER new widgetizable sidebars  in the functions.php  file of the theme

Since my theme already has two functioning sidebars, the functions.php file has already been automatically created by WordPress. Here’s how my functions.php file looked like without the additional custom sidebars.

<?php
if(function_exists(‘register_sidebar’)) {

register_sidebar(array(
‘name’ => __(‘Left Sidebar‘),
‘before_widget’ => ‘<div id=”%1$s”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h3>’,
‘after_title’ => ‘</h3>’
));

register_sidebar(array(
‘name’ => __(‘Right Sidebar‘),
‘before_widget’ => ‘<div id=”%1$s”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h3>’,
‘after_title’ => ‘</h3>’
));

} ?>

I then registered an additional sidebar that I indent to use for the pages on the Athletics Department. The number 3 in the ‘Athletics 3′ is my reference to the actual number of the sidebar, which I will need later. I actually have a total of 15 custom sidebars. (The left sidebar is number 1. The main right sidebar is number 2.)

register_sidebar(array(
‘name’ => __(‘Athletics 3‘),
‘before_widget’ => ‘<div id=”%1$s”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h2>’,
‘after_title’ => ‘</h2>’
));

On the Appearance Widgets menu, I can now see the third sidebar named Athletics 3.

Step 2: Create a duplicate copy of the right_sidebar.php and a designate name that can easily be associated with the new sidebar.

I named my new custom sidebar right_sidebar-athletics.php and made sure that the call to the sidebar would refer to the custom sidebar for Athletics that I just made. Here is where the number 3 in the sidebar name becomes convenient.

<?php if (function_exists(‘dynamic_sidebar’) && dynamic_sidebar(3)) {  } ?>

[I was able to make the file copies using my freely downloaded copy of FileZilla, by selecting a file on my live server, right click Open/Edit. I changed the sidebar number to (3) and saved it with a new filename as above.]

Step 3: Edit the call for the new sidebar in the appropriate theme template file.

In my case, I opened the page.php file because I wanted to reflect custom sidebars on specific pages, to give the instruction to use the right_sidebar-athletics.php file in place of the standard right sidebar whenever the the active page is that of Athletics. The page ID for the Athletics page is 513, so I entered that in the call code.

<?php
if  (is_page(’513′))  {
include(TEMPLATEPATH . ‘/right_sidebar-athletics.php‘);
} else {
get_sidebar();
}
?>

Step 4: Add content to the custom sidebar.

Finally, on the Appearance Widgets menu, I opened the new sidebar that I named Athletics 3, and added my own html text and widgets (could be anything you want).

Then I shifted back to the window/tab of the website and clicked on the link to the Athletics page. YES, FINALLY, IT’S DONE. I had the new custom right sidebar up for the Athletics pagee, and retained the original right bar for all the other pages.

Within 15 minutes, I had gone through the whole process for 14 other website sections with pages that would benefit from custom sidebars.

But though I had finally solved the mystery of the custom right sidebar, the same did not work for the subpages.

Step 5: Generate a new conditional tag to check for subpages and apply the appropriate custom right sidebar.

I had seen the instructions for this the first time I searched the net, but could not make them work because the first 4 steps above were not yet in place. Now was the time to do so.  The solution turned out to be quite easy after the months of understanding php on my own.

I added a new function in the functions.php file to enable WordPress to check and identify the subpages.

function is_tree($pid) {      // $pid = The ID of the parent page
global $post;         // load details about this page
$anc = get_post_ancestors( $post->ID );
foreach($anc as $ancestor) {
if(is_page() && $ancestor == $pid) {
return true;
}
}
if(is_page()&&(is_page($pid)))
return true;   // we’re at the page or its subpage
else
return false;  // we’re elsewhere
};

“Add Snippet 4 to your functions.php file, and call is_tree('id') to see if the current page is the page, or is a sub page of the page. In Snippet 3, is_tree('2') would replace “is_page('about') || $post->post_parent == '2'” inside the first if tag.”   Refer to Snippet 4 in WordPress Codex on Conditional Tags.

And I replaced the conditional tag

<?php
if  (is_page(’513′))  {
include(TEMPLATEPATH . ‘/right_sidebar-athletics.php’);
} else {
get_sidebar();
}
?>

to this call in the pages.php file

<?php
if  (is_tree(’513′))  {
include(TEMPLATEPATH . ‘/right_sidebar-athletics.php’);
} else {
get_sidebar();
}
?>

After confirming that the codes resulted in the effect I wanted, I adjusted all the calls for the custom sidebars for the other web sections.

P.S.

I could actually have solved this problem much earlier, if only I had changed some of my work habits.  I finally realized that I had spent the worst hours of my day–when I was practically tired and ready to sleep– to study the possible solutions to custom sidebars. I had not given it the due attention during my more productive hours, thinking that I could extend my prime time to the hilt.

Sometime, the other night, I resolved to attend to the task at last 3 hours earlier than usual. Within an hour-and-a-half, I had solve the problem. Twas an exhilarating eureka-moment with the attendant heart-pounding and raised-arms as I refreshed the page and saw the new sidebar.

My next project: Using thumbnails of my posts photo in the excerpt on the Home page.

Lesson learned: Never overestimate my mental acuity when fatigue and sleepiness start to creep in. Sleep is necessary to revitalize the body and produce the new brain cells, that will enable me to challenge myself for the next project. Good night y’all.

Eat fruit the right way

April20

any of us think eating fruits means just buying fruits, cutting it, and just popping it into our mouths.  Well, it is not as simple as we think. It’s important to know how and when to eat fruit.

What is the correct way and time to each fruit?

NEVER eat fruits after your meals!

FRUITS SHOULD BE EATEN ON AN EMPTY STOMACH.

If you eat fruit this way, it will play a major role to detoxify your system, supplying you with a great deal of energy for weight loss and other life activities.

Fruit is the most important food.

Let’s say you eat a meal of two slices of bread and a sausage, and follow-through a slice of fruit. The slice of fruit is ready to go straight through the stomach into the intestines, but it is prevented from doing so.

In the meantime, the whole meal rots, ferments and turns into acid. The minute the fruit comes into contact with the stomach and digestive juices, the entire mass of food begins to spoil . . . and the fresh fruit with it.

So please eat your food on an empty stomach or before your meals.

You have heard of people complaining — “every time I eat watermelon I burp, when I eat durian my stomach bloats up, when I eat a banana I like running to the toilet”.

Actually, all these will not arise if you eat fruit on an empty stomach.  The fruit mixes wil the putrefying other food, and produces gas and hence you will bloat!

Graying hair, balding, nervous outburst, and dark circles under the eyes — all these will not happen if you eat your fruits on an empty stomach.

All fruits become alkaline in our body, whether they start off acidic or not before we eat them, according to Dr. Herbert Shelton.

If you have mastered the correct way of eating fruits, you have the secret of beauty,  longevity, health, energy, happiness and normal weight.

When you need to drink fruit juice, drink only fresh fruit juice, NOT the canned ones. Don’t even drink juice that has been heated up. Don’t eat cooked fruits because you don’t get the nutrients at all. You only get the taste. Cooking destroys all the vitamins.

But eating a fresh whole fruit is better than drinking the juice. If you should drink the juice, drink it mouthful by mouthful slowly, to let it mix with your saliva before swallowing it.

You can go on a 3-day fruit diet to cleanse your body. Just eat fruits and drink fruit juice through the 3 days, and you will be surprised when your friends tell you how radiant you look!

KIWI: Tiny but might. This is a good source of potassium, magnesium, vitamin E and fiber Its vitamin C content is twice that of an orange.

APPLE: An apple a day keeps the doctor away? Although an apple has low vitamin C content, it has antioxidants and favonoids which enhance the activity of vitamin C, thereby helping to lower the risks of colon cancer, heart attack & stroke.

STRAWBERRY: Protective fruit. Strawberries have the highest total antioxidant power among fruits and protect the body from cancer-causing, blood vessel-clogging free radicals.

ORANGE: The  sweetest medicine. Taking 2-4 oranges a day may help keep colds away, lower cholesterol, prevent and dissolve kidney stones as well as lessens the risk of colon cnaer.

WATERMELON: Coolest thirst-quencher. Composed of 92% water, it is also packed with a giant dose of  gluthatione, which helps boost your immune system.  They are also a key source of lycopene — the cancer-fighting oxidant. Other nutrients found in watermelon are Vitamin C & potassium.

GUAVA and PAPAYA: Top awards for Vitamin C. They are the clear winners for their high Vitamin C content. Guava is also rich in fiber, which helps prevent constipation. Papaya is rich in carotene, which is good for your eyes.

CHIA SEED: Though not a fruit, but  a seed, the chia seed is a whole raw food that’s been proven to provide the highest and most complete dietary needs of the human body than any other food on the planet. One simple has to add a tablespoon or two a day to any soup, beverage, salad, or dish to get omega-3, antioxidants, calcium, iron, selenium, phosphorus, protein, fiber, and so many other essential phytonutrients to regain one’s health and overall nutrition.

DRINKING COLD WATER after a meal = CANCER!

It feels so good to take a cold drink after a meal (especially during these hot and humid days). However the cold water will only solidify the oily stuff that you have just consumes. It will slow down digestion. Once this sludge reacts with the acid, it will break down and absorbed by the intestine faster than the solid food.  It will line the intestine. Very soon, this will turn into fats and lead to cancer.  It is best to drink hot soup or warm water after a meal.

A SERIOUS NOTE ON HEART ATTACKS

Many, but not all, heart attack patients experience pain in the left arm.  Be aware of intense pain in the jaw line. You may never have the first chest pain during the course of a heart attack. Nausea and intense sweating are also common symptoms.

Sixty percent of people who have a  heart attack while asleep, do not wake up. Pain in the jaw can wake you up from a sound sleep.

Geocities.com is now Reocities.com

April15

I’ve always loved surprises. Who doesn’t? Today’s most pleasant surprise reminds me of those sleepless nights, 14 years ago, when I created my very first website.

The Dance Addict’s Guide is still online. Once hosted on Geocities.com between October 1997 to October 2009, it can now be found (in static form) at Reocities.com.

Geocities.com had been the home of some 7,000,000 websites when entrepreneurs were just starting to discover the power of online promotions and marketing. Its basic html frames technology may be considered “jurassic” in the age of css, xhtml and php, but it was the best option for amateur interpreneurs to create presence online.  Geocities.com too was the forerunner of the social networking sites that proliferate these days, we had webrings for sites with similar categories, and helped bring visitors to each other.

Thus in spite of the tedious process of site creation, my 140-page website entitled The Dance Addict’s Guide had created a presence in the field of ballroom dancing in the Philippines.  In fact it was the first and primary dance site in the Philippines for a while, (until I was locked out of the back office for not updating my email address). And it continued to bring me a good number of inquiries and clients from all over the world.

In October 2009, years after Yahoo acquired Geocities.com,  site owners were informed of the site’s closure by October 26, 2009. We were all asked to backup our site and download full copies if we wanted to keep any of our pages and images. I frantically searched for a site download program and utilized Teleport, a simple program that can duplicate any website, and create a browseable copy offline saved on one’s computer.

I hadn’t known then that someone who had recognized the many gems and treasures found on the millions of geocities.com web pages, and the need  to record the “historical artifacts” of the internet and the world wide web, was also frantically trying to backup all the sites that Yahoo was about to obliterate.

Thus, I am truly grateful to David Feinman for allowing us to reminisce our “youth” on the net, and continue to keep our presence online, though simulating a museum of sorts. (I wonder why I had chosen the “Museum” neighborhood in geocities back then.) Read about David’s miraculous efforts at saving the dinosaurs relics on the net.

Hands-on at web design

I had decided back in 1997 to seriously consider a career in dance, again, in spite of my increasingly excited interest in promoting my passion online.  That was the problem. I had wanted to do too many things all at the same time, as if I had just been let out of a prison cell.

So to combine my two major interests in one project, I decided to create a website on dance. The main objective was to interest more Filipinos to get interested in social dancing, and thus promote my own dance teaching business.

The whole website was practically done from scratch except for the fact that I used the free hosting from Geocities.com (many of the amateur web entrepreneurs back then did too) and utilized its simplified web designer program to upload the pages, images and other files online.

I had found an external program that I can’t now remember, to create the actual web layout. I experimented with columns and frames, grabbed free graphics from sharing sites, created my own graphic icons for the navigation bar, and even utilized some minor scripts for a running marquee bar, a guestbook, and a few tricks.

Over the next 6 months, I labored every day (and night), created metatags and links to many other sites, uploaded pages as they were completed, and started to promote my baby all over the net. I guess most of the basics I have obtained about web design, web management, SEO came from those few focused months. I worked mainly with CorelDraw, MS Word, and a web design program that skips my mind now. Checking how each change and improvement in the lay and design of the site took so much time (compared to what we can do theses days), but all that hard work did pay off.

Pretty soon, so many sites were linking and linked back to The Dance Addict’s Guide, a comprehensive resource to ballroom dancing in the Philippines, hosted by Geocities, with web address http://www.geocities.com/Soho/Museum/6962/.  I continued to submit my site to various search engines, and even created nickname URLs from some free sites available back then for free.

I had also attracted fellow dancer teachers online, including several who have made truly expansive contributions to the dance world. We exchanged information, ideas, and even dance books (oh, did I mention I also have portions of my dance book Victoria’s Dance Secrets on my website). I even got offers to work and manage a dance studio in South Africa, Singapore, and Denmark. And I made friends with so many lovely souls from all over the world and the Philippines,generated tons of emails and inquiries for dance lessons, and acquired hundreds of clients who are all my friends still.

Unfortunately, I had inadvertently locked out of my own site’s back-office and couldn’t update the site  since October 1999. I had decided to change email addresses when I changed my ISP, and failed to inform Yahoo about it. Yet, for the ten years, I continued to receive hundreds of email and phone inquiries emanating from The Dance Addict’s Guide.

Where to from here?

So, now I know that my site is still up, I am quite relieved that I can refer my friends to the site again. Unfortunately, though, the metatags don’t seem to work as they used to. Looks like I will have to mirror the site, update some pages, make it interactive again, and promote it again online. Hope to find the time to do that soon.

Perhaps too, I should convert my dance book Victoria’s Dance Secrets (originally titled Secrets to Modern Ballroom Dancing) into an ebook or, as at least  3 of my writer friends have suggested, into a series of ebooks. The current one just has too much information. One friend insists I should finally get rich selling information that I’ve known for so long and improving so much on.  I know I will have to take this most valuable advise soon.

I can see Missy’s eyes again

April12

For several hours yesterday and today, Kim and I managed to trim Missy’s thick hair, and gave her a home-made puppy cut. We started with her face, but when she insisted on licking the scissors, we moved to start with her back. And when she wouldn’t stop switching positions, I took hold of one front paw, and started trimming the hair over her nails and between her fingers. After a little more than an hour of trimming and jumping from face, paw, belly, tail, back, and then again in another order, we decided to call it a day.

Missy looked so funny with longish hair on her two hind legs, but trimmed off her body and part of her face. So so funny, but still cute. At least we could see her eyes, and she could stare back at us without any hair blocking portions of the view.

This afternoon, Kim and I were decided to finish off the job in an hour. So we worked, alternating with a medium-size pair of scissors and baby nail scissors, with a comb. Nail clipping turned out to be the hardest part. We had to be very very very careful to trim millimeters at a time so we don’t cut any nerve endings.

Soon, Missy looked much like she did at 3 months, only slightly slimmer and taller.

Before the trim

Trivia:
We never realized that dogs have 5 fingers in the front paws, and 4 fingers at the back. Or is this Missy’s peculiar characteristic

I almost electrocuted myself last night

April1

With Gustav, our SUV, sleeping in an auto shop in Baguio, we set aside all out-of-town plans, and prepared for the two to three days of virtual seclusion at home. All the malls, markets, restaurants, and shops would be closed for Holy Thursday and Good Friday, so we had to purchase our supplies today. We also went into the hardware store to purchase an auto light, a replacement for dresser light box, and a few meters of rope LED lights for the kitchen.

I had the rope lights set up under the cabinets above the kitchen counter before dinner, running the stretch of lights through small hooks that I connected to the underside of the cabinets, and plugged the end into an empty outlet. I loved the effect that made my old kitchen look more modern and a little more brilliant. Lights are always a nice trick to perk up a room.

After dinner, I decided to cover my laptop with an almost transparent layer of window laminate, with a nice daisy design which gave the effect of embossed metal. Very chic and classy. Then I attended to the replacement of the light box over my dresser.

Because I had bought a different less expensive brand than the one that broke down in less than a year, I had to change the connector that was attached to the power cord. With my ever-reliable Exacto sliding knife, I cut the cord an inch above the connector.

I cut the cord halfway through, and a few seconds later, saw a small spark and heard a loud pop, as the cord jumped from my hand.

Uh oh. The power is still on. I instinctively looked at the outlet, and realized I had not unplugged the power cord.  So careless of me.

I castigated myself for not taking the precautions I normally take. I could smell burnt rubber. I unplugged the cord, looked at the burned end, and took a pair of scissors to cut another two inches off. Then I checked the inside of my hand. I was just starting to realize the emergency I could have gotten myself into. No burns, thank goodness. I looked at the Exacto blade and realized I had been saved by the thick plastic that covered the handled, and prevented me from touching the blade.  I know enough about electricity to understand that when the metal blade touched the two sets of tiny copper filaments in the cord, the electrical connection caused the spark and the pop. No one else in the house heard the pop, and no one know how close I had been to an accident.

I went about my night on Facebook, “liking” my friends’ posts, and sharing a few items, until Kim invited me to watch 500 Days of Summer.

Last night, I seemed to be in a trance, even as I sat in front of the TV with Kim, the laptop left open on Facebook.  For hours, I couldn’t understand why I kept receiving reactions to a note from Minnie when I couldn’t find my name as a recipient… until I realized I was indeed in the Facebook Notes list as “You”. I had forgotten Facebook’s style.

I posted on my wall:

“is watching 100 Days of Summer with Kim, and still wondering what the story is all about. Am confident I’ll eventually find out. Am so dense these days”

as my Facebook status. Friends reacted. “Funny”, and “it’s 500 Days of Summer”, not 100. hahaha

I reacted to myself and added another status post about how I was feeling

“floating just a few inches above earth simply floating in the wind, reminiscing with fondness, observing life like watching a movie, smiling at the pettiness of this life, lurking & liking FB friends’ posts . . .”

“I prefer this than having my feet on the ground, and my mind intact. hahahaha”.

I awoke in the morning, still feeling a bit whoozy and floating. As I washed the lunch dishes, I realized that I was actually floating above earth most of the night last night.

Perhaps, the “almost electrocution” accident propelled me into the inner worlds where life in more peaceful, where I can look at my situation from a distance, where I can actually be unfazed by situations.

Whatever and wherever I was last night, I now realize that I had felt nary a tinge of fear of death (yes, in a worse scenario, I could have been near death last night), instead I savored the relaxed peaceful feeling of nearness with my Creator, a feeling that I would welcome anytime.

« Older Entries

365 STORIES CAN BE VIEWED
FROM MOST MOBILE DEVICES.

Subscribe

DOWNLOADABLE E-BOOKS

BABIES CAN (and did!) READ

FIVE RITUALS: SECRET TO
THE FOUNTAIN OF YOUTH

RUN YOUR CAR ON WATER

INSIDER SECRETS TO CHEAP FLIGHTS

OFFICIAL SECRET RESTAURANT RECIPES

PANIC AWAY - END ANXIETY & PANIC ATTACKS

SECRETS TO DOG TRAINING (SIT.STAY.FETCH)

GUIDE TO CREATING SPA PRODUCTS

500 SCRAPBOOKING SKETCHES

THE DIET SOLUTION PROGRAM

Hi, I’m Vikky, and I’ve finally made a New Year’s resolution that’s exciting and motivating enough to follow-through and resolve to attain.  Read about it in my first post and Why 365 stories?. This blog is just what it says — 365 Stories — one story (or more) everyday for the 365 days of 2010.

Discover CHIA seed, the ancient survival food of the Aztecs

My Sulit Homepage


Sign up for PayPal and start accepting credit card payments instantly.

    Buy and Sell Philippines    

        WordPress Themes by WPZOOM

    Adzelerate    

Links

Advertise On This Blog

Freelance Jobs