Insert category icon
« on: December 11, 2023, 04:56:01 PM »

How can I integrate the code below into this code so that I finally have an icon in my categories?

Code: [Select]
<?php osc_goto_first_category(); ?>
<div id="home-cats">
  <h2><?php _e('All categories''sigma'); ?></h2>

  <div class="wrap">
     
    <?php while(osc_has_categories()) { ?>
     
      <a href="<?php echo osc_search_category_url(); ?>">
        <div class="icon" <?php if(osc_category_color() <> '') { ?>style="color:<?php echo osc_category_color(); ?>;"<?php ?>>
          <i class="<?php echo (osc_category_icon() <> '' osc_category_icon() : 'far fa-share-square'); ?>"></i>
        </div>
        <strong><?php echo osc_category_name(); ?></strong>
      </a>
     

    <?php ?>
  </div>
</div>



Code: [Select]
<?php if(get_category_icon(osc_category_id())) { ?>
                    <img src="<?php echo get_category_icon(osc_category_id()); ?>" /> <?php }


I'm already grateful for your help.

Kind regards, Roberto.

*

MB Themes

Re: Insert category icon
« Reply #1 on: December 11, 2023, 06:14:03 PM »
Category type depends on what you set in category settings.
Code in sigma theme is functional so not sure what you want to achieve.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

Re: Insert category icon
« Reply #2 on: December 19, 2023, 01:50:00 PM »
I just want each category to have its own symbol.

Re: Insert category icon
« Reply #3 on: December 27, 2023, 03:16:58 PM »
So I've changed that now. Now I have the problem that the font size and icon size cannot be changed in style.css for whatever reason.


Code: [Select]
<?php while(osc_has_categories()) { ?>
      <a href="<?php echo osc_search_category_url(); ?>">
          <div class="icon" <?php if(osc_category_color() <> '') { ?>style="color:<?php echo osc_category_color(); ?>;"<?php ?>>
      <i class="<?php if(get_category_icon(osc_category_id())) { ?>"></i>
              <img src="<?php echo get_category_icon(osc_category_id()); ?>"/>
              <?php }
                                       echo 
osc_category_name(); ?>

      </div></a>

Re: Insert category icon
« Reply #4 on: December 27, 2023, 05:43:38 PM »
main.php

So I solved the whole thing differently, for everyone who has the Sigma, here is the code that works best. Adapted directly and looks very good on mobile too.

Code: [Select]
<?php while(osc_has_categories()) { ?>
      <a href="<?php echo osc_search_category_url(); ?>">
          <div class="icon" <?php if(osc_category_color() <> '') { ?>style="color:<?php echo osc_category_color(); ?>;"<?php ?>>
      <i class="<?php if(get_category_icon(osc_category_id())) { ?>"></i>
              <img src="<?php echo get_category_icon(osc_category_id()); ?>"/>
             <font size="1"><?php }
                                       echo 
osc_category_name(); ?>
</font>
      </div> <style>
      img {
      width: 70px;
      height: 70px;
      }
    </style></a>


*

MB Themes

Re: Insert category icon
« Reply #5 on: December 30, 2023, 09:04:14 PM »
You probably use custom function get_category_icon
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots