go41

Re: Customize the sidebar, depending on author :: Reply by master

von Joern am 8. Jul. 2010 | Keine Kommentare

I guess you query for a certain category and want to show posts of the current author only?
Let’s say you query for a category like this:
query_posts(‚cat=4‘);
to get this query display only posts of the author you just show, you can get the current author ID like this:
$authid=$curauth->ID;
and add in the query you use: &author=$authid
the code getting the current author and looking for his posts in category 4 would look like this:
Code:

<?php
$authid=$curauth->ID;
query_posts('cat=4&author=$authid');
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

title and content here

<?php endwhile; else: ?>

<?php endif; ?>

<?php //Reset Query
wp_reset_query();
?>

did not try, you are my ‚beta tester‘ ;-)
____________________
you find me on Google+, Twitter and Facebook

(von: master)

Hier noch 2 weitere Ergebnisse dieses Threads:

Customize the sidebar, depending on author

8. Jul. 2010 (von: adamwork)

Hi allSo here is my situation.I have author.php, which shows a list of latest posts from that author. On the top right hand corner, I then have information about the author (Biog, Name etc).Underneath that, I want to display posts…

Re: Customize the sidebar, depending on author :: Reply by adamwork

8. Jul. 2010 (von: adamwork)

Hi masteradminThe main page already shows the post of the author. I want to display posts from a different category in the sidebar. The category in the sidebar will be different, depending on the author.Thanksadam Weiterlesen →

Autor:

Du findest mich auch auf Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.


Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.

weitere forum Beiträge: