I've installed a wordpress-based directory and am trying to style the sidebar widgets. The default style of all widgets in the sidebar is enclosed in a border with a title text and background. However, I wish to remove all these styling when I'm inserting an image in the widget.

To see what I mean, you can go to this website. On the right hand sidebar, the first image "Add Listing Here" is enclosed in a border. How do I remove the styling for this image?

Any suggestion? Many thanks in advance.

kohoutek
—
2012-04-04T08:44:12Z —
#2

To see which HTML elements are referenced via CSS, view the HTML document's source.

The element in question has a class of .itembox. Find that in your CSS and remove the border declaration.

affiliateTT
—
2012-04-04T09:03:33Z —
#3

Thanks kohoutek for the quick reply.

But if I remove the styleing for .itembox, it will remove everything. This is not I want, I just want to remove the border, title and background for the first widget at the sidebar.

I just realized one problem, using the :first-child will affect all the first widget of the sidebar but I only want to target one specific widget only.

Is there any way just to select the first widget at the sidebar of the homepage?

Appreciate your advice. Thank you.

kohoutek
—
2012-04-04T16:37:05Z —
#7

I don't know how your WordPress is set up, but here are three options:

1) Create a new widget without assigning it the .itembox class2) Modify the CSS with Paul's code and place that CSS directly in your index.php and then use a PHP conditional (ifis_home()) function to have this code only apply for the homepage3) Place the is_home() conditional function inside your functions.php

See the WordPress is_home() function page on how to use and implement it.

PaulOB
—
2012-04-04T16:38:33Z —
#8

You could just add a class to that specific image and then target it directly assuming you are able to adjust the html.

If not then the only chance is that you could use the id that is already on the body tag to target only the home page.

That assumes that the id is only present on the home page. Otherwise there is no way to target an element on one page only unless there is something in that page that is unique to that page and in the right context.

kohoutek
—
2012-04-04T16:45:55Z —
#9

Right, forgot about that option! It's probably the simplest one.

With Paul's code, you'd just need to place the conditional I mentioned above in your header.php inside your opening body tag.

affiliateTT
—
2012-04-05T13:14:56Z —
#10

Thanks all for the excellent suggestion!

I'm grateful for your time but first, I need to apologize because I realized the first widget at the sidebar also appear deeper in the category pages and logout page. In other word, I couldn't just target only the first widget at the homepage, it was wrong approach. In such case, what do you suggest? Or what is the best way to do this?

So sorry for the wrong information as I'm still trying to familiarize with this new directory theme.

Many thanks in advance again.

RyanReese
—
2012-04-05T14:22:55Z —
#11

I suggest identifying it via the class. I'm sure that widget has the same class or ID throughout all the pages you mentioned. Just style it via the class or ID and don't worry about being fancy with the first-child pseudo class :).

affiliateTT
—
2012-04-06T02:59:27Z —
#12

Thank you Ryan.

Could you kindly elaborate a little bit on how to assign a class to the widget? I know where is the child theme stylesheet and I can easily add the css code there but where and how do I assign the class to the widget? In a php file, which particular one should I add to?