Advertisement:

Author Topic: placing category horizontally [ SOLVED ]  (Read 1620 times)

rainilson

  • Newbie
  • *
  • Posts: 37
Re: placing category horizontally
« Reply #15 on: June 01, 2018, 05:05:43 pm »

dear friend, I really liked it that way too, how would you show me the way you did, over the blue background, and another blue background, please, how did you do it? explain to me how it was done, so I can learn, please

friend, I do not know how to post the file function.php, in case it is otherwise please tell me




WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: placing category horizontally
« Reply #16 on: June 01, 2018, 06:22:56 pm »
To make the categories horizontal, replace this:

Code: [Select]
<?php
if (!function_exists('bender_draw_categories_list')) {

    function 
bender_draw_categories_list() {
        
?>

                    <?php if (!osc_is_home_page()) {
                        echo 
'<div class="resp-wrapper">';
                    } 
?>

                   
<?php osc_current_web_theme_path('map.php') ; ?>
                    <?php
                    
//cell_3
                    
$total_categories osc_count_categories();
                    
$col1_max_cat ceil($total_categories 3);

                    
osc_goto_first_category();
                    
$i 0;

                    while (
osc_has_categories()) {
                        
?>

                            <?php
                            
if ($i $col1_max_cat == 0) {
                                if (
$i 0) {
                                    echo 
'</div>';
                                }
                                if (
$i == 0) {
                                    echo 
'<div class="cell_3 first_cel">';
                                } else {
                                    echo 
'<div class="cell_3">';
                                }
                            }
                            
?>

            <ul class="r-list">
                <li>
                    <h1>
                    <br>
<?php //added by me - category icon ?>
                        <?php if(get_category_icon(osc_category_id())) { ?>
                        <img src="<?php echo get_category_icon(osc_category_id()); ?>" />
                        <?php ?>
                    <?php //added by me - category icon ?>
                    <br/>
            <?php
            $_slug 
osc_category_slug();
            
$_url osc_search_category_url();
            
$_name osc_category_name();
            
$_total_items osc_category_total_items();
             {
                
?>

                            <span class="collapse resp-toogle"><i class="fa fa-caret-right fa-lg"></i></span>
            <?php ?>
            <?php if ($_total_items 0) { ?>
                            <a class="category <?php echo $_slug?>" href="<?php echo $_url?>"><?php echo $_name?></a> <span></span>
            <?php } else { ?>
                            <a class="category <?php echo $_slug?>" href="#"><?php echo $_name?></a> <span></span>
            <?php ?>
                    </h1>
            <?php if (osc_count_subcategories() > 0) { ?>
                        <ul>
                <?php while (osc_has_subcategories()) { ?>
                                <li>
                    <?php if (osc_category_total_items() > 0) { ?>
                                         <span></span>
                    <?php } else { ?>
                                        </a> <span></span>
                    <?php ?>
                                </li>
                <?php ?>
                        </ul>
            <?php ?>
                </li>
            </ul>
            <?php
            $i
++;
        }
        echo 
'</div>';
        
?>

        <?php if (!osc_is_home_page()) {
            echo 
'</div>';
        } 
?>

        <?php
    
}

}

With this:

Code: [Select]
<?php
if (!function_exists('bender_draw_categories_list')) {

    function 
bender_draw_categories_list($show_map 1) {
        if (!
osc_is_home_page()) {
            echo 
'<div class="resp-wrapper">';
        }
        
        if(
$show_map)
            
osc_current_web_theme_path('map.php') ;

        
osc_goto_first_category();
        
$i 0;
        
?>

        <div style="width: 100%;">
            <ul class="r-list" style="margin: 0 auto;">
                <?php
                
while (osc_has_categories()) {
                
?>

                   
                <li style="display: inline-block;">
                    <h1 style="margin: 5px;">
                        <?php //added by me - category icon ?>
                        <?php if(get_category_icon(osc_category_id())) { ?>
                        <img src="<?php echo get_category_icon(osc_category_id()); ?>" />
                        <?php ?>
                        <?php //added by me - category icon ?>
                        <br>
                        <?php
                        $_slug 
osc_category_slug();
                        
$_url osc_search_category_url();
                        
$_name osc_category_name();
                        
$_total_items osc_category_total_items();
                        if (
$_total_items 0) { ?>

                                        <a class="category <?php echo $_slug?>" href="<?php echo $_url?>"><?php echo $_name?></a> <span></span>
                        <?php } else { ?>
                                        <a class="category <?php echo $_slug?>" href="#"><?php echo $_name?></a> <span></span>
                        <?php ?>
                    </h1>
                </li>
                <?php ?>
            </ul>
            <?php
            $i
++;
        
?>

        </div>
        <?php if (!osc_is_home_page()) {
            echo 
'</div>';
        } 
?>

        <?php
    
}

}
?>


To add categories to the blue background, you would need to find this code in header.php

Code: [Select]
</div>
<?php osc_show_widgets('header'); ?>

and replace it with

Code: [Select]
<?php bender_draw_categories_list(0); ?>
</div>
<?php osc_show_widgets('header'); ?>

Hope it will work.

Regards.
« Last Edit: June 01, 2018, 06:25:36 pm by patrickFromCroatia »

rainilson

  • Newbie
  • *
  • Posts: 37
Re: placing category horizontally
« Reply #17 on: June 02, 2018, 12:23:07 am »
I will do the test and return, with the answer, thank you very much for your help, dear friend

rainilson

  • Newbie
  • *
  • Posts: 37
Re: placing category horizontally
« Reply #18 on: June 02, 2018, 01:11:50 am »
To make the categories horizontal, replace this:

Code: [Select]
<?php
if (!function_exists('bender_draw_categories_list')) {

    function 
bender_draw_categories_list() {
        
?>

                    <?php if (!osc_is_home_page()) {
                        echo 
'<div class="resp-wrapper">';
                    } 
?>

                   
<?php osc_current_web_theme_path('map.php') ; ?>
                    <?php
                    
//cell_3
                    
$total_categories osc_count_categories();
                    
$col1_max_cat ceil($total_categories 3);

                    
osc_goto_first_category();
                    
$i 0;

                    while (
osc_has_categories()) {
                        
?>

                            <?php
                            
if ($i $col1_max_cat == 0) {
                                if (
$i 0) {
                                    echo 
'</div>';
                                }
                                if (
$i == 0) {
                                    echo 
'<div class="cell_3 first_cel">';
                                } else {
                                    echo 
'<div class="cell_3">';
                                }
                            }
                            
?>

            <ul class="r-list">
                <li>
                    <h1>
                    <br>
<?php //added by me - category icon ?>
                        <?php if(get_category_icon(osc_category_id())) { ?>
                        <img src="<?php echo get_category_icon(osc_category_id()); ?>" />
                        <?php ?>
                    <?php //added by me - category icon ?>
                    <br/>
            <?php
            $_slug 
osc_category_slug();
            
$_url osc_search_category_url();
            
$_name osc_category_name();
            
$_total_items osc_category_total_items();
             {
                
?>

                            <span class="collapse resp-toogle"><i class="fa fa-caret-right fa-lg"></i></span>
            <?php ?>
            <?php if ($_total_items 0) { ?>
                            <a class="category <?php echo $_slug?>" href="<?php echo $_url?>"><?php echo $_name?></a> <span></span>
            <?php } else { ?>
                            <a class="category <?php echo $_slug?>" href="#"><?php echo $_name?></a> <span></span>
            <?php ?>
                    </h1>
            <?php if (osc_count_subcategories() > 0) { ?>
                        <ul>
                <?php while (osc_has_subcategories()) { ?>
                                <li>
                    <?php if (osc_category_total_items() > 0) { ?>
                                         <span></span>
                    <?php } else { ?>
                                        </a> <span></span>
                    <?php ?>
                                </li>
                <?php ?>
                        </ul>
            <?php ?>
                </li>
            </ul>
            <?php
            $i
++;
        }
        echo 
'</div>';
        
?>

        <?php if (!osc_is_home_page()) {
            echo 
'</div>';
        } 
?>

        <?php
    
}

}

With this:

Code: [Select]
<?php
if (!function_exists('bender_draw_categories_list')) {

    function 
bender_draw_categories_list($show_map 1) {
        if (!
osc_is_home_page()) {
            echo 
'<div class="resp-wrapper">';
        }
        
        if(
$show_map)
            
osc_current_web_theme_path('map.php') ;

        
osc_goto_first_category();
        
$i 0;
        
?>

        <div style="width: 100%;">
            <ul class="r-list" style="margin: 0 auto;">
                <?php
                
while (osc_has_categories()) {
                
?>

                   
                <li style="display: inline-block;">
                    <h1 style="margin: 5px;">
                        <?php //added by me - category icon ?>
                        <?php if(get_category_icon(osc_category_id())) { ?>
                        <img src="<?php echo get_category_icon(osc_category_id()); ?>" />
                        <?php ?>
                        <?php //added by me - category icon ?>
                        <br>
                        <?php
                        $_slug 
osc_category_slug();
                        
$_url osc_search_category_url();
                        
$_name osc_category_name();
                        
$_total_items osc_category_total_items();
                        if (
$_total_items 0) { ?>

                                        <a class="category <?php echo $_slug?>" href="<?php echo $_url?>"><?php echo $_name?></a> <span></span>
                        <?php } else { ?>
                                        <a class="category <?php echo $_slug?>" href="#"><?php echo $_name?></a> <span></span>
                        <?php ?>
                    </h1>
                </li>
                <?php ?>
            </ul>
            <?php
            $i
++;
        
?>

        </div>
        <?php if (!osc_is_home_page()) {
            echo 
'</div>';
        } 
?>

        <?php
    
}

}
?>


To add categories to the blue background, you would need to find this code in header.php

Code: [Select]
</div>
<?php osc_show_widgets('header'); ?>

and replace it with

Code: [Select]
<?php bender_draw_categories_list(0); ?>
</div>
<?php osc_show_widgets('header'); ?>

Hope it will work.

Regards.

friend I put where I wanted it, it was perfect, but it is appearing above and abjection of the map, I just want it to appear above.
how should I do ?

rainilson

  • Newbie
  • *
  • Posts: 37
Re: placing category horizontally
« Reply #19 on: June 02, 2018, 04:53:05 pm »
I have managed to resolve it, Mr PatrickFromCroatia, thank you very much for your help, you are a great man. thank you so much .

WEBmods

  • Hero Member
  • *****
  • Posts: 937
  • github.com/webmods-croatia/love-osclass/ | patrick
Re: placing category horizontally
« Reply #20 on: June 02, 2018, 06:06:48 pm »
No problem. Please add "SOLVED" to the title of the topic by editing the first post.

Regards.