• 03-10-2020, 23:07:35
    #1
    Selamlar,

    Newspaper temasını kullanıyorum, bilenler bilir. Bu adamların shortcode mantığıyla bir widget oluşturdum ve son güncellemeleri ile css'leri inline olarak yaptılar.
    Ben de bunu denedim ama bi türlü inline css'leri çağıramadım. Hala önceki css dosyasından okuyor. Acaba bi göz atıp bana yardımcı olabilir misiniz?

    <?php
    class td_block_yeni_telefonlar_sidebar extends td_block {
    
    public function get_custom_css() {
    
    // $unique_block_class - the unique class that is on the block. use this to target the specific instance via css
    
    $unique_block_class = $this->block_uid;
    $compiled_css = '';
    
    $raw_css =
    
    "<style>
                
                
    /* @general_style */
    
    .$unique_block_class .td_populer_model_wrap .tab-content {
    display: block;
    }
                    
                                    .$unique_block_class .sidebar-item-title {
    display: block;
    }
    
    .$unique_block_class .img-thumbnail {
    border:0 solid #ededed;
    }
    
    $unique_block_class .yeni-class {
    width:33%!important;
    padding-right:8px!important;
    padding-left:8px!important;
    line-height:1.1;
    font-size:20px;
    }
    
    .$unique_block_class .img {
    max-width:100%;
    height:auto;
    }
                </style>";
    
    $td_css_res_compiler = new td_css_res_compiler( $raw_css );
    $td_css_res_compiler->load_settings( __CLASS__ . '::cssMedia', $this->get_all_atts() );
    
    $compiled_css .= $td_css_res_compiler->compile_css();
    return $compiled_css;
    }
    
    
    static function cssMedia( $res_ctx ) {
    // style
    $res_ctx->load_settings_raw('style', 1);
    }
    
    
    /**
    * Disable loop block features. This block does not use a loop and it dosn't need to run a query.
    */
    
    function __construct() {
    parent::disable_loop_block_features();
    }
    
    
    function render($atts, $content = null) {
    parent::render($atts); // sets the live atts, $this->atts, $this->block_uid, $this->td_query (it runs the query)
    
    
    if (empty($td_column_number)) {
    $td_column_number = td_global::vc_get_column_number(); // get the column width of the block from the page builder API
    }
    
    
    $buffy = ''; //output buffer
    $buffy .= '<div class="' . $this->get_block_classes() . '" ' . $this->get_block_html_atts() . '>';
    
    
    //get the block css
    $buffy .= $this->get_block_css();
    
    // block title wrap
    
    $buffy .= '<div class="td-block-title-wrap">';
    $buffy .= $this->get_block_title();
    $buffy .= $this->get_pull_down_filter(); //get the sub category filter for this block
    $buffy .= '</div>';
    
    $buffy .= '<div id=' . $this->block_uid . ' class="td_populer_model_wrap td_block_inner td-column-' . $td_column_number . '">';
    
    //$recent_posts = homePageKars();
    
    $args = array(
    
    'numberposts' => 6,
    'post_type' => 'cep-telefonlari',
    
    );
    
    $recent_posts = get_posts($args);
    foreach ($recent_posts as $recent) {
    
    $imageTel = get_the_post_thumbnail($recent->ID, 'medium', array(
    
    'alt' => trim(strip_tags($recent->post_title)),
    'title' => trim(strip_tags($recent->post_title)),
    'class' => 'img-thumbnail width-100',
    
    ));
    
    $resimurlsi = get_post_meta($recent->ID, "resim_url", true);
    $buffy .= '<div class="td-pb-span4 yeni-class" style="float:left;min-height:180px; z-index:5;">';
    $buffy .= '<a title="' . $recent->post_title . '" href="' . get_permalink($recent->ID) . '">';
    $buffy .= '<img loading="lazy" src="' . $resimurlsi . '" alt="' . $recent->post_title . '" title="' . $recent->post_title . '" class="img-responsive img-thumbnail" >';
    $buffy .= '<span class="center display-block sidebar-item-title" style="font-size: 12px;">' . $recent->post_title . '</span>';
    $buffy .= '</a>';
    $buffy .= '</div>';
    
    }
    
    $buffy .= '</div>';
    $buffy .= "</div>";
    $buffy .= '</div>';
    
    return $buffy;
    }
    }
    Çok Teşekkürler.
  • 03-10-2020, 23:18:20
    #2
    child temasını kullanıyor musunuz?
  • 05-10-2020, 00:04:33
    #3
    Evet kullanıyorum ama onunla alakası yok malesef