Widget titles – from text to image?
-
So after chasing after a couple of different suggested ways of doing this, I am more confused than ever. I finally got a tip from Esmi on how to make both my sidebars dynamic (Woo! and thank you!), have gotten everything customized the way I want it – and then realize that the font I want to use (Stylistic SF) will not actually display for a good number of people. :::bangs head on desk:::
My solution, of course, is to use an image instead of a font. Easy, right?
Not if you’re using widgets, it’s not. :::sighs::: Add to that the fact that there seem to be a whole lot of opinions on HOW to accomplish this, and most of them are geared towards much older versions of WP and/or do not relate to my existing theme’s coding.
Or else I’m just a doofus, which I freely admit is the most likely possibility.
So to sum up – instead of having the titles (Archives, Blogroll, Categories, etc.) of my widgets be text that is font-defined by the CSS, I want to use actual images for each widget I decide to use. Ones where the words are part of the image, not imposed on a background image by the CSS.
I’m completely lost on how to accomplish this, and I think my eyes are crossing… I’m seeing CSS and php when I close my eyes.
Potentially relevant file content –
Function:
<?php if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => 'Sidebar Left', 'before_widget' => '', 'after_widget' => '', 'before_title' => '<h3>', 'after_title' => '</h3>', )); register_sidebar(array( 'name' => 'Sidebar Right', 'before_widget' => '', 'after_widget' => '', 'before_title' => '<h3>', 'after_title' => '</h3>', )); ?>
Sidebar:
<!-- Sidebar --> <div class="sidebar"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar Left') ) : ?> <?php endif; ?> </div> <!-- Sidebar -->
Footer (because my right sidebar is here):
<!-- Sidebar --> <div class="sidebar2"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar Right') ) : ?> <?php endif; ?> </div> <div class="clear"></div> <!-- /Main --> <!-- Footer --> <div id="footer"> <!-- Copyright --> <div id="copyright"> <br />(c)Copyrighted Blah Blah Blah, All Rights Reserved.<br /> </div> <!-- /Copyright --> </div> <!-- Footer --> </div> <!-- /Page --> </body> </html>
And last but not least, my CSS (which would not define for my newly dynamic right sidebar until I put the definitions in the /*Footer*/ which might be a tip that helps someone else on that score):
/* General */ body { margin: 0; background: url("images/bg.png"); } h1, h2, h3, h4 { margin: 0; } img { border: 0; } .clear { clear: both; height: 1px; overflow: hidden; } /* Page */ #page { margin: 0 auto; width: 1004px; } /* Header */ #header { width: 1004px; height: 400px; background: url("images/header.jpg") no-repeat; position: relative; } /* Header - Info */ #header #header-info { position: absolute; top: 70px; left: 350px; } #header #header-info h1 { color: #ffffff; font: bold 30px "Stylistic SF Bold", Comic Sans MS; } #header #header-info h1 a { color: #ffffff; text-decoration: none; } #header #header-info .description { color: #ffffff; font: bold 15px "Trebuchet MS", Verdana; } /* Header - Menu */ #header #header-menu { position: absolute; top: 70px; left: 26px; height: 53px; } #header #header-menu ul { margin: 0; padding: 0; list-style-type: none; height: 53px; } #header #header-menu ul li { float: right; height: 53px; margin-right: 8px; font: bold 10px/43px "Verdana", Verdana; color: #ffffff; text-transform: lowercase; background: url("images/header_menu_left.gif") no-repeat; } #header #header-menu ul li a { color: #ffffff; text-decoration: none; padding: 0 40px; background: url("images/header_menu_right.gif") no-repeat right top; display: block; } #header #header-menu ul li a:hover { text-decoration: underline; } #header #header-menu ul li ul { display: none; } /* Header - Topbar */ #header #topbar { position: absolute; top: 225px; left: 0px; width: 1004px; height: 201px; color: #000000; font: normal 12px "Trebuchet MS", Verdana; } #header #topbar h3 { font: bold 15px "Verdana", Verdana; color: #000000; } #header #topbar ul { margin: 0; padding: 0; list-style-type: none; } #header #topbar ul li { padding-top: 12px; color: #ffffff; font: normal 12px "Trebuchet MS", Verdana; } #header #topbar ul li a { color: #ffffff; text-decoration: none; } #header #topbar ul li a:hover { text-decoration: underline; } /* Header - Topbar - Boxes */ #header #topbar #topbar-left { width: 285px; padding: 35px 33px; float: left; } #header #topbar #topbar-center { width: 306px; float: left; padding: 12px 0 0 30px; } #header #topbar #topbar-right { width: 287px; float: left; padding: 12px 0 0 30px; } /* Main */ #main { width: 1004px; background: url("images/main_1.gif") repeat-y; } #main-top { width: 1004px; background: url("images/main_top.gif") no-repeat; } #main-bottom { width: 992px; padding-left: 12px; min-height: 50px; background: url("images/main_bottom.gif") no-repeat left bottom; } /* Main - Content */ #content { float: left; width: 570px; padding: 6px 16px 0 16px; } /* Main - Content - Post */ #content .post { color: #FFFFFF; float: left; margin-bottom: 16px; width: 554px; padding: 7px; background: #191D27; } /* Post - Title */ #content .post .post-title { width: 554px; height: 51px; color: #FFFFFF; font: bold 12px "Trebuchet MS", Verdana; } #content .post .post-title a { color: #FFFFFF; text-decoration: none; } #content .post .post-title a:hover { text-decoration: underline; } #content .post .post-title .post-date { float: left; background: url("images/post_date.gif") no-repeat; width: 60px; height: 51px; color: #0D2845; text-align: center; text-transform: uppercase; margin-right: 10px; font: bold 10px/15px "Trebuchet MS", Verdana; } #content .post .post-title .post-date span { margin-bottom: 2px; display: block; font: bold 16px/34px "Trebuchet MS", Verdana; } #content .post .post-title h2 { padding: 4px 0 3px 0; color: #FFFFFF; font: bold 19px "Verdana", Verdana; } #content .post .post-title h2 a { color: #FFFFFF; text-decoration: none; } #content .post .post-title h2 a:hover { text-decoration: underline; } /* Post - Entry */ #content .post .post-entry { font: normal 12px/18px "Trebuchet MS", Verdana; color: #FFFFFF; padding: 0 4px; width: 546px; } #content .post .post-entry a { color: #FFFFFF; text-decoration: none; } #content .post .post-entry a:hover { text-decoration: underline; } #content .post .post-entry .more-link { font: bold 12px/20px "Trebuchet MS", Verdana; color: #FFFFFF; float: right; padding-bottom: 5px; } #content .post .post-entry .more-link a { color: #FFFFFF; text-decoration: none; } #content .post .post-entry .more-link a:hover { text-decoration: underline; } /* Post - Info */ #content .post .post-info { padding: 10px 4px 0 4px; width: 546px; clear: both; font: bold 12px "Trebuchet MS", Verdana; color: #FFFFFF; } #content .post .post-info a { color: #FFFFFF; text-decoration: none; } #content .post .post-info a:hover { text-decoration: underline; } /* Post - Comments */ #content .post h3 { color: #FFFFFF; font: bold 17px "Verdana", Verdana; margin: 25px 0 5px 0; padding: 0 4px; width: 546px; } #content .post .comments { padding: 0 4px; width: 546px; font: normal 12px/18px "Trebuchet MS", Verdana; color: #FFFFFF; } #content .post .comments a { color: #FFFFFF; text-decoration: none; } #content .post .comments a:hover { text-decoration: underline; } #content .post .comments ol { margin: 10px 0 10px 0; padding-left: 25px; } #content .post .comments ol li { padding: 5px; } #content .post .comments ol li.alt { background: #000000; } #content .post .comments ol li cite { color: #FFFFFF; font-style: normal; font-weight: bold; } #content .post .comments ol li cite a { color: #FFFFFF; text-decoration: none; } #content .post .comments ol li cite a:hover { text-decoration: underline; } #content .post .comments ol li .commentmetadata a { color: #FFFFFF; text-decoration: none; } #content .post .comments ol li .commentmetadata a:hover { text-decoration: underline; } #content .post #commentform { margin: 0; font: normal 12px/18px "Trebuchet MS", Verdana; color: #FFFFFF; padding: 0 4px; width: 546px; } #content .post #commentform a { color: #FFFFFF; text-decoration: none; } #content .post #commentform a:hover { text-decoration: underline; } /* Main - Content - Navigation */ #content .navigation { font: bold 12px "Trebuchet MS", Verdana; color: #ffffff; width: 495px; height: 25px; float: left; margin-bottom: 25px; } #content .navigation a { color: #ffffff; text-decoration: none; } #content .navigation a:hover { text-decoration: underline; } #content .navigation .navigation-previous { float: left; } #content .navigation .navigation-next { float: right; } /* Main - Sidebar */ .sidebar { float: left; width: 189px; font: strong 12px/18px "Stylistic SF Bold", Comic Sans MS; color: #ffffff; padding: 28px 0; } .sidebar a { color: #8E0000; text-decoration: none; } .sidebar a:hover { text-decoration: underline; } /* Sidebar - Titles */ .sidebar h3 { padding-left: 20px; font: bold 22px "Stylistic SF Bold", Comic Sans MS; text-transform: lowercase; color: #ffffff; height: 46px; width: 189px; background: url("images/sidebar_title.gif") no-repeat; } /* Sidebar - Menus */ .sidebar ul { margin: 0 0 20px 18px; padding: 0; list-style-type: none; } .sidebar ul li { color: #ffffff; font: normal 12px/26px "Trebuchet MS", Verdana; } .sidebar ul li a { color: #ffffff; text-decoration: none; } .sidebar ul li a:hover { text-decoration: underline; } /* Sidebar - Forms */ .sidebar #searchform { margin: 0 auto; padding: 15px 0 25px 0; width: 145px; text-align: center; } .sidebar #searchform #s { width: 145px; } /* Sidebar - Tables */ .sidebar #calendar_wrap { margin: 5px auto 20px auto; width: 120px; } .sidebar #calendar_wrap caption { font-weight: bold; } .sidebar #calendar_wrap #today { font-weight: bold; } /* Sidebar - Texts */ .sidebar2 .textwidget { padding: 0 10px 20px 10px; } /* Footer */ /* Main - Sidebar2 */ .sidebar2 { float: left; width: 189px; font: strong 12px/18px "Stylistic SF Bold", Comic Sans MS; color: #ffffff; padding: 7px 0; } .sidebar2 a { color: #8E0000; text-decoration: none; } .sidebar2 a:hover { text-decoration: underline; } /* Sidebar2 - Titles */ .sidebar2 h3 { padding-left: 20px; font: bold 22px "Stylistic SF Bold", Comic Sans MS; text-transform: lowercase; color: #ffffff; height: 46px; width: 189px; background: url("images/sidebar_title.gif") no-repeat; } /* Sidebar2 - Menus */ .sidebar2 ul { margin: 0 0 20px 18px; padding: 0; list-style-type: none; } .sidebar2 ul li { color: #ffffff; font: normal 12px/26px "Trebuchet MS", Verdana; } .sidebar2 ul li a { color: #ffffff; text-decoration: none; } .sidebar2 ul li a:hover { text-decoration: underline; } /* Sidebar2 - Forms */ .sidebar2 #searchform { margin: 0 auto; padding: 15px 0 25px 0; width: 145px; text-align: center; } .sidebar2 #searchform #s { width: 145px; } /* Sidebar2 - Tables */ .sidebar2 #calendar_wrap { margin: 5px auto 20px auto; width: 120px; } .sidebar2 #calendar_wrap caption { font-weight: bold; } .sidebar2 #calendar_wrap #today { font-weight: bold; } /* Sidebar2 - Texts */ .sidebar2 .textwidget { padding: 0 10px 20px 10px; } #footer { margin-top: 45px; width: 1004px; height: 62px; position: relative; color: #FFFFFF; font: normal 10px/15px "Trebuchet MS", Verdana; text-align: center; } #footer a { color: #CCCCCC; text-decoration: none; } #footer a:hover { text-decoration: underline; }
Please understand that I have tried to follow the (exceptionally brief and apparently assumptive of higher skills than I have) suggestions I’ve managed to find through searching strings such as “widget title image” and the like – but I have not been able to accomplish my goal. So if anyone is willing to take a shot at this, please assume I have the coding skills of a 90 year old grandmother who thinks the internet is something you use to hold your intestines inside your body – because after repeated failures and realizing I’m blind to the obvious (thank you again, Esmi), that is PRECISELY how I would define my skill level tonight.
Thanks for any ideas you can offer, and so help me if I find out there is a plug-in that would make simple work of this (which I also haven’t found), I’m going to need one of those internets to keep myself from losing my lunch in shame.
- The topic ‘Widget titles – from text to image?’ is closed to new replies.