Wordpress the_author () ve wp_get_archives () çalışmıyor

2 Cevap php

Öncelikle, ben taze WordPress ile, ben aktif erken 1.x hattı beri çeşitli hafif özel CMS için bunu kullanıyorum karşı karşıya değilim.

Ben çok, çok basit bir blog kurmak için 2.8.6 taze bir yapı kullanıyorum. Sadece bir kategori ve sadece bir 'tek' şablonu. Orada başka hiçbir işlevselliği, böylece site sadece gerçekten tema dizininde index.php ve single.php dosyaları gerektirir.

The issues: the_author() does not work on single.php, and only works partially on index.php. By partially, I mean the tags works for the first item in the loop, but then doesn't work thereafter.

wp_get_archives (), bu yılın Mayıs geri yayınlanan blogda 14 test makaleleri var olsa bile, kenar çubuğunda hiçbir içeriği gösterir.

Description of the error: The mysterious lack of 'echo' from these tags does not halt the loading of the page. My CSS template displays fine (and it is not CSS hiding anything). The tags simply are presenting no output to the screen.

Remedies I have tried: I've tried using get_userdata() with the post author, but even this doesn't work. I can get the post author_id from the database ($post->author_id), but get_userdata() doesn't return anything when fed this variable on single.php or for any posts after the first in the loop.

Ben de böyle print_r (gibi tüm standart izleme çözümleri denedim) ve içeriğini analiz etmek için bir değişken dönmek için işlev almaya çalışırken ettik - şans yok.

Herkes tüm bu neden ne olabilir herhangi bir fikir varsa, temasa lütfen! Ben daha önce böyle WordPress ile aptal sorun yaşamadık. Teşekkürler.

2 Cevap

(Imsi) neler olduğunu öğrendim.

Ben yerlerde bir sürü yeniden bazı ek işlevsellik sağlamak için özel bir PHP sınıfını kullanıyorum. Bu sınıf, o kendi veritabanı bağlantısını kullanır ve mysql_close () denir nedense, bu the_author tarafından yapılan aramaları () ve wp_get_archives () sona erer.

Muhtemelen bu kullanarak $ wpdb geçici bir çözüm, ama emin değilim ne kadar güçlük bu entegre olurdu,.

Neyse, bunu başkası yardımcı olur umarım.

Bu durumda onun bağlantı tanıtıcısı için sınıf kullanım $ wbdb-> dbh var. Bu şekilde sadece bir db bağlantısı açık ve WordPress ve sınıf arasında paylaşılır.