Advertisement:

Author Topic: Category icons for Bender theme  (Read 16999 times)

cus

  • Full Member
  • ***
  • Posts: 139
Category icons for Bender theme
« on: June 11, 2013, 07:36:41 pm »
Does anyone know the code to add catergory icons on bender theme main page? 

Thanks,
Tim
www.canadausedsports.com
www.schlepmobile.com

cus

  • Full Member
  • ***
  • Posts: 139
Re: Category icons for Bender theme
« Reply #1 on: June 12, 2013, 09:45:24 pm »
Anyone??

Thanks

jromero

  • Newbie
  • *
  • Posts: 17
Re: Category icons for Bender theme
« Reply #2 on: June 13, 2013, 01:53:58 am »
Hi,

I am interested in this too. Hope someone can help us. Check my site walalia.com

Regards

ugogo.info

  • Sr. Member
  • ****
  • Posts: 369
  • I just let my mind wander, and it didn’t come back
Re: Category icons for Bender theme
« Reply #3 on: June 19, 2013, 11:33:51 pm »
I'm interested in this also.

AVBestDeals

  • Full Member
  • ***
  • Posts: 121
Re: Category icons for Bender theme
« Reply #4 on: August 16, 2013, 08:35:18 am »
Has anyone gotten this to work with the 3.2 Bender Template yet?
Is so could you please share this with the forum members!

Thanks

AVBestDeals

s51

  • Sr. Member
  • ****
  • Posts: 309
Re: Category icons for Bender theme
« Reply #5 on: August 16, 2013, 11:55:16 pm »

.

Hi: Cus & jromero & ugogo & AVBestDeals,  -  and all other OSClass friends . . .



1.)

New subdirs like this.: ../oc-content/themes/bender/s51extra/maincategoryicons
* Create x1 eXtra sub dir  =  s51extra
* and x1 more under s51extra  =  maincategoryicons
- -

2.)

* Now create a number of PNG files, - visual corresponding to your categories,
width 140px height 60px and save them as.: Png24 interlaced transperent
and name each PNG24 file ..exactly.. as your category names.
(only a example.: Categori= For sale = For sale.png)
- -

3.)

* Now open.: functions.php :. under Bender theme
and find this piece of code
<h1><a class="category <?php echo osc_category_slug() ; ?>" href="<?php echo osc_search_category_url() ; ?>"><?php echo osc_category_name() ; ?></a> <span>(<?php echo osc_category_total_items() ; ?>)</span></h1>
(remember to close it with comments <!--  -->
- -


4.)
* Then replace it with this:
<!-- YourName START eXtra code insert of main category Png icons -->
<h1><a class="category <?php echo osc_category_slug() ; ?>" href="<?php echo osc_search_category_url() ; ?>"> <img src="<?php echo osc_current_web_theme_url('s51extra/maincategoryicons/') . osc_category_name() .'.png' ?>" width="140px" height="60px" alt="" title=""/></a> <span><strong>(<?php echo osc_category_total_items() ; ?>)</strong></span></h1>
<!--  YourName STOP eXtra code insert of main category Png icons -->
- -

5.)
And 1-2-Pronto you have images on your main categories  ;D

(NOTE: I have ..not.. tested it with sub categories in several levels)
- -




Best Regards.:/ s51
.


AVBestDeals

  • Full Member
  • ***
  • Posts: 121
Re: Category icons for Bender theme
« Reply #6 on: August 17, 2013, 02:44:53 am »
Hi s51

First let me say thank you for the post and code, your code worked great!

The only thing that did not work was that your code replace the Categories name with the images
and I wanted to have the Images and the Categoies Labele names below the images so i make some changes to your code

NEW Code with Categories Images and Categories Label Names below the images (I also change the subfolder name s51extra = icons in the new code)

Code: [Select]
<!-- <h1><strong><span class="category <?php echo osc_category_slug() ; ?>"></span><a href="<?php echo osc_search_category_url() ; ?>"><?php echo osc_category_name() ; ?></a> <span>(<?php echo osc_category_total_items() ; ?>)</span></strong></h1> -->

<!-- START code insert of main category Png icons -->
<h1><a class="category <?php echo osc_category_slug() ; ?>" href="<?php echo osc_search_category_url() ; ?>"><img src="<?php echo osc_current_web_theme_url('icons/maincategoryicons/') . osc_category_name() .'.png' ?>" width="50px" height="50px" alt="" title=""/></a>

<br /><strong><span class="category <?php echo osc_category_slug() ; ?>"></span><a href="<?php echo osc_search_category_url() ; ?>"><?php echo osc_category_name() ; ?></a> (<?php echo osc_category_total_items() ; ?>)</span></strong></h1>
<!-- END code insert of main category Png icons -->

Thanks for the help and support!

AVBestDeals
« Last Edit: August 17, 2013, 02:57:42 am by AVBestDeals »

cus

  • Full Member
  • ***
  • Posts: 139
Re: Category icons for Bender theme
« Reply #7 on: August 17, 2013, 02:50:32 am »
Very cool.   Works great. 

Thanks again!

s51

  • Sr. Member
  • ****
  • Posts: 309
Re: Category icons for Bender theme
« Reply #8 on: August 17, 2013, 02:38:16 pm »

.
Hi  AVBestDeals, and other friends . . .

1.)

>>The only thing that did not work was that your code replace the Categories name with the image
Yes,,, I just forgot to put the other out (two variations) - but this you manage self :)
- -

2.)

Why I normaly use the version I put out, - is because I seemed we get a double effect,
using both category image, - and category text (see my jpg test example)
- -


And you're all welcome, and have a nice day

Best Regards.:/ s51
.


AVBestDeals

  • Full Member
  • ***
  • Posts: 121
Re: Category icons for Bender theme
« Reply #9 on: August 17, 2013, 07:33:36 pm »
Thank you s51

AVBestDeals

shamim_biplob

  • Full Member
  • ***
  • Posts: 169
Re: Category icons for Bender theme
« Reply #10 on: August 31, 2013, 08:35:25 pm »
Hi s51

First let me say thank you for the post and code, your code worked great!

The only thing that did not work was that your code replace the Categories name with the images
and I wanted to have the Images and the Categoies Labele names below the images so i make some changes to your code

NEW Code with Categories Images and Categories Label Names below the images (I also change the subfolder name s51extra = icons in the new code)

Code: [Select]
<!-- <h1><strong><span class="category <?php echo osc_category_slug() ; ?>"></span><a href="<?php echo osc_search_category_url() ; ?>"><?php echo osc_category_name() ; ?></a> <span>(<?php echo osc_category_total_items() ; ?>)</span></strong></h1> -->

<!-- START code insert of main category Png icons -->
<h1><a class="category <?php echo osc_category_slug() ; ?>" href="<?php echo osc_search_category_url() ; ?>"><img src="<?php echo osc_current_web_theme_url('icons/maincategoryicons/') . osc_category_name() .'.png' ?>" width="50px" height="50px" alt="" title=""/></a>

<br /><strong><span class="category <?php echo osc_category_slug() ; ?>"></span><a href="<?php echo osc_search_category_url() ; ?>"><?php echo osc_category_name() ; ?></a> (<?php echo osc_category_total_items() ; ?>)</span></strong></h1>
<!-- END code insert of main category Png icons -->

Thanks for the help and support!

AVBestDeals


It is working nice in local server but when i try in live server i dont kno why icons are not showing.

please help me if can

emakarskacom

  • Newbie
  • *
  • Posts: 2
Re: Category icons for Bender theme
« Reply #11 on: September 15, 2013, 08:50:56 pm »
Thank you for the post and code, your code worked great!

Now I have problem with mobile version, now my mobile site is disgusting.

How to embellish mobile version?

emakarskacom

  • Newbie
  • *
  • Posts: 2
Re: Category icons for Bender theme
« Reply #12 on: September 15, 2013, 08:52:25 pm »
Thank you for the post and code, your code worked great!

Now I have problem with mobile version, now my mobile site is disgusting.

How to embellish mobile version?

raess

  • Full Member
  • ***
  • Posts: 240
Re: Category icons for Bender theme
« Reply #13 on: September 27, 2013, 01:54:25 am »
This also work on Minimalist  theme with some mods. :)

in main.php replace this:
Code: [Select]
<h1><strong><a class="category cat_<?php echo osc_category_id(); ?>" href="<?php echo osc_search_category_url(); ?>"><?php echo osc_category_name(); ?></a> <?php echo clb_minimalist_format_category_ad_count(); ?></strong></h1>
With this:
Code: [Select]
<h1><strong><a class="category cat_<?php echo osc_category_id(); ?>" href="<?php echo osc_search_category_url(); ?>"> <img src="<?php echo osc_current_web_theme_url('s51extra/maincategoryicons/') . osc_category_name() .'.png' ?>" width="20px" height="20px" alt="" title=""/><?php echo osc_category_name(); ?></a> <?php echo clb_minimalist_format_category_ad_count(); ?></strong></h1>


design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Re: Category icons for Bender theme
« Reply #14 on: September 30, 2013, 07:18:32 pm »
Edited to add: follow directions with image size, and file save to work in all browsers!

the code has been adjusted to be accessibility compliant. make sure to keep it in h1 tags using <br /> for spacing  & in main.css if you don't want the images to show in responsive add .r-list li img display:none; @media (xxx)

Code: [Select]
<div class="category"><img src="<?php echo osc_current_web_theme_url('images/') . osc_category_name() .'.png' ?>"  width="140px" height="60px" alt="<?php echo osc_category_name() ; ?>" title="<?php echo osc_category_name() ; ?>"/></div>
previous error:  I actually believe this is a simple fix but it must be a snake  :-\ . I put the full image url pathway in the browser and I go to the broken image-not a 404! but no image!! (yes it's loaded, tripled check)
« Last Edit: September 30, 2013, 08:14:00 pm by design »