elimdeki bir wordpress temasını editlemeye çalışıyorum. php bilgim yok denecek kadar az.
konu içine eklenen ilk resmi alma kodu olarak functions.php içine aşağıdaki kodu ekledim
01.function resimgoster() {
02. global $post, $posts;
03. $resimbir = '';
04. ob_start();
05. ob_end_clean();
06. $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
07. $resimbir = $matches [1] [0];
08.
09. if(empty($resimbir)){ //Eğer resim eklememişseniz
10. $resimbir = "/images/default.jpg";
11. }
12. return $resimbir;
13.}
bu kodu da
<img src="<?php echo resimgoster() ?>" />
index.php içine ekledim
kaynak:
http://www.wpuzmani.com/yazidaki-ilk...fada-gostermek
temada istediğimi alamadım
tema adı wptube3 wp ***** tema olup ***** olmayan bir sitede kullanılacaktır