<img src="<?php $resim = get_post_custom_values("resim"); echo $resim[0]; ?>" />bu kodu temanızın içindeki postlara ait dosyada istediğiniz yere yapıştırırsanız her postta
resim özel alanı img tagı içinde url çıkacak şekilde çıktı verir.
Siz yazmadan önce, temada
Alıntı
<img src="<?php echo $url; ?>"
yazan yerleri
Alıntı
<img src="<?php echo get_post_meta($post->ID, 'resim', true); ?>"
ile değiştirdim ve hallettim hocam. Yalnız tek bir sorunum kaldı, Slider'a gelen resimleri Özel alandan çekmek. Bunun için yardımcı olursanız sevinirim.
Slider kodları şu şekilde:
<div class="slider">
<div id="slider4" class="sliderwrapper">
<?php
$query = new WP_Query();
$query->query(array('posts_per_page' => 7));
if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
?>
<?php
$imagestring = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large' ); $url = $imagestring['0'];
?>
<div class="contentdiv" style="background: url(<?php echo $url; ?>) center left no-repeat">
<div class="conttitle"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
</div>
<?php endwhile; endif; wp_reset_query(); ?>
</div>
<div id="paginate-slider4" style="background:white">
<?php
$query = new WP_Query();
$query->query(array('posts_per_page' => 7));
if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
?>
<?php
$imagestring = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumbnail' ); $url = $imagestring['0'];
?>
<a href="<?php the_permalink(); ?>" class="toc"><img alt="<?php the_title(); ?>" src="<?php echo $url; ?>" /></a>
<?php endwhile; endif; wp_reset_query(); ?>
</div>
<script type="text/javascript">
featuredcontentslider.init({
id: "slider4",
contentsource: ["inline", ""],
toc: "markup",
nextprev: ["", "Next"],
revealtype: "mouseover",
enablefade: [true, 0.1],
autorotate: [true, 4000],
onChange: function(previndex, curindex){
}
})
</script>
</div>Slider'a çekilen resimleri
resim adlı özel alandan çekecek şekilde nasıl ayarlayabilirim?
Arkadaşlar diğer sorunu da kendim hallettim, belki işine yarayacaklar olur; yukarıda verdiğim kodu şu şekilde değiştirdim: <div class="slider">
<div id="slider4" class="sliderwrapper">
<?php
$query = new WP_Query();
$query->query(array('posts_per_page' => 7));
if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
?>
<?php $id =$post->ID;
$resim = get_post_meta($post->ID,'resim', true);
$pattern = '!<img.*?src="(.*?)"!';
preg_match_all($pattern, $the_content, $matches);
?>
<div class="contentdiv" style="background: url(<?php echo $resim; ?>) center left no-repeat">
<div class="conttitle"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div>
</div>
<?php endwhile; endif; wp_reset_query(); ?>
</div>
<div id="paginate-slider4" style="background:white">
<?php
$query = new WP_Query();
$query->query(array('posts_per_page' => 7));
if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
?>
<?php $id =$post->ID;
$resim = get_post_meta($post->ID,'resim', true);
$pattern = '!<img.*?src="(.*?)"!';
preg_match_all($pattern, $the_content, $matches);
?>
<a href="<?php the_permalink(); ?>" class="toc"><img alt="<?php the_title(); ?>" src="<?php echo $resim; ?>" /></a>
<?php endwhile; endif; wp_reset_query(); ?>
</div>
<script type="text/javascript">
featuredcontentslider.init({
id: "slider4",
contentsource: ["inline", ""],
toc: "markup",
nextprev: ["", "Next"],
revealtype: "mouseover",
enablefade: [true, 0.1],
autorotate: [true, 4000],
onChange: function(previndex, curindex){
}
})
</script>
</div>