Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: link_category

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
74
75 <h2><?php _e('Blogroll Management'); ?></h2>
76 <p><?php _e('Here you <a href="link-add.php">add links</a> to sites that you visit often and share them on your blog. When you have a list of links in your sidebar to other blogs, it&#8217;s called a &#8220;blogroll.&#8221;'); ?></p>
77 <form id="cats" method="get" action="">
78 <p><?php
79 $categories = get_categories("hide_empty=1&type=link");
80 $select_cat = "<select name=\"cat_id\">\n";
81 $select_cat .= '<option value="all"'  . (($cat_id == 'all') ? " selected='selected'" : '') . '>' . __('All') . "</option>\n";
82 foreach ((array) $categories as $cat)
83      $select_cat .= '<option value="' . $cat->cat_ID . '"' . (($cat->cat_ID == $cat_id) ? " selected='selected'" : '') . '>' . wp_specialchars(apply_filters('link_category', $cat->cat_name)) . "</option>\n";
84 $select_cat .= "</select>\n";
85
86 $select_order = "<select name=\"order_by\">\n";
87 $select_order .= '<option value="order_id"' . (($order_by == 'order_id') ? " selected='selected'" : '') . '>' .  __('Link ID') . "</option>\n";
88 $select_order .= '<option value="order_name"' . (($order_by == 'order_name') ? " selected='selected'" : '') . '>' .  __('Name') . "</option>\n";
89 $select_order .= '<option value="order_url"' . (($order_by == 'order_url') ? " selected='selected'" : '') . '>' .  __('Address') . "</option>\n";
90 $select_order .= '<option value="order_rating"' . (($order_by == 'order_rating') ? " selected='selected'" : '') . '>' .  __('Rating') . "</option>\n";
91 $select_order .= "</select>\n";
92
 
Line Code
154                          break;
155                     case 'url':
156                          echo "<td><a href='$link->link_url' title='".sprintf(__('Visit %s'), $link->link_name)."'>$short_url</a></td>";
157                          break;
158                     case 'categories':
159                          ?><td><?php
160                          $cat_names = array();
161                          foreach ($link->link_category as $category) {
162                               $cat_name = get_the_category_by_ID($category);
163                               $cat_name = wp_specialchars(apply_filters('link_category', $cat_name));
164                               if ( $cat_id != $category )
165                                    $cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
166                               $cat_names[] = $cat_name;
167                          }
168                          echo implode(', ', $cat_names);
169                          ?> </td><?php
170                          break;
171                     case 'rel':
172                          ?><td><?php echo $link->link_rel; ?></td><?php