Zurück   WordPress Deutschland Forum > Support > Plugins und Widgets

Antwort
 
Themen-Optionen Ansicht
Alt 29.05.2008, 19:13   #1 (permalink)
PostRank: 8
 
Registriert seit: 31.03.2006
Beiträge: 877
Plugins bzw. WP-Funktionen zum Thema Blogroll gesucht

Hallo alle zusammen,

seit Stunden suche ich nach Plugins mit denen ich die Links (Blogroll) ausgeben kann, wobei nicht die Blogeschreibung, sondern die Notizen (das Textfeld) ausgegeben werden soll.
Ganz besonders toll wäre es, wenn man es so einstellen könnte, dass es die Beschreibung ausgibt, wenn in dem Feld Notizen nichts drin steht.
Gibt es ein solches Plugin?
Gibt es überhaupt Plugins für den Blogroll?
Gibt es vielleicht irgendwo eine Auflistung der WP-Funktionen (nicht nur Template-Funktionen), die sich mit dem Blogroll beschäftigen?

Vielen Dank im Voraus für Eure Hilfe.

VG Elke
__________________
http://v-portal.org und http://u-portal.de
redcat63 ist offline   Mit Zitat antworten
Alt 30.05.2008, 11:51   #2 (permalink)
PostRank: 9
 
Benutzerbild von Ammaletu
 
Registriert seit: 14.07.2007
Beiträge: 1.427
Hallo!

Also ich habe für meine Linkseite einfach die internen WP-Funktionen (Stand Wp 2.3.3) in meine functions.php kopiert und hier und da etwas angepasst. Ich weiß jetzt gerade gar nicht, was ich an der get_links-Funktion verändert hatte. Anyway, schau Dir den Code mal an, vielleicht kannst Du ihn ja brauchen. Dass statt der notes die description ausgegeben wird, wenn keine notes da sind, kann man mit einer Zeile noch ergänzen.

Noch mal für alle: Das folgende ist Stand WP 2.3.3. Kann sein, dass man es für WP 2.5 anpassen müsste bzw. dass die Methoden intern in 2.5 verändert wurden (Fehler behoben, besser gemacht etc.).

PHP-Code:
/**
 * Outputs a list of all links, listed by category, using the settings in
 * $wpdb->linkcategories and output it as a nested HTML unordered list.
 * Differences to the WP function: Outputs h3 instead of h2, outputs the count
 * of links behind the category name.
 * 
 * @param order Defines how to sort the link categories. Possible values are
 * 'name' and 'id'. Optional, defaults to 'name'. Use '_name' or '_id' to
 * reverse the sort direction.
 * @param cats A list of categories. If not provided, all link categories will
 * be retrieved from the database, omitting empty categories.
 * @return The overall count of displayed links.
 */
function dor_get_links_list($order 'name'$cats) {
  
/* String */ $links           null;
  
/* String */ $baseIndentation '          ';
  
/* int    */ $linkCount       0;
  
/* int    */ $countAll        0;
  
  
// handle the order by and the sort direction parameters
  
$order strtolower($order);
  
$direction 'ASC';
  if (
substr($order01) === '_') {
    
$direction 'DESC';
    
$order substr($order1);
  }
  if (!isset(
$direction)) {
    
$direction '';
  }
  
  
// get the link categories (omitting empty categories)
  
if ($cats == null) {
    
$cats get_categories("type=link&orderby=$order&order=$direction");
  }
  
  
// display the categories
  
if ($cats) {
    foreach ((array) 
$cats as $category) {
      
// get the links for the category and count them
      
$links dor_get_links($category->cat_ID"\n" $baseIndentation '        'true'name'true, -1false);
      
$linkCount substr_count($links'<a href');
      
$countAll += $linkCount;
      if (
$linkCount 1) {
        continue;
      }
      
      
// display the category name
      
echo '<li id="linkcat-' $category->cat_ID '" class="linkcat"><h3>' $category->cat_name
           
' <span class="count">(' $linkCount ")</span></h3>\n$baseIndentation    <ul>\n";
      
      
// display the links
      
echo $links;
      
      
// close the category
      
echo "\n$baseIndentation    </ul>\n$baseIndentation  </li>\n";
    } 
/* end foreach category */
  
/* end if categories */
  
  // return the overall link count
  
return $countAll;
}


/**
 * Gets the links associated with the given category.
 * 
 * @param category The category to use. If no category is supplied, the
 * function gets links for all categories.
 * @param between String to output between elements within the list element
 * (between link and notes, notes and update time).
 * @param show_images True to show link images (if defined), false to not show
 * images.
 * @param orderby The order to output the links, e.g. 'id', 'name', 'url',
 * 'description', or 'rating'. Or maybe owner. If you start the name with an
 * underscore, the order will be reversed. You can also specify 'rand' as the
 * order which will return links in a random order.
 * @param show_notes Whether to show the notes.
 * @param limit Limit to X links. If not specified, all links are shown.
 * @param echo Whether to echo the results, or return them instead.
 * @return The html to output if echo is true.
 */
function dor_get_links($category = -1,
                       
$between ' ',
                       
$show_images true,
                       
$orderby 'name',
                       
$show_notes true,
                       
$limit = -1,
                       
$echo true) {
  global 
$wpdb;
  
  
// initialize parameters
  
$order 'ASC';
  if (
substr($orderby01) == '_') {
    
$order 'DESC';
    
$orderby substr($orderby1);
  }
  if (
$category == -1) { //get_bookmarks uses '' to signify all categories
    
$category '';
  }
  
  
// get the links
  
$results get_bookmarks("category=$category&orderby=$orderby&order=$order&show_updated=0&limit=$limit");
  if (!
$results) {
    return;
  }
  
  
// build the output
  
$output '';
  foreach ((array) 
$results as $row) {
    
// get link data
    
$the_link '#';
    if (!empty(
$row->link_url)) {
      
$the_link clean_url($row->link_url);
    }
    
$rel $row->link_rel;
    if (
$rel != '') {
      
$rel ' rel="' $rel '"';
    }
    
$desc attribute_escape($row->link_description);
    
$name attribute_escape($row->link_name);
    
$notes attribute_escape($row->link_notes);
    
$title $desc;
    if (
$title != '') {
      
$title ' title="' $title '"';
    }
    
$alt ' alt="' $name '"';
    
$target $row->link_target;
    if (
$target != '') {
      
$target ' target="' $target '"';
    }
    
    
// output the link itself
    
$output .= '                <li id="link' $row->link_id '">'
               
'<a href="' $the_link '"' $rel $title $target'>';
    if ((
$row->link_image != null) && $show_images) {
      if (
strpos($row->link_image'http') !== false) {
        
$output .= "<img src=\"$row->link_image\" $alt $title />";
      } else { 
// if it's a relative path
        
$output .= "<img src=\"" get_option('siteurl') . "$row->link_image\" $alt $title />";
      }
    } else {
      
$output .= $name;
    }
    
$output .= '</a>';
    
    
// output the description
    
if ($show_notes && ($notes != '')) {
      
$output .= $between '<span class="linkDescription">' $notes '</span>';
    }
    
    
$output .= "                </li>\n";
  } 
/* end foreach link */
  
  // echo or return the output
  
if (!$echo) {
    return 
$output;
  }
  echo 
$output;

__________________
"Life brings hope and pain, but revenge never brings redemption." || Mein Blog
Ammaletu ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist aus.
HTML-Code ist aus.
Trackbacks are aus
Pingbacks are aus
Refbacks are aus


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:08 Uhr.


Powered by vBulletin® Version 3.7.4 (Deutsch)
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 | Impressum | Ein Inpsyde.com Projekt