Помогите с блоком цсс

(Ответов: 23, Просмотров: 1695)
Страница 2 из 3 Первая 123 Последняя
  1. Sunshine reggae Аватар для OKyJIucT
    • Регистрация: 02.09.2011
    • Сообщений: 3,240
    • Репутация: 1830
    • Webmoney BL: ?
    poltava, видимо не сделали, в исходном коде страницы есть эта строка ( _http://clip2net.com/s/2lsW1 скрин). Попробуйте кеш в движке почистить, может он не дает применить изменения.

    В исходном коде удалил строку
    Код:
    <br class="clearer">
    и все стало на свои места _http://clip2net.com/s/2lsXh скрин
    • 1

    Спасибо сказали:

    poltava(29.09.2012),
  2. Студент Аватар для poltava
    • Регистрация: 28.04.2008
    • Сообщений: 47
    • Репутация: 23
    премного благодарен, ошибка была в том, что, как оказалось, в файле было 3 <br class="clearer"> а удалил только 1. благодарю за помощь. правда теперь картинки полностью прилипли к бордюру верхнему и получается немного некрасиво, как это можно подкорректировать?
    • 0
  3. Новичок Аватар для Akara
    • Регистрация: 23.11.2011
    • Сообщений: 24
    • Репутация: 15
    poltava, нужно в файле стилей к #related .tabdiv-wrapper добавить overflow: hidden;
    • 1

    Спасибо сказали:

    poltava(29.09.2012),
  4. Студент Аватар для poltava
    • Регистрация: 28.04.2008
    • Сообщений: 47
    • Репутация: 23
    ребята, прошу еще раз помочь. Сейчас заметил, что в некоторых статьях картинки поползли. Я поставил вывод 10 похожих новостей. в некоторых статьях они красиво в 2 столбика идут, а в некоторых 1 столбик нормально, во втором 1 запись*картинка)а в третьем остальные 4. Думал, может из-за длинного тайтла, но попробовал уменьшит и не помогло. Не поможете еще раз?
    • 0
  5. Новичок Аватар для Akara
    • Регистрация: 23.11.2011
    • Сообщений: 24
    • Репутация: 15
    Скорее всего именно от длины заголовка это и зависит, потому что у блоков разная высота получается. Можно после каждой пятой новости поставить как было раньше <br class="clearer">. Это, наверное, самый простой способ.

    Либо поменять стили как-нибудь так
    #related .panel {
    display: inline-block;
    margin: 0 2px 20px;
    min-height: 80px;
    vertical-align: top;
    width: 110px;
    }
    • 0
  6. Студент Аватар для poltava
    • Регистрация: 28.04.2008
    • Сообщений: 47
    • Репутация: 23
    а как это сделать,чтобы после каждой 5 шел клирер?
    код вставил в цсс, но не помогло
    • 0
  7. Новичок Аватар для Akara
    • Регистрация: 23.11.2011
    • Сообщений: 24
    • Репутация: 15
    Код вроде должен работать, просто нужно найти в css #related .panel и заменить на тот код, что я написала.

    Как clearer вставить сложно сказать. Можете сюда написать кусок кода, который за вывод похожих записей отвечает? Что-нибудь придумаем.
    • 0
  8. Студент Аватар для poltava
    • Регистрация: 28.04.2008
    • Сообщений: 47
    • Репутация: 23
    вроде как этот файл.
    PHP код:
    <?php //get theme options
    global $oswc_single$oswcPostTypes;

    //set theme options
    $oswc_post_sidebar_hide $oswc_single['post_sidebar_hide'];
    $oswc_related_hide $oswc_single['post_related_hide'];
    $oswc_related_header_text $oswc_single['post_related_header_text'];
    $oswc_related_number $oswc_single['post_related_number'];

    if (!
    $oswc_post_sidebar_hide) { 
        
    $columns=3;
    } else {
        
    $columns=5;
    }
    ?>

    <?php // use variables from page custom fields instead of swagger options page (if they exist)
    $override get_post_meta($post->ID"Hide Related"$single true);
    if(
    $override!="" && $override!="null") {
        
    $oswc_related_hide=$override;
        if(
    $oswc_related_hide=="false") {
            
    $oswc_related_hide=false;    
        } else {
            
    $oswc_related_hide=true;
        }
    }
    ?>

    <?php // setup the query
    $tags wp_get_post_tags($post->ID); //get all tag objects for this post

    $hiddentags = array('dummy_first_value'); //add this so a key of 0 cannot trigger an un-hidden tag
    $args = array();
    $count_tax=0;
    foreach(
    $tags as $tag){    
        
    //don't include template tags
        
    if($tag->name!="featured" && $tag->name!="slider" && $tag->name!="spotlight") {
            
    $names[$tag->term_id] = $tag->name;        
            
    $slugs[$tag->term_id] = $tag->slug;        
        
            
    $args[$tag->term_id] = array( // get other articles of same tag
                
    'paged' => $paged,
                
    'post__not_in' => array($post->ID),
                
    'posts_per_page' => $oswc_related_number,
                
    'tag_id' => $tag->term_id    
            
    );
        
            
    //check to see if this query generates results
            
    $test_loop = new WP_Query($args[$tag->term_id]);
        
            
    //if not...
            
    if(!$test_loop->have_posts()) {    
                
    //echo "hiding ".$tag->name."<br />";
                
    $hiddentags[] = $tag->name;//add this tag to the "hide" list
            
    } else {
                
    $count_tax++;        
            }
            
    wp_reset_query();
        }
    }
    //check category in case there aren't any posts in any of the same tags
    if($count_tax==0) {    
        
    $hiddentags=array('dummy_first_value'); //add this so a key of 0 cannot trigger an un-hidden tag
        
    $names=array();
        
    $slugs=array();
        
    $args=array();
        
    $tags wp_get_object_terms($post->ID,'category');
        foreach(
    $tags as $tag){
            
    $names[$tag->term_id] = $tag->name;    
            
    $slugs[$tag->term_id] = $tag->slug;    
            
    //echo "term_name=".$names[$tag->term_id]."<br />";    
            
            
    $args[$tag->term_id] = array( // get other articles of same category    
                
    'paged' => $paged,
                
    'post__not_in' => array($post->ID),
                
    'posts_per_page' => $oswc_related_number,
                
    'category_name' => $slugs[$tag->term_id]        
            );
        
            
    //check to see if this query generates results
            
    $test_loop = new WP_Query($args[$tag->term_id]);
        
            
    //if not...
            
    if(!$test_loop->have_posts()) {
                
    //echo "hiding ".$tag->name."<br />";
                
    $hiddentags[] = $tag->name;//add this taxonomy to the "hide" list
            
    } else {
                
    $count_tax++;    
            }
            
    $count_cats++;
            
    wp_reset_query();    
        }
    }

    ?>

    <?php if(!$oswc_related_hide) { ?>

        <div id="related">
                
            <ul class="tabnav">
            
                <li class="title"><?php echo $oswc_related_header_text?></li>
                
                <li class="arrow">&nbsp;</li>
        
                <?php
                $count
    =0;
                foreach(
    $tags as $tag){                
                    
    $key=array_search($tag->name$hiddentags);
                    if(
    $key==false){ //must match value and type, incase the hidden tag is first in the array (0 position)
                        
    $count++;            
                        
    ?>
                        <li><a title="<?php _e$names[$tag->term_id], 'swagger' ); ?>" href="#tab<?php echo $count?>"><?php _e$names[$tag->term_id], 'swagger' ); ?></a></li>
                        
                    <?php                
                    
    }                
                }
                
    ?>
                
            </ul>
            
           
            
            <div class="tabdiv-wrapper">
            
                <?php
                $count
    =0;
                foreach(
    $tags as $tag){                
                    
    $key=array_search($tag->name$hiddentags);
                    if(
    $key==false){
                        
    $count++;
                        
    $postcount=0;    
                        
    $related_loop = new WP_Query($args[$tag->term_id]);
                        
    $related_exists true;
                        
    ?>
                        <div id="tab<?php echo $count?>" class="tabdiv">
                            
                            <?php if ($related_loop->have_posts()) : while ($related_loop->have_posts()) : $related_loop->the_post(); $postcount++;
                                
    $thisPostType get_post_type(); //get post type
                                
    $thisReviewType $oswcPostTypes->get_type_by_id($thisPostType); //get review type object    
                                
    $isreview=false;
                                if(
    $thisPostType!='post'$isreview=true//set review variable    
                                //show rating?
                                
    $rating_hide get_post_meta($post->ID"Hide Rating"$single true);             
                                
    //check if this is a video post
                                
    $isvideo=false;
                                
    $video get_post_meta($post->ID"Video"$single true);
                                if(
    $video!=""$isvideo=true;        
                                
    ?>    
                            
                                <div class="panel<?php if($postcount $columns == 0) { ?> right<?php ?>">
                                
                                    <?php if($rating_hide!="true") { ?>
                                    
                                        <div class="rating-wrapper small"><?php if($isreview) { $oswcPostTypes->the_rating($thisReviewType); } // show the rating ?></div>
                                        
                                    <?php ?> 
                                
                                    <a class="darken small<?php if($isvideo) { ?> video<?php ?>" href="<?php the_permalink(); ?>"><?php the_post_thumbnail('related', array( 'title'=> '' )); ?></a>
                                    
                                    <a href="<?php the_permalink(); ?>" class="post-title"><?php the_title(); ?></a>
                                    
                                </div>
                                
                                <?php if ($postcount $columns == 0) { // new line every 3 panels ?>
                                
                                    
                            
                                <?php ?> 
                            
                            <?php endwhile; 
                            endif; 
    ?> 
                            
                
                            
                        </div>                    
                    <?php                
                    
    }                
                }
                
    ?>
                
            </div>
        
        </div> 
        
        <?php if($related_exists) { ?>
        
            <script type="text/javascript">
            
                jQuery.noConflict();
                jQuery(document).ready(function() { 
                
                    jQuery('#related > ul').tabs({ fx: { opacity: 'toggle', duration: 150 } });
                    
                });
            
            </script>
        
        <?php ?>
        
    <?php wp_reset_query(); ?>
    • 0
  9. Новичок Аватар для Akara
    • Регистрация: 23.11.2011
    • Сообщений: 24
    • Репутация: 15
    poltava, насколько я понимаю

    почти в самом начале файла количество колонок. Видимо без сайдбара - 3, с сайдбаром - 5
    PHP код:
    if (!$oswc_post_sidebar_hide) { 
        
    $columns=3;
    } else {
        
    $columns=5;

    а сам <br class="clearer"> нужно добавить вот сюда

    PHP код:
    <?php if ($postcount $columns == 0) { // new line every 3 panels ?>
    <br class="clearer"> //сюда
    <?php ?>
    • 0
  10. Студент Аватар для poltava
    • Регистрация: 28.04.2008
    • Сообщений: 47
    • Репутация: 23
    менял количество колонок - ничего не менялось. вставил тег клирер - статьи опять начали выводится в столбик, как и раньше(
    • 0
Страница 2 из 3 Первая 123 Последняя

Похожие темы

Темы Раздел Ответов Последний пост
Помогите с css
Web программирование 3 16.05.2011 10:54
Помогите с css
Прочее 0 01.05.2011 23:43
помогите пож.
Вопросы от новичков 11 29.04.2011 13:45

У кого попросить инвайт?

Вы можете попросить инвайт у любого модератора:

Информеры