Das Problem liegt immer noch vor!
Jemand eine Idee, wie ich es abstellen kann?
Um schreiben oder kommentieren zu können, benötigen Sie ein Benutzerkonto.
Sie haben schon ein Benutzerkonto? Melden Sie sich hier an.
Jetzt anmeldenHier können Sie ein neues Benutzerkonto erstellen.
Neues Benutzerkonto erstellenDas Problem liegt immer noch vor!
Jemand eine Idee, wie ich es abstellen kann?
Keiner eine Idee?
Hallo zusammen!
Mit folgendem Code lasse ich bei mir die Letzten Kommentare inkl. Gravataren anzeigen:
global $wpdb, $comments, $comment;
if ( !$number = (int) $options['number'] )
$number = 5;
else if ( $number < 1 )
$number = 1;
else if ( $number > 15 )
$number = 15;
$comments = $wpdb->get_results("SELECT comment_type, comment_author, comment_author_email, comment_author_url, comment_ID, comment_post_ID, comment_content FROM $wpdb->comments
WHERE comment_approved = '1'
AND comment_type
NOT LIKE 'pingback' OR 'trackback'
AND comment_author_url NOT LIKE 'http://domain/account'
ORDER BY comment_date_gmt
DESC LIMIT $number");
if ( $comments ) {
foreach ($comments as $comment) {
echo '<li style="list-style-type:none">'. get_avatar( $comment, 32) .'<div class="meta">' . sprintf(__('Von %1$s in: %2$s'), get_comment_author_link(), '<br /><a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '" rel="follow me" title="'.get_the_title($comment->comment_post_ID).'">' . get_the_title($comment->comment_post_ID) . '</a></div>') . '<p>', comment_excerpt() ,'</p>';
echo '</li>';
}
}
}
Alles anzeigen
Wie kann ich die Gravatare jetzt mit einem Alt-Tag für die Namen (comment_author) versehen? Gleiche Frage zu den Namen, die mit
ausgegeben werden.
Danke im voraus
Hallo zusammen!
Wie schaffe ich es, im Frontend den Link zur g+-Seite des Blogs korrekt anzugeben, wenn ich in den Kontaktinfos nur die Profil-ID selbst, also die Zahlenkombi stehen habe.
Mit dem folgenden Code erfolgt die Ausgabe ja nur korrekt, wenn in der Kontaktinfo das plus.google.com/1234567891223 (als Beispiel) steht.
Danke im voraus
Marcus
Oder anders gefragt: Wie erzwinge ich die Textdarstellung anstatt die des Bildes?
Jemand eine Idee?
Ich habe bei mir in der Sidebar folgenden Code eingebaut:
kein_kommentar() {
global $wpdb;
$com_query= "SELECT post_type, post_title AS posttitle, ID, post_name AS postname, SUBSTRING(post_content,1,155) AS post_auszug, post_date, comment_status, comment_count FROM $wpdb->posts
WHERE comment_count = '0'
AND post_status = 'publish'
AND comment_status ='open'
AND post_type='post'
ORDER BY rand()
LIMIT 3";
$com_result = $wpdb->get_results($com_query);
if ( empty($com_result) ) {
echo '<h4 class="sidebar-title">Es gibt keinen unkommentierten Artikel</h4>';
}
foreach ($com_result as $comm) {
$ID = $com->ID;
$posttitle = $comm->posttitle;
$postname = $comm->postname;
$post_auszug = $comm->post_auszug;
echo '<div class="umfrage">';
echo '<li style="list-style-type:none"><div class="akt-titel"><a href="'. get_permalink($comm->ID).'" title="'.$comm->posttitle.'">'.$comm->posttitle.'</a><br />';
echo $comm->post_auszug.' ...</div></li></div>';
}
}
Alles anzeigen
Nun wird bei Artikeln die ein Bild enthalten versucht, dieses anstatt des Textauszugs einzublenden.
Wie kann ich das verhindern?
Kopiert in dem Sinne habe ich das nicht. Ich habe jemanden gefragt, wie das funktionieren kann, und der hat mir den Code so vorgeschlagen.
Das ganze befindet sich nicht in einem Loop! Und ich muss also eine DB-Abfrage (query) starten, versteh ich das richtig?
Ein wenig php kann ich ja durchaus, und es ist ja nicht so, das ich nur frage um billig den Code abzustauben. Ich hab mich mit dem Codex auch schon auseinandergesetzt - nur leider wenig erfolgreich.
Also, ich habe das mit Unterstützung jetzt so hingebaut:
function updated_article() { global $wp_query;$postid = $wp_query->post->ID;$modified = get_post_meta($post->ID, 'Hinweis', true);if (!empty($modified)) {echo $post_title; } wp_reset_query();}
Aber obwohl das Feld Hinweis gefüllt ist, erfolgt in der Sidebar keine Ausgabe. Auch mit dem folgenden Code gibt es keine Anzeige:
$update = get_post_meta($post->ID, Hinweis', true); ?>
<?php if ($update == "ja"){
echo $post_title;
}
}
Woran kann das liegen?
Der Code in der Sidebar.php sieht so aus:
Ich habs gelöst bekommen!
Diese Lösung sieht wie folgt aus:
function top_commentator_all() {
global $wpdb;
$i = 0;
echo '<div class="topcommenters">';
echo '<table border="0" cellSpacing="3" cellPadding="5" width="85%">';
$topcommentator_query="SELECT comment_author, comment_author_email, comment_type, SUBSTRING_INDEX(comment_author_url, '/', 3) as top_commentator, COUNT(*) as top_num FROM $wpdb->comments
WHERE comment_approved='1'
AND comment_author_url IS NOT NULL
AND comment_author_url != ''
AND comment_author_email NOT LIKE 'xyz@domain.de%'
AND comment_author_email NOT LIKE 'xyz@domain.de%'
AND comment_author_url NOT LIKE 'http://twitter.com/%'
AND comment_author_url NOT LIKE 'http://domain.de%'
AND comment_author_url NOT LIKE 'http://facebook.com%'
AND comment_type NOT LIKE 'pingback' OR 'trackback'
GROUP BY top_commentator
Order by top_num DESC, comment_date ASC
LIMIT 18";
$topcommentator_result = $wpdb->get_results($topcommentator_query);
if ( !empty($topcommentator_result) ) {
foreach ($topcommentator_result as $comment) :
$co_aut = $comment->top_commentator;
$co_aut = str_ireplace("http://", "", $co_aut);
echo '<td>'.get_avatar( $comment, 64 ),' <a href="'.$comment->top_commentator.'/" target="_blank"><br />'.$comment->comment_author.'</a> ('.$comment->top_num.')</td>'; $i++;
if($i%3==0) {
echo '</tr><tr>';
}
endforeach;
$i=0;
}
echo '</table>';
echo '</div>';
}
Alles anzeigen
Wenn ich das richtig verstanden habe in einem php-Forum, funktioniert das aber auch ohne Tabelle und nur mit div. Nur das wie habe ich nicht kapiert.
Wenn da jemand eine Lösung weiß, nur her damit ;)
Gruß
Marcus
Hallo zusammen!
Mit folgendem Code versuche ich, meine Top-Kommentatoren dreispaltig und mehrzeilig anzeigen zu lassen. Leider funktioniert das noch nicht so wirklich. Es werden nur die Zeilenumbrüche nach 3 Bildern angezeigt.
Wie bekomme ich das geregelt?
global $wpdb; ?>
<?php
$i = 0;
$topcommentator_query="SELECT comment_author, comment_author_email, comment_type, SUBSTRING_INDEX(comment_author_url, '/', 3) as top_commentator, COUNT(*) as top_num FROM $wpdb->comments
WHERE comment_approved='1'
AND comment_author_url IS NOT NULL
AND comment_author_url != ''
AND comment_author_email NOT LIKE 'webbi@themenfreund.de%' AND comment_author_email NOT LIKE 'kommentar@themenfreund.de%' AND comment_author_url NOT LIKE 'http://twitter.com/%'
AND comment_author_url NOT LIKE 'http://themenfreund.de%'
AND comment_author_url NOT LIKE 'http://facebook.com%'
AND comment_type NOT LIKE 'pingback' OR 'trackback'
GROUP BY top_commentator
Order by top_num DESC, comment_date ASC
LIMIT 30";
$topcommentator_result = $wpdb->get_results($topcommentator_query); if ( !empty($topcommentator_result) ) {
foreach ($topcommentator_result as $comment) :
echo '<table border="0" cellSpacing="3" cellPadding="5" bgColor="#eeeeee" width="60%">';
echo '<tr width="60%">';
$i=$i+1;
$co_aut = $comment->top_commentator;
$co_aut = str_ireplace("http://", "", $co_aut);
echo get_avatar( $comment, 32 ),' <a href="'.$comment->top_commentator.'/" target="_blank">'.$comment->comment_author.'</a> ('.$comment->top_num.')';
if($i%3==0) {
echo '<br /><br />';
}
endforeach;
$i++;
}
?>
</tr>
</table>
Alles anzeigen
Danke im voraus!
Marcus
Hallo zusammen!
Ich habe mit folgendem Code ein Funktion gebaut, die anzeigt, ob und wann ein schon etwas älterer Artikel aktualisiert wurde.
function updated_article() {
global $wpdb;
$upd_query = "SELECT post_date, post_status, post_type, post_modified, SUBSTRING(post_content,1,155) AS post_auszug, DATE_FORMAT(post_modified, '%d.%m.%Y, um %H:%i:%s') AS post_modified_ger, post_title AS posttitle, post_name AS postname, guid AS postid FROM $wpdb->posts
WHERE post_status = 'publish'
AND post_type= 'post'
AND post_modified >= post_date + INTERVAL 5 DAY
AND post_modified >= CURDATE() - INTERVAL 2 MONTH
ORDER BY post_modified DESC
LIMIT 3";
$upd_result = $wpdb->get_results($upd_query);
if ( empty($upd_result) ) {
echo '<small>... keine aktualisierten Artikel</small>';
}
foreach ($upd_result as $updat) :
$post_modified_ger = $updat->post_modified_ger;
$posttitle = $updat->posttitle;
$postname = $updat->postname;
$postid = $updat->postid;
$post_auszug = $updat->post_auszug;
echo '<ol><li style="list-style-type:none"><div class="akt-titel"><a href="http://themenfreund.de/'.$updat->postname.'" title="'.$updat->posttitle.'">'.$updat->posttitle.'</a><h6 class="aktualisiert1">Aktualisiert am: '.$updat->post_modified_ger.'</h6></div>';
echo $updat->post_auszug.' ...</li></ol>';
endforeach;
}
Alles anzeigen
Nun möchte ich mit Hilfe der benutzerdefinierten Felder diesen Hinweis nur noch dann ausgeben lassen, wenn in einem Benutzerdefinierten Feld namens Hinweistext ja steht.
Weil so erfolgt ja eine Ausgabe auch dann, wenn nur ein Komma gesetzt wurde. Und das macht wenig Sinn.
Weiß jemand, wie ich das umsetzen kann?
Danke und Gruß
Marcus
bemerkung:
'the_excerpt()' verkuerzt keine handgeschriebenen excerpts, nur die automatisch erstellten.
Das ist des Pudels Lösung. Weil ich schreibe immer noch den Auszug per Hand. Deswegen funzt das nicht!
Alles klärchen!
Da passiert gar nichts. Es bleibt bei der gleichen Wort-Anzahl wie vorher.
Also, mein Code sieht so aus:
<h3 class="sidebar-title"><?php _e('Weitere neue Artikel',TS_DOMAIN); ?>:</h3> <?php $recent = new WP_Query("showposts=5&offset=3"); while($recent->have_posts()) : $recent->the_post();?>
<ol>
<li style="list-style-type:none">
<div class="new-article">
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</div>
</li>
</ol>
<?php add_filter('excerpt_length', 'sb_excerpt_length');
the_excerpt();
remove_filter('excerpt_length', 'sb_excerpt_length'); ?><?php endwhile; ?>
Alles anzeigen
und in der functions.php steht
Hallo zusammen!
Ich möchte die Links zu den Artikeln in meiner Sidebar mit kurzem Textauszug ergänzen. Dazu habe ich auch schon Vorschläge wie den von Tanja in meine functions.php umgesetzt. Z. B. den Code bzgl. sb_excerpt_lenth($length). Aber wordpress 'frisst' das nicht.
Egal welche Zahl ich für Length nehme, es bleibt jedes Mal beim gleichen Auszug, der wesentlich länger ist als 15 oder 10 Wörter!
Muss ich auch die Funktion new_length hinzunehmen in der functions.php?
Hallo zusammen!
Ich habe mir mit Hilfe von wptuts eine Lightbox in den Blog eingebaut.
Leider bekomme ich ex nicht in, das bei der Lightbox der Bild-Untertitel angezeigt wird. Stattdessen wird als Bildunterschrift der Name des Artikel angezeigt.
Kann mir jemand erklären, wie ich das ändern kann?
Dank im voraus!
Hallo zusammen!
Ich bekomme folgende Meldung im Frontend:
ZitatWarning: call_user_func() expects parameter 1 to be a valid callback, function 'yoko_comment' not found or invalid function name in /xxx/wp-includes/comment-template.php on line 1334
Der entsprechende Codeblock sieht so aus:
if ( !empty($args['callback']) ) {
call_user_func($args['callback'], $comment, $args, $depth);
return;
}
Die Zeile call_user_func ist die Zeile 1334.
Jemand eine Idee, wie ich den Fehler beseitigen kann?
Hallo zusammen!
Die Überschrift sagt es eigentlich schon:
Ich bekomme, wenn ich die Funktion 'Abo ohne Kommentar' von StCR klicke, eine Seite, wo header, Sidebar und Footer geladen werden aber wo das wichtigste fehlt: Eben die Möglichkeit die Kommentare zu abonnieren.
Und dabei ist es egal, ob ich die Seite in den Einstellungen mit ?page_id aufrufe, mit kommentare-abonnieren oder mit comment-subscriptions.
Die virtuelle Seite habe ich natürlich deaktiviert.
Jemand eine Idee, was da schieflaufen könnte?