Tag Archives: Links

WordPress Plugin Links – PHPCodezLinks

It can be used to list link categories and its links

== Description ==

PHPCodez Links lists the link categories and its links. The output can be managed from the back end

Advatages
======
1) We can restrict the number of link categories
1) We can restrict the number of links
2) We can sort links and link categories by its name or id
3) We can select categories to list

== Installation ==

1. Upload the plugin folder to your /wp-content/plugins/ folder.

2. Go to the **Plugins** page and activate the plugin.

3. Go to appearance->widget area and drag the widget “PHPCodez Links” to the widget area to have this on the sidebar .

Click here to download the plugin

Share

WordPress query to fetch links under a given category

<?php

// ‘links’ is the slug name of the link category link

$linkeQry=”SELECT * FROM wp_links as link INNER JOIN wp_term_relationships ON (link.link_id = wp_term_relationships.object_id)

INNER JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) AND wp_term_taxonomy.taxonomy = ‘link_category’

INNER JOIN {$wpdb->prefix}terms as c ON c.term_id=wp_term_taxonomy.term_id

WHERE c.slug=’links'”;

$linksData = $wpdb->get_results($linkeQry);

?>

<ul>

<?php foreach($linksData as $key=>$link) {  ?>

<li><a href=”<?php echo $link->link_url; ?>” target=”_blank”><?php echo $link->link_name; ?></a></li>

<?php } ?>

</ul>

Share