wmaraci reklam

Temadaki Thumbnail Sorunu

4 Mesajlar 1.437 Okunma
smmexpress

Konyali Konyali furkan.konyali@gmail.com Kullanıcı
  • Üyelik 09.04.2011
  • Yaş/Cinsiyet 30 / E
  • Meslek Front-end Developer
  • Konum İstanbul Anadolu
  • Ad Soyad F** K**
  • Mesajlar 1043
  • Beğeniler 130 / 62
  • Ticaret 5, (%100)
Konu eklediğimide bir resim ekliyimce onun hemen öne çıkarılmış resim olarak kullanıyor.Fakat bir tane daha resim eklediğimde onu öne çıkarılmış resim olarak kullanıyor.Ben konuya eklediğim ilk resimin Thumbnail olmasını istiyorum fakat olmuyor.Baya uğraştım kod yapısı filan rakamlarla oynadım nafile olmadı.



Function.php kodu

function mtheme_thumb($postid=1, $size='thumbnail', $attributes='') {
if ($postid<1) $postid = get_the_ID();
if ($images = get_children(array(
'post_parent' => $postid,
'post_type' => 'attachment',
'numberposts' => 1,
'post_mime_type' => 'image', )))
foreach($images as $image) {
$thumbnail=wp_get_attachment_image_src($image->ID, $size);
?>
/>
}
else {
echo ' echo '/images/no-attachment.gif>';
}

}
if ( function_exists('register_sidebars') )
register_sidebars(1);

$themename = "Mobile Theme";
$shortname = "mob";
$options = array (

array(
"name" => "Mobile Theme Options",
"type" => "title"),

array(
"type" => "open"),

array(
"name" => "Theme Color",
"desc" => "Choose the base color for your mobile theme!",
"id" => $shortname."_color",
"std" => "C00000",
"type" => "colorjs"),

array(
"name" => "Theme Width",
"desc" => "Choose a width for the theme. Enter 100% for full width or define the width in pixels like 320px",
"id" => $shortname."_width",
"std" => "360px",
"type" => "text"),

array(
"type" => "close")

);

/*Add a Theme Options Page*/
function mytheme_add_admin() {

global $themename, $shortname, $options;

if ( $_GET['page'] == basename(__FILE__) ) {

if ( 'save' == $_REQUEST['action'] ) {

foreach ($options as $value) {
update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }

foreach ($options as $value) {
if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } }

header("Location: themes.php?page=functions.php&saved=true");
die;

} else if( 'reset' == $_REQUEST['action'] ) {

foreach ($options as $value) {
delete_option( $value['id'] ); }

header("Location: themes.php?page=functions.php&reset=true");
die;

}
}

add_theme_page($themename." Options", "".$themename." Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');

}

/*Adding scripts*/
function admin_js(){
if ( $_GET['page'] == basename(__FILE__) ) {
?>
<script>/js/jscolor.js"></script>
}

function mytheme_admin() {

global $themename, $shortname, $options;

if ( $_REQUEST['saved'] ) echo '

'.$themename.' settings saved.

';
if ( $_REQUEST['reset'] ) echo '

'.$themename.' settings reset.

';

?>




switch ( $value['type'] ) {

case "open":
?>



case "close":
?>




case "misc":
?>




case "title":
?>






case 'text':
?>







image


" />








case 'colorjs':
?>




" class="color" />








break;

case 'textarea':
?>







image










break;
/*Ralph Damiano*/
case 'select':
?>







image










break;

case "checkbox":
?>







image



/>








break;

case "submit":
?>






}
}
?>













}
function mytheme_wp_head() { ?>

add_action('wp_head', 'mytheme_wp_head');
add_action('admin_head', 'admin_js');
add_action('admin_menu', 'mytheme_add_admin'); ?>




Buda indexte görülecek öne çıkarılmış resimin kodu:



Acil yardım.
 

 

wmaraci
reklam

EmPa EmPa GRAFİKER & Bilgisayar Müh Kullanıcı
  • Üyelik 08.09.2011
  • Yaş/Cinsiyet 29 / E
  • Meslek Öğrenci
  • Konum Elazığ
  • Ad Soyad K** P**
  • Mesajlar 539
  • Beğeniler 93 / 86
  • Ticaret 0, (%0)
http://www.yakuter.com/wordpress-yaz...nail-ozelligi/

Ben buradan yapmıştım
 

 

KEP Creativity | Digital Agency

Pasa Pasa Gelecek Bizim Yönetici
  • Üyelik 30.03.2011
  • Yaş/Cinsiyet 33 / E
  • Meslek Bilgisayar Mühendisi
  • Konum 🖤 Hatay
  • Ad Soyad S** P**
  • Mesajlar 14497
  • Beğeniler 3057 / 3057
  • Ticaret 356, (%100)
http://wmaraci.com/forum/91077-mesaj5.html başlıklı konuya yazmıştım. İnceleyebilirsin..

Nonloser adlı üyeden alıntı

Bu işlemi ancak ilk resmi otomatik thumb atayarak yapabilirsiz sanırım.
Bunun içinde functions.php'ye

function resimsec() {
global $post, $posts;
$resimbir = '';
ob_start();
ob_end_clean();
$output = preg_match_all('//i', $post->post_content, $matches);
$resimbir = $matches [1] [0];


return $resimbir;
}

?>


Aşağıdaki kodlarıda konuya eklenen ilk resmin nerede çıkmasını istiyorsan oraya ekle;


$resmim= get_post_meta($post->ID, "resim", true);
if ($resmim!="") { ?>






Özel alan eklenen resim değerli resmi çeker veya konudaki ilk resmi thumb yapar.

Not: Kodları test etmedim. Ancak kullanılan bir siteden çektim, sorunsuz çalışması gerek..
 

 

Deneyim demeyin, deneyin!

Konyali Konyali furkan.konyali@gmail.com Kullanıcı
  • Üyelik 09.04.2011
  • Yaş/Cinsiyet 30 / E
  • Meslek Front-end Developer
  • Konum İstanbul Anadolu
  • Ad Soyad F** K**
  • Mesajlar 1043
  • Beğeniler 130 / 62
  • Ticaret 5, (%100)
Yakuterin sitesinde anlatmış olduğu herşeyi yaptım fakat zaten sitede thumbnail olduğundan algılamadı mı bilemiyorum.O kodları silincede hata veriyordu.Nonloser hocamın dediğini yapıcağım şimdi.İlginiz için teşekkür ederim.
 

 

wmaraci
wmaraci
wmaraci
Konuyu toplam 1 kişi okuyor. (0 kullanıcı ve 1 misafir)