Site adresi: http://www.klavyer.com/
Soru 1;
Şu şekilde bir bileşen var http://prntscr.com/4jejj2 1 büyük 4 küçük görselden oluşuyor (sayıyı bileşenlerden seçiyoruz) ben bunun büyük olanını silmek istedim css-html ve php özelliğini sildim ancak büyük görselin yerinde görünecek olan görsel hayalet oldu kategorideki 2. görselden başlıyor, şöyle: http://prntscr.com/4jekj5 (panelden 5 seçiyorum 4 görünüyor) kodlarda şu kısmı http://prntscr.com/4jemmw sildiğinde hata alıyorum ancak 0 yaptığımda ise 5 yazdıysam 5 görünüyor ve istediğim gibi oluyor ancak css bozuluyor nasıl silmem yada yerine ne yazmam gerekiyor.
Bileşenlerdeki görünümü: http://prntscr.com/4jemdk
Orjinal php içeriği;
<?php
add_action('widgets_init', 'themeloy_register_widgets_grid_list');
function themeloy_register_widgets_grid_list() {
register_widget('themeloy_recent_posts_widget_grid_list');
}
class themeloy_recent_posts_widget_grid_list extends WP_Widget {
/*-----------------------------------------------------------------------------------*/
/* Widget Setup
/*-----------------------------------------------------------------------------------*/
function __construct() {
$widget_ops = array(
'classname' => 'cat_recent_entries clearfix',
'description' => __('Ekran ızgara veya ön sayfada bir veya birden fazla kategoriden gelen son mesajları listeler.', 'tl_back')
);
parent::__construct('custom-recent-posts-grid-list', __('Klavyer: Ana Sayfa Bileşeni NO:1', 'tl_back'), $widget_ops);
}
/*-----------------------------------------------------------------------------------*/
/* Display Widget
/*-----------------------------------------------------------------------------------*/
function widget($args, $instance) {
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? 'Recent Posts' : $instance['title'], $instance, $this->id_base);
$show_style_1 = isset($instance['show_style_1']) ? $instance['show_style_1'] : false;
if (!$number = absint($instance['number']))
$number = 4;
if (!$cats = $instance["cats"])
$cats = '';
// array to call recent posts.
$themeloy_args = array(
'showposts' => $number,
'category__in' => $cats,
);
$themeloy_widget = null;
$themeloy_widget = new WP_Query($themeloy_args);
echo $before_widget;
// Widget title
echo $before_title;
echo $instance["title"];
echo $after_title;
// Post list in widget
$blog_date_widget = of_get_option('blog_date_widget', 0);
$blog_comment_widget = of_get_option('blog_comment_widget', 0);
$i = 0;
while ($themeloy_widget->have_posts()) {
$themeloy_widget->the_post();
$i++;
$thumb = themeloy_get_thumbnail(get_the_ID());
if ($i == 1) {
$thumb = get_post_thumbnail_id(get_the_ID());
if (!$thumb) {
$url[0] = get_template_directory_uri() . '/img/demo/dum-1.jpg';
}else{
$url = wp_get_attachment_image_src( $thumb , '355x200');
}
?>
<div class="<?php if ($show_style_1 == true ) { echo "main-post-large-style";}else{echo " main-post-large";}?>">
<div class="image_review_wrapper">
<div id="klavyer-icon">
<a href="<?php the_permalink(); ?>">
<img class="main" src="<?php echo $url[0]; ?>" alt="<?php the_title(); ?>" />
<span class="goster-1"></span>
</div>
<?php echo themeloy_post_type(); ?>
</a>
<?php $enable_review = get_post_custom_values('reviewthemeloy_checkbox', get_the_ID()); ?>
<?php
if (of_get_option('disable_review') == 0){
if($enable_review[0] == 1){ ?>
<span class="review-wrap">
<span class="review-star">
<span style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?>%" class="review-star-inline"> </span>
</span>
</span>
<?php }else{?>
<span class="review-wrap">
<span class="review-star-none">
<span class="review-star-inline-none"></span>
</span>
</span>
<?php }}else{?>
<span class="review-wrap">
<span class="review-star-none">
<span class="review-star-inline-none"></span>
</span>
</span>
<?php } ?>
</div>
<div class="feature-text">
<div class="post-title"><h3><a class="title" href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
<?php echo themeloy_short_title(70, get_the_title('')); ?>
</a></h3></div>
<?php if($blog_date_widget == 0) { ?>
<?php } ?>
<?php if($blog_comment_widget == 0) { ?>
<?php } ?>
</p>
<?php if ($show_style_1 == true ) {echo themeloy_short_title(200, get_the_excerpt(''));}else{echo themeloy_short_title(300, get_the_excerpt(''));} ?>
</div>
<?php
foreach((get_the_category()) as $category) {
$cikti = $category->slug;
}
?>
<div class="isim-d-buyuk-<?php echo $cikti; ?>"></div><div class="isim-buyuk-<?php echo $cikti; ?>"></div>
<div id="tarih-ana-ust">
<i class="post-meta-ic"><?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' önce yazıldı'; ?></i>
</div>
</div>
<?php if ($show_style_1 == true ) { echo '<div class="clear"></div>';}?>
<div class="<?php if ($show_style_1 == true ) { echo "post-list-item-style";}else{echo " post-list-item";}?>">
<?php
}else {
$thumb = get_post_thumbnail_id(get_the_ID());
if (!$thumb) {
$url[0] = get_template_directory_uri() . '/img/demo/dum-2.jpg';
}else{
$url = wp_get_attachment_image_src( $thumb , '177x100');
}
$date = '<span class="date">' . get_the_date('M d, Y') . '</span>';
?>
<div class="small-feature">
<div id="klavyer-icon">
<a href="<?php the_permalink(); ?>" class="feature-link"><img src="<?php echo $url[0]; ?>" alt="<?php the_title(); ?>" />
<?php echo themeloy_post_type(); ?>
<span class="goster-1-2"></span>
</div>
</a>
<div class="feature-text">
<div class="post-title"><h4><a class="title" href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<?php echo themeloy_short_title(50, get_the_title('')); ?>
</a></h4>
</div>
<?php if($blog_date_widget == 0) { ?>
<?php } ?>
<?php if($blog_comment_widget == 0) { ?><?php } ?>
<?php $enable_review = get_post_custom_values('reviewthemeloy_checkbox', get_the_ID()); ?>
<?php if (of_get_option('disable_review') == 0){
if($enable_review[0] == 1){?>
<span class="review-star">
<span style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?>%" class="review-star-inline"></span>
</span>
<?php }else{?>
<span class="review-star-none">
<span class="review-star-inline-none"></span>
</span>
<?php }}else{?>
<span class="review-star-none">
<span class="review-star-inline-none"></span>
</span>
<?php } ?>
</div>
<?php
foreach((get_the_category()) as $category) {
$cikti = $category->slug;
}
?>
<div class="isim-d-<?php echo $cikti; ?>"></div><div class="isim-<?php echo $cikti; ?>"></div>
<div id="tarih-ana-alt">
<i class="post-meta-ic"><?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' önce'; ?></i>
</div>
</div>
<?php
};
}
?>
</div>
<?php
wp_reset_query();
echo $after_widget;
}
/*-----------------------------------------------------------------------------------*/
/* Update Widget
/*-----------------------------------------------------------------------------------*/
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['cats'] = $new_instance['cats'];
$instance['number'] = absint($new_instance['number']);
$instance['show_style_1'] = (bool) $new_instance['show_style_1'];
return $instance;
}
/*-----------------------------------------------------------------------------------*/
/* Widget Settings (Displays the widget settings controls on the widget panel)
/*-----------------------------------------------------------------------------------*/
function form($instance) {
$title = isset($instance['title']) ? esc_attr($instance['title']) : 'Recent Posts';
$number = isset($instance['number']) ? absint($instance['number']) : 5;
$show_style_1 = isset($instance['show_style_1']) ? (bool) $instance['show_style_1'] : false;
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'tl_back'); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
<p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of posts to show:', 'tl_back'); ?></label>
<input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
<p><input class="checkbox" type="checkbox" <?php checked($show_style_1); ?> id="<?php echo $this->get_field_id('show_style_1'); ?>" name="<?php echo $this->get_field_name('show_style_1'); ?>" />
<label for="<?php echo $this->get_field_id('show_style_1'); ?>"><?php _e('Display post feature below main post?', 'tl_back'); ?></label></p>
<p>
<label for="<?php echo $this->get_field_id('cats'); ?>"><?php _e('Select categories to include in the recent posts list:', 'tl_back'); ?>
<?php
$categories = get_categories('hide_empty=0');
echo "<br/>";
foreach ($categories as $cat) {
$option = '<input type="checkbox" id="' . $this->get_field_id('cats') . '[]" name="' . $this->get_field_name('cats') . '[]"';
if (isset($instance['cats'])) {
foreach ($instance['cats'] as $cats) {
if ($cats == $cat->term_id) {
$option = $option . ' checked="checked"';
}
}
}
$option .= ' value="' . $cat->term_id . '" />';
$option .= ' ';
$option .= $cat->cat_name;
$option .= '<br />';
echo $option;
}
?>
</label>
</p>
<?php
}
}
?>Düzenlediğim php içeriği;<?php
add_action('widgets_init', 'themeloy_register_widgets_grid_list2');
function themeloy_register_widgets_grid_list2() {
register_widget('themeloy_recent_posts_widget_grid_list2');
}
class themeloy_recent_posts_widget_grid_list2 extends WP_Widget {
/*-----------------------------------------------------------------------------------*/
/* Widget Setup
/*-----------------------------------------------------------------------------------*/
function __construct() {
$widget_ops = array(
'classname' => 'cat_recent_entries clearfix',
'description' => __('Ekran ızgara veya ön sayfada bir veya birden fazla kategoriden gelen son mesajları listeler.', 'tl_back')
);
parent::__construct('custom-recent-posts-grid-list2', __('Klavyer: Ana Sayfa Bileşeni NO:2 (Sade)', 'tl_back'), $widget_ops);
}
/*-----------------------------------------------------------------------------------*/
/* Display Widget
/*-----------------------------------------------------------------------------------*/
function widget($args, $instance) {
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? 'Recent Posts' : $instance['title'], $instance, $this->id_base);
$show_style_1 = isset($instance['show_style_1']) ? $instance['show_style_1'] : false;
if (!$number = absint($instance['number']))
$number = 4;
if (!$cats = $instance["cats"])
$cats = '';
// array to call recent posts.
$themeloy_args = array(
'showposts' => $number,
'category__in' => $cats,
);
$themeloy_widget = null;
$themeloy_widget = new WP_Query($themeloy_args);
echo $before_widget;
// Widget title
echo $before_title;
echo $instance["title"];
echo $after_title;
// Post list in widget
$i = 0;
while ($themeloy_widget->have_posts()) {
$themeloy_widget->the_post();
$i++;
if ($i == 1) {
?>
<div class="<?php if ($show_style_1 == true ) { echo "post-list-item-style";}else{echo " post-list-item";}?>">
<?php
}else {
?>
<?php
$thumb = get_post_thumbnail_id(get_the_ID());
if (!$thumb) {
$url[0] = get_template_directory_uri() . '/img/demo/dum-2.jpg';
}else{
$url = wp_get_attachment_image_src( $thumb , '177x100');
}
$date = '<span class="date">' . get_the_date('M d, Y') . '</span>';
?>
<div class="small-feature">
<div id="klavyer-icon">
<a href="<?php the_permalink(); ?>" class="feature-link"><img src="<?php echo $url[0]; ?>" alt="<?php the_title(); ?>" />
<?php echo themeloy_post_type(); ?>
<span class="goster-1-2"></span>
</div>
</a>
<div class="feature-text">
<div class="post-title"><h4><a class="title" href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<?php echo themeloy_short_title(50, get_the_title('')); ?>
</a></h4>
</div>
<?php if($blog_date_widget == 0) { ?><?php } ?>
<?php if($blog_comment_widget == 0) { ?><?php } ?>
<?php $enable_review = get_post_custom_values('reviewthemeloy_checkbox', get_the_ID()); ?>
<?php if (of_get_option('disable_review') == 0){
if($enable_review[0] == 1){?>
<span class="review-star">
<span style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?>%" class="review-star-inline"></span>
</span>
<?php }else{?>
<span class="review-star-none">
<span class="review-star-inline-none"></span>
</span>
<?php }}else{?>
<span class="review-star-none">
<span class="review-star-inline-none"></span>
</span>
<?php } ?>
</div>
<?php
foreach((get_the_category()) as $category) {
$cikti = $category->slug;
}
?>
<div class="isim-d-<?php echo $cikti; ?>"></div><div class="isim-<?php echo $cikti; ?>"></div>
<div id="tarih-ana-alt">
<i class="post-meta-ic"><?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' önce'; ?></i>
</div>
</div>
<?php
};
}
?>
</div>
<?php
wp_reset_query();
echo $after_widget;
}
/*-----------------------------------------------------------------------------------*/
/* Update Widget
/*-----------------------------------------------------------------------------------*/
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['cats'] = $new_instance['cats'];
$instance['number'] = absint($new_instance['number']);
$instance['show_style_1'] = (bool) $new_instance['show_style_1'];
return $instance;
}
/*-----------------------------------------------------------------------------------*/
/* Widget Settings (Displays the widget settings controls on the widget panel)
/*-----------------------------------------------------------------------------------*/
function form($instance) {
$title = isset($instance['title']) ? esc_attr($instance['title']) : 'Recent Posts';
$number = isset($instance['number']) ? absint($instance['number']) : 5;
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Bileşen başlığı:', 'tl_back'); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
<p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Görünecek içerik sayısı:', 'tl_back'); ?></label>
<input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
<p><input class="checkbox" type="checkbox" <?php checked($show_style_1); ?> id="<?php echo $this->get_field_id('show_style_1'); ?>" name="<?php echo $this->get_field_name('show_style_1'); ?>" />
<label for="<?php echo $this->get_field_id('show_style_1'); ?>"><?php _e('Display post feature below main post?', 'tl_back'); ?></label></p>
<p>
<label for="<?php echo $this->get_field_id('cats'); ?>"><?php _e('Görünmesini istediğiniz kategorileri seçin:', 'tl_back'); ?>
<?php
$categories = get_categories('hide_empty=0');
echo "<br/>";
foreach ($categories as $cat) {
$option = '<input type="checkbox" id="' . $this->get_field_id('cats') . '[]" name="' . $this->get_field_name('cats') . '[]"';
if (isset($instance['cats'])) {
foreach ($instance['cats'] as $cats) {
if ($cats == $cat->term_id) {
$option = $option . ' checked="checked"';
}
}
}
$option .= ' value="' . $cat->term_id . '" />';
$option .= ' ';
$option .= $cat->cat_name;
$option .= '<br />';
echo $option;
}
?>
</label>
</p>
<?php
}
}
?>Soru 2;Sidebar da işaretlediğim kategorileri listeleyen bir bileşen var ve ben bu bileşeni işaretlediğim kategori yerine bulunulan yazı ile ilgili benzer yazıları listeleyecek şekilde olmasını istiyorum, yani bu bileşeni sadece yazı içinde kullanacağım ve o yazı ile ilgili yazıları gösterecek (benzer etiketteki yazılar yada buna ek aynı kategorideki yazılar olabilir ama sadece aynı kategorideki yazılar olmasın)
Bileşen kodları:
<?php
add_action( 'widgets_init', 'themeloy_rec_register_widgets_2' );
function themeloy_rec_register_widgets_2() {
register_widget( 'themeloy_rec_posts_widget_2' );
}
class themeloy_rec_posts_widget_2 extends WP_Widget {
/*-----------------------------------------------------------------------------------*/
/* Widget Setup
/*-----------------------------------------------------------------------------------*/
function __construct() {
$widget_ops = array(
'classname' => 'rec',
'description' => __('Seçtiğiniziz kategorideki yazıalrı tarih sırasına göre sidebarda büyük görsel ile gösterir.', 'tl_back')
);
parent::__construct('rec-recent-posts-2', __('Klavyer: Sidebarda büyük benzer yazılar', 'tl_back'), $widget_ops);
}
/*-----------------------------------------------------------------------------------*/
/* Display Widget
/*-----------------------------------------------------------------------------------*/
function widget($args, $instance) {
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? 'Recently Articles' : $instance['title'], $instance, $this->id_base);
if (!$number = absint($instance['number']))
$number = 6;
if (!$cats = $instance["cats"])
$cats = '';
$post_cat_args = array(
'showposts' => $number,
'category__in' => $cats
);
$post_cat_widget = null;
$post_cat_widget = new WP_Query($post_cat_args);
echo $before_widget;
echo $before_title;
echo $instance["title"];
echo $after_title;
// Post list in widget
echo '<div class="widget recent-posts">';
echo '<ul class="ulpost">';
while ($post_cat_widget->have_posts()) {
$post_cat_widget->the_post();
?>
<li>
<div class="yazi-tarih"><div class="yazi-tarih-ic">
<i class="icon-calendar"></i>
<i class="post-meta-ic"><?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' önce yazıldı'; ?></i>
</div></div>
<?php
$thumb = get_post_thumbnail_id(get_the_ID());
if (!$thumb) {
$url[0] = get_template_directory_uri() . '/img/demo/dum-6.jpg';
}else{
$url = wp_get_attachment_image_src( $thumb , '300x170');
}
echo '
<div id="klavyer-icon">
<a class="entry-thumb2 feature-link" href="' . get_permalink() . '" title="' . the_title_attribute('echo=0') . '">
<img src="' . $url[0] . '" alt="' . get_the_title() . '" />
<span class="goster"></span>
</a>
</div>
';
echo themeloy_post_type();
?>
<div class="ulpost_title">
<a class="title" href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<?php echo themeloy_short_title(61, get_the_title('')); ?>
</a>
<?php $enable_review = get_post_custom_values('reviewthemeloy_checkbox', get_the_ID()); ?>
<?php if (of_get_option('disable_review') == 0){
if($enable_review[0] == 1){?>
<span class="review-star">
<span style="width:<?php echo themeloy_get_total_review(get_the_ID()); ?>%" class="review-star-inline"></span>
</span>
<?php }else{?>
<span class="review-star-none">
<span class="review-star-inline-none"></span>
</span>
<?php }}else{?>
<span class="review-star-none">
<span class="review-star-inline-none"></span>
</span>
<?php } ?>
<?php
foreach((get_the_category()) as $category) {
$cikti = $category->slug;
}
?>
<div class="isim-d-<?php echo $cikti; ?>"></div><div class="isim-<?php echo $cikti; ?>"></div>
</div>
</li>
<?php
}
wp_reset_query();
echo "</ul>\n";
echo "</div>\n";
echo $after_widget;
}
/*-----------------------------------------------------------------------------------*/
/* Update Widget
/*-----------------------------------------------------------------------------------*/
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['cats'] = $new_instance['cats'];
$instance['number'] = absint($new_instance['number']);
return $instance;
}
/*-----------------------------------------------------------------------------------*/
/* Widget Settings (Displays the widget settings controls on the widget panel)
/*-----------------------------------------------------------------------------------*/
function form( $instance ) {
$title = isset($instance['title']) ? esc_attr($instance['title']) : 'Recent Posts';
$number = isset($instance['number']) ? absint($instance['number']) : 5;
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'tl_back'); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
<p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of posts to show:', 'tl_back'); ?></label>
<input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
<p>
<label for="<?php echo $this->get_field_id('cats'); ?>"><?php _e('Select categories to include in the recent posts list:', 'tl_back');?>
<?php
$categories= get_categories('hide_empty=0');
echo "<br/>";
foreach ($categories as $cat) {
$option = '<input type="checkbox" id="' . $this->get_field_id('cats') . '[]" name="' . $this->get_field_name('cats') . '[]"';
if (isset($instance['cats'])) {
foreach ($instance['cats'] as $cats) {
if ($cats == $cat->term_id) {
$option = $option . ' checked="checked"';
}
}
}
$option .= ' value="' . $cat->term_id . '" />';
$option .= ' ';
$option .= $cat->cat_name;
$option .= '<br />';
echo $option;
}
?>
</label>
</p>
<?php
}
}
?>Evet arkadaşlar yardımcı olanlara şimdiden çok teşekkürler.

Ayın 10'unda hızlanıcak tekrar, o zaman yardımcı olabilirim. Skype adresinizi ekledim.