Simple Links

http://wordpress.org/extend/plugins/simple-links/

The built in WordPress Links Manager has become deprecated due to many shortcomings. This plugin attempts to recreate the same concept while removing those shortcomings.

Some of the features this plugin offers:

  • Drag and Drop link ordering
  • Featured Image Style Image Attaching
  • Shortcode capabilities with a shortcode generating form
  • Additional useable Fields
  • Many Widget Options
  • Replacement of WordPress’ Links Widgets to hinder deprecation
  • Options to remove the built in Links Manager from the dashboard
  • Flexible Permissions

The outputs, admin screens, and permissions are extendable for developers familiar with using filters.

Most of the frequently asked questions can be answered by going to the “help” section in the top right corner of wordpress’ screens once the plugin is installed. It adds information to each applicable screen like, simple link settings, pages, widgets, posts, etc.

 

Shortcodes

You Can add a Simple Links List anywhere on the site by using the shortcode [simple-links]

Supported Options:
category = “Comma separated list of Link Category Names” – defaults to all
orderby = “Name or Random” – defaults to link order
order = “DESC or ASC” – defaults to ASC
count = “Number of links to show”
show_image = “true or false” – to show the link’s image or not
image_size = “Any size built into WordPress or your theme” – default to thumbnail
fields = “Comma separated list of the Link’s Additional Fields to show”
description = “true or false” – to show the description – defaults to false
separator = “And characters to display between fields and description” – defaults to “-”
id = “An optional id for the outputed list”

e.g. [simple-links show_image="true" image_size="medium" count="12"]
Look for the puzzle button on the post and page content editors for a form that generates the shortcode for you

 

Widgets

You May Add as Many Simple Links Widgets as You Would Like to Your Widget Areas

Widget Options:
Categories = “Select with link categories to pull from”
Order Links By = “The Order in Which the Links will Display” – defaults to link order
Order = “The Order in which the links will Display”
Show Description = “Display the Link’s Description
Number of LInks = “Number of links to show”
Show Image = “Check the box to display the Link’s Image
Image Size = “The Size of Image to Show if the previous box is checked
Include Additional Fields = “Display values from the Link’s Additional Fields”
Field Separator = “And characters to display between fields and description”

 

Developer Docs

Internationalization

This plugin has support for internationalization translations. However it does not come built in with the different languages. If you wish to help out by translating this plugin, you may find the .pot file in the languages folder of the plugin. Please send me your .mo translation files and I will add them to the plugin.

For now if you are familiar with using the ‘load_plugin_textdomain()‘, hook you may use it with the domain ‘simple-links‘ to use your translations. Uploading a complete .mo file to the languages folder of the plugin will work the same way, however it will be deleted when you update the plugin unless you already sent it to me and I have added it.

 

This plugin is highly extendable using WordPress’ filter api. Although the names are pretty self explanatory, I will briefly describe them.

Supported Filters

simple-link-ordering-cap
Used to change the capability required to view the link ordering page. There is an option to change this in the settings to hide the link ordering from editors, but for more refined control use this filter.
Accepts 1 argument ( name of capability needed to see the page )
add_filter('simple-link-ordering-cap','change_permission');
function change_permission( $cap ){
       return 'edit-posts';
}

 

simple-link-settings-cap
Used to change the capability required to view the settings page. There is an option to change this in the settings to show the settings page to editors, but for more refined control use this filter.
Accepts 1 argument ( name of capability needed to see the page )

add_filter('simple-link-settings-cap','change_permission');
function change_permission( $cap ){
       return 'edit-posts';
}
simple_links_shortcode_atts
Used to change the shortcode attributes before the list is generated. This will override any attributes added within the shortcode tag. Accepts 1 argument ( array of existing attributes ).
Can target a specific shortcode by added the “id” to the end of the filter name. For example if you added an id=’my_id’ to the shortcode, you could target it with this filter by calling the
simple_links_shortcode_atts_my_id
filter. Otherwise this will target all shortcodes.
add_filter('simple_links_shortcode_atts','change_shortcode_atts');
function change_shortcode_atts( array $atts ){
      $atts['id'] = 'new_id';
    return $atts;
}
simple_links_shortcode_output
Used to edit the output or work with the object created by the shortcode. This will override the output of the shortcode.
Accepts 3 arguments:
  1. The output generated by shortcode
  2. The complete object of all the retrieved links and all data connected with the links.
  3. The array of attributes sent with the shortcode or filtered with an above filter
Can target a specific shortcode by added the “id” to the end of the filter name. For example if you added an id=’my_id’ to the shortcode, you could target it with this filter by calling the
simple_links_shortcode_output_my_id
filter. Otherwise this will target all shortcodes.
add_filter('simple_links_shortcode_output','change_shortcode_output', 0 , 3);
function change_shortcode_output( $output, $links_object, $atts ){
     return $output;
}
simple_links_meta_boxes
Used to add or remove meta boxes from the link editing screens. You may add additional fields on the links in the settings page, so this may be excessive.
Accepts 1 argument ( an array of meta box names ). You must return an array with this or there will be no meta boxes on the link editing screen.
add_filter('simple_links_meta_boxes','change_meta_boxes');
function change_meta_boxes( array $meta_boxes ){
        $meta_boxes[] = 'Custom Meta Box';
     return $meta_boxes;
}
simple_links_meta_descriptions
Used to change the descriptions for existing or new meta boxes in the link editing screens.
Accepts 1 argument ( an array of descriptions with the keys matching the meta boxes name )
add_filter('simple_links_meta_boxes','change_meta_boxes_desc');
function change_meta_boxes_desc( array $meta_boxes_desc ){
       $meta_boxes_desc['Custom Meta Box'] = 'I'm a description that will show up in the new Custom Meta Box';
     return $meta_boxes_desc;
}
simple_links_widget_args
Used to change the standard arguments the Simple Link Widgets will get like $args['before_widget'].
Accepts 1 argument( array of the widget’s args ).
Can target a specific widget by added the “id” to the end of the filter name. For example if the widgets id is “simple-links-3″, you could target it with this filter by calling the
simple_links_widget_args_simple-links-3
filter. Otherwise this will target all Simple Links Widgets.
add_filter('simple_links_widget_args','change_widget_args');
function change_widget_args( array $args ){
   $args['before_widget'] = '"custom-widget-wrap"'; 
return $args; }
simple_links_widget_settings
Used to change the settings from the user form.
Accepts 1 argument( array of the widget’s settings ).
Can target a specific widget by added the “id” to the end of the filter name. For example if the widgets id is “simple-links-3″, you could target it with this filter by calling the
simple_links_widget_settings_simple-links-3
filter. Otherwise this will target all Simple Links Widgets.
add_filter('simple_links_widget_settings','change_widget_settings');
function change_widget_settings( array $settings ){
     $settings['title'] = 'A New Title';
       return $settings;
}
simple_links_widget_output
Used to edit the output or work the object created by the widget. This will override the output of the widget.
Accepts 4 arguments:
  1. The output generated by widget
  2. The complete object of all the retrieved links and all data connected with the links.
  3. The array of widget arguments either standard or filtered using the filter above.
  4. The array of settings sent from the user form or filtered with an above filter
Can target a specific widget by added the “id” to the end of the filter name. For example if the widgets id is “simple-links-3″, you could target it with this filter by calling the
simple_links_shortcode_output_simple-links-3
filter. Otherwise this will target all Simple Links Widgets.
add_filter('simple_links_widget_output','change_widget_output', 0 , 4);
function change_widget_output( $output, $links_object, $instance, $args ){
      return $output;
}

Since Version 1.7.0

 

simple_links_widget_links_object
Since version 1.7.0
Used to alter the widget’s link object directly after retrieval from the database. For special Ordering and such.
Accepts 3 arguments:
  1. The complete object of all the retrieved links.
  2. The array of widget arguments either standard or filtered using the filter above.
  3. The array of settings sent from the user form or filtered with an above filter
Can target a specific widget by adding the “id” to the end of the filter name. For example if the widgets id is “simple-links-3″, you could target it with this filter by calling the
simple_links_widget_links_object_simple-links-3
filter. Otherwise this will target all Simple Links Widgets.
add_filter('simple_links_widget_links_object','change_links_order', 0 , 4);
function change_links_order( $links_object, $instance, $args ){
 return $output; 
}

 

simple_links_shortcode_links_object
Since version 1.7.0
Used to alter the shortcode’s link object directly after retrieval from the database. For special Ordering and such.
Accepts 2 arguments:
  1. The complete object of all the retrieved links.
  2. The array of the shortcode attributes.
Can target a specific shortcode by adding the “id” to the end of the filter name. For example if you added an id=’my_id’ to the shortcode?you could target it with this filter by calling the
simple_links_shortcode_links_object_my_id
filter. Otherwise this will target all Simple Links shortcodes.
add_filter('simple_links_shortcode_links_object','change_links_order', 0 , 2);
function change_links_order( $links_object, $atts ){
 return $output; 
}

 

Since Version 1.8.0

 

simple_links_widget_link_output

Since version 1.8.0
Used to alter the output of each widget link directly

Accepts 6 arguments:
  1. The original html output of the link.
  2. Array of the links meta data.
  3. The links post object
  4. Html of the links image
  5. Array of the widgets instance
  6. Array of the widgets args
Can target a specific widget by adding the “id” to the end of the filter name. For example if the widgets id is “simple-links-3″, you could target it with this filter by calling the
simple_links_widget_link_output_simple-links-3
filter. Otherwise this will target all Simple Links Widgets.
add_filter( 'simple_links_widget_link_output', 'sl_change_link_output', 1, 4);
function sl_change_link_output( $link_output, $meta, $link, $image ){
return $link_output;
}

simple_links_shortcode_link_output
Since version 1.8.0
Used to alter the output of each shortcode link directly

Accepts 5 arguments:
  1. The original html output of the link.
  2. Array of the links meta data.
  3. The links post object
  4. Html of the links image
  5. Array of the shortcode attributes
Can target a specific shortcode by adding the “id” to the end of the filter name. For example if you added an id=’my_id’ to the shortcode, you could target it with this filter by calling the
simple_links_shortcode_link_output_my_id
filter. Otherwise this will target all Simple Links shortcodes.
add_filter( 'simple_links_shortcode_link_outputt', 'sl_change_link_output', 1, 4);
function sl_change_link_output( $link_output, $meta, $link, $image ){
return $link_output;
}