Yannick's Corner

WordPress Plugins, Plugin Development Cookbook and random thoughts

Link Library FAQ

Introduction to Link Library

Creating link categories

Welcome to the world of Link Library. At this point, I assume that you have successfully installed and activated the plugin in your WordPress installation.

When activated, Link Library adds a number of elements to the WordPress administration pages:

  • A Links menu at the top of the admin menu
  • A Link Library menu section towards the bottom of the admin menu
  • An extra widget on the admin Dashboard

The Links Menu

The Links Menu is actually a legacy component of WordPress. Up to version 3.5, this menu was available on all installations of WordPress. After this version, the link management functionality of WordPress is now disabled by default, but its code remains in the tool’s code base.

Link Library includes code that reactivates this functionality, allowing users to access the All LinksAdd New link menu and Link Categories menu item.

LinksMenu

Creating Categories

To function properly, Link Library needs one of more link categories to be defined. Until this is done, it will display a message at the top of the admin section as a reminder that this must be done.

NoLinkCategories

To create link categories:

  1. Visit the Link Categories section under the Links menu.
  2. Specify a Name for the Category
  3. Optionally, set the SlugDescription
  4. Do NOT specify a Category Link for the moment. This will be covered in more advanced sections.
  5. Click on Add New Link Category to save the new item

The warning to create categories should disappear. If it does not go away immediately, click your browser’s refresh button.

Categories

Creating Links

Once you have categories in place, you can use the Add New links under the Links section to start creating links.

The only required fields for link creation are:

  • Name
  • Web Address
  • Categories

Categories

For the Categories field, WordPress allows you to assign one or more categories to a link, if you select multiple categories, the link you create will appear multiple times in your link display, under each of the categories that it is assigned.

Images

Images can be assigned using a number of techniques when creating links

  • Assigning image URL in Image Address field
    • Located towards the bottom of the link creation form
    • Simple field where you can enter the URL of the image to be associated with the link you are creating or editing.
  • Using Media Uploader
    • Clicking button launched Media Uploader
    • User can select existing image or upload new one
    • After selecting image, link must be saved or updated for image address to be stored
  • Automatic Image Generation
    • Can be triggered after first saving a link and editing it
    • Can generate a thumbnail or capture the site favicon and store locally
    • Must have selected thumbnail generation service in General Settings

Example

In the following example, two links were created and each one was associated with one of the link categories that were available in the system.

AllLinks

Inserting a basic list of links

Link Library provides a set of shortcodes that users can insert in their posts and pages to display lists of links. Shortcodes are simple blocks of text, enclosed in square brackets.

The main shortcode for Link Library is simply [link-library]. You can either type the shortcode manually right in the content editor, or use the Add Link Library Shortcode dialog that can launched using the button right above the editor.

LinkLibraryShortcode

Example

The following link library display was created by saving the page shown above, only containing the [link-library] shortcode. It displays the names of the two categories that were created earlier, along with the links belonging to each category underneath.

FirstLinkLibraryExample

The (Edit) links that appear next to each link allow you to directly edit them in the link editor page. These links are only shown when you are logged in as a user who has permissions to modify links.

Inserting a list of categories

Similar to the [link-library], the [link-library-cats] can be inserted in any page or post to display a list of link categories. This shortcode is most often used to display a list of categories at the top of a page above a long list of link categories and their respective links. Category names appearing in the top table are links that will make the page scroll down to the selected categories, for quick navigation.

LinksWithCategories

Entering the two shortcodes as shown above results in the following display on the page where they are used.

WARNING: You should be careful to have at least one space of line return between the two shortcodes. If they are immediately next to each other, they will likely not work correctly.

LinksWithCatTable

It should be noted that the table for links only has very light styling defined by Link Library, so that it will fit well with your page design. In the example above, all tables in the theme used are set to have centered content and show alternating table row colors. In the example below, taken from a site running the TwentyFifteen theme, the table is much simpler.

LinksWithCatTabletwentyFifteen

Inserting a search box

Inserting a search box will allow you to provide a way for visitors to search within your library of links. Unfortunately, links are not searchable using the WordPress built-in search engine, hence the need to use this separate search box.

The shortcode to use to include a search box on a page is [link-library-search].

WARNING: You should be careful to have at least one space of line return between the two shortcodes. If they are immediately next to each other, they will likely not work correctly.

After saving the page content with the new shortcode, you will see a search box appear, as shown in the following image.

LinksWithSearchBox

If you type keywords in the box and press the Search button, you will see the results of the search, displayed in the same layout. However, the list of category names will be hidden by default on the results page. Also, link categories that do not contain any links that match the search string will not be displayed either.

SearchResults

Inserting user-submission form

<Coming soon>

Tutorial videos

Customizing the layout

Category selection

If you have created many links under multiple link categories, you might not want to display all of these categories on the same page on your site. Link Library provides a number of options to be able to select the categories to be displayed.

Shortcode parameters

The [link-library] and [link-library-cats] shortcodes have a number of parameters that can be used to tailor the output that they will generate. For category selection, the shortcodes of interest are as follows:

Parameter Functionality Example
categorylistoverride Can be used to select the categories to be displayed, in the form of a comma-separated list of category ID [link-library categorylistoverride="1,3,7"]
[link-library-cats categorylistoverride="1,3,7"]
excludecategoryoverride Specifies the categories that should not be displayed by the shortcode, in the form of a comma-separated list of category IDs [link-library excludecategoryoverride="12,14"]
[link-library-cats excludecategoryoverride="12,14"]

By using these parameters with the [link-library] and [link-library-cats] shortcode, you only need to define your library settings once for all aspects of presentation of your links, and then only select which categories appear in each place. Then, if any changes are needed, there is only one place where these changes need to be made.

The category IDs for links are not displayed by default in the WordPress administration pages. To see them easily, install a plugin to display category ID, such as Reveal IDs

Multiple libraries

A second approach to displaying lists of varying categories on different pages or posts is to create multiple library, each configured to display one or more categories. This approach can work well when you have a few groups of links to be displayed on a few pages, but it does not easily scale.

To use this approach, you must:

  1. Configure a first set of library settings to display your links as desired
  2. Go to the plugin General Options page and increase the Number of Libraries from the default value of 1, then Save Settings
  3. Go to the Library Settings page
  4. Select the Library that settings will be copied from in the Select Current Library Settings drop-down list at the top of the page
  5. Select a target library in the Copy From: drop-down list on the right-hand side
  6. Press the Copy! button to create a duplicate of the original settings
  7. Select the Categories to be displayed using the selection list in the Common tab in Library Settings
  8. Insert the [link-library] shortcode with the settings parameter to select the library that should be displayed in this location (e.g. [link-library settings='2']

The main thing to keep in mind when using this method is that any subsequent changes to the library display configuration will need to be done for each library if they are all to keep being displayed the same.

Showing one category at a time

While the category selection section shows how to select one of more categories to display on a page, this section explains how to display a list of link categories, followed by a single category at a time. To use this technique, you must first start by having the [link-library-cats] on a page, along with the [link-library] shortcode on the same page.

With this in place, you need to choose the type technique to be used to switch between categories.

AJAX Category Switching Method

Activation
  1. Under the Library Settings page, select the Common tab
  2. Check Only show one category at a time checkbox
  3. Select AJAX as Switching Method
Description

In this mode, clicking a category name in the list will refresh the list of links using AJAX. This means that only the list of links will refresh on the page, leaving everything else as is.

Pros
  • Fast refresh of links
  • Does not need to reload entire site. Especially good if there are a lot of components on page (ads, videos, etc…)
Cons
  • Navigating from one category to the next does not update the link in the address bar, making it impossible to send a link to a specific category

HTML GET, HTML GET with slugs and HTML GET with category names Switching Methods

Activation
  1. Under the Library Settings page, select the Common tab
  2. Check Only show one category at a time checkbox
  3. Select HTML GETHTML GET using slugs or HTML GET using category names as Switching Method
Description

In this mode, clicking a category name will visit a new page, with the page URL containing the numeric ID of the category to be visited. This means that the entire site will get reloaded as a visitor navigates the various categories available. Depending on the switching method, links will look as follows:

Options Example URL
HTML GET http://test.nayanna.biz/links/?cat_id=2
HTML GET with slugs http://test.nayanna.biz/links/?cat=podcasts
HTML GET with category names http://test.nayanna.biz/links/?catname=Podcasts

Note that the difference between the last two is subtle in this example, but could be quite different if slugs are manually modified by the site admin.

HTML GET + Permalink

Activation
  1. Under the Library Settings page, select the Common tab
  2. Check Only show one category at a time checkbox
  3. Set the Switching Method to HTML GET + Permalink
  4. Check Enable Permalinks
  5. Enter the URL of the links page (e.g. ‘links’), in the Permalinks Page field
  6. Save Settings
  7. Go to Settings | Permalinks
  8. Save your Permalinks settings
Description

Using Permalinks is the most complex setup that can be put in place to view different categories of links. That being said, it also allows users to have the cleanest links. When using this method, your links will look like:

http://test.nayanna.biz/links/podcasts

Category target address

By using the Category target address, located under the Categories tab of the Library Settings page, you can actually separate link categories and links onto two separate pages. The category target address should be the full http:// address of the target page.

Unordered list versus table

<Coming soon>

Link field selection and ordering

The way to select what will be displayed is to go to Library Settings section and click on the Advanced tab. There, you will see a table of all of the information that can be displayed about links.

2019-02-04 07_01_17-Link Library - Configurations ‹ Yannick's Corner — WordPress

For example, to activate the image, click on the Display checkbox next to Image. To see the description, check the display box next to Link Description.

The other fields for each row allow you to specify HTML code that will be displayed before and after the element in question. Some items like Image also have a few other configuration fields. There are tooltips in most of these fields to guide you in filling in this table.

If you want to change the order in which items are displayed (e.g. image before or after the link), you can re-order the items by drag-and-dropping the colored boxes at the top of the page and saving options.

Using category icons

To display icons next to the names of categories when using the [link-library-cats] shortcode, you need to assign the icon by setting the category description to something like this:

400px-CategoryEditor

and then make sure that the option “Show Category Description” is checked on the Categories tab of Library Settings. You can also choose if the category description will appear before or after displaying the category by using the dropdown Position selector.

800px-LinkCategoryImages

A similar configuration is available under the Links tab of Library Settings to display the category description, and any image that it may contain, next to category names when display the links.

Stylesheet editor

Hiding category names

Link ordering

Link Images and Thumbnails

Collapsing links

Advanced Features

Shortcode parameters

To override the settings specified inside of the plugin settings page, the [link-library] and [link-library-cats] commands can be called with options. Here is the syntax to call these options:

[link-library-cats categorylistoverride=”28″] Overrides the list of categories to be displayed in the category list
[link-library-cats excludecategoryoverride=”28″] Overrides the list of categories to be excluded in the category list
[link-library categorylistoverride=”28″] Overrides the list of categories to be displayed in the link list
[link-library excludecategoryoverride=”28″] Overrides the list of categories to be excluded in the link list
[link-library notesoverride=0] Set to 0 or 1 to display or not display link notes
[link-library descoverride=0] Set to 0 or 1 to display or not display link descriptions
[link-library rssoverride=0] Set to 0 or 1 to display or not display rss information
[link-library tableoverride=0] Set to 0 or 1 to display links in an unordered list or a table.

Change access for users to be able to add and edit links

Here is how you could give access to authors to add or edit links:

  1. Install and activate the User Role Editor plugin
  2. Under the Users menu, go to the User Role Editor
  3. Next to ‘Select Role and change its capabilities’, select Author
  4. Check the box labeled ‘manage_links’
  5. Click the blue Update button on the right side of the capabilities list
  6. Your authors should now have access to the link manager.

RSS Feed

To publish an RSS feed of your links, go to the RSS Feed tab of Library Settings and check the box ‘Publish RSS Feed’.

Doing this adds an extra field to your web page header that browsers will be able to key on to offer the ability to view or subscribe to the RSS Feed.

The address of the feed is going to be: http://mywebsite.com/feed/linklibraryfeed?settingsset=1

Where the number after settingsset corresponds to the library settings number. You can use this address to create a link or button for visitors to easily subscribe.

Reciprocal Links

The Reciprocal link checker is a tool that can be used to partially automate the task of looking on remote sites for a link back to your site when creating link exchanges. In these situations, you place a link on your site to a third-party web site in exchange for them placing a link back to your site on theirs.

Instructions

To use this feature, you must perform the following steps:

  • Make sure that all links that are to be checked have been assigned a Reciprocal Link in the link editor. The address in that field should indicate the address of the page where a link back to your site is expected to be found.

ReciprocalLinkEditor

  • On the Reciprocal Check page, set the Search String to the URL of your site (or any other string of text) that the checker should be looking for
  • Save settings to save the Search String
  • Click on Check Reciprocal Links button to launch check to get a report of all links, mentioning if they are properly linking back to you

ReciprocalSettings

WARNING: If you get pages reporting that they are not linking back to you when you know for a fact that they are, then you should check the address of the site and make sure that it is not getting redirected. A redirect message will throw off the check. you can verify this by entering the URL in your browser and making sure that the URL does not change before displaying the actual page. For example, if you visit ign.com, you get redirected to ca.ign.com. The address to be set in the reciprocal link field should be ca.ign.com.

Automatic deletion option

You can optionally check the option to automatically delete any site that returns a 403 error. These are sites that no longer exist or cannot be reached at the time of the check.

Using Permalinks

*** NOTICE: Before trying to use Permalinks, you need to have Permalinks enabled on your site ***

Similar to the way Permalinks work in WordPress, Link Library can support permalinks to let you create a list of link categories on one page and then display lists of links on another page, with nice URLs that show the category name. For example, mysite.com/links/first-category. In addition to getting such nice URLs, using Permalinks has the additional advantage of only requiring you to create two pages: one to list the categories and the other one to display the links. Link Library will then handle reading the category from the URL and displaying the correct category of links on the page. Follow the steps below to activate Permalink mode in Link Library.

In the Common tab of Library Settings:

  • Check the option Only show one category at a time
  • Set the Switching Method to HTML GET + Permalink
  • Check the Enable Permalinks box
  • Set the Permalinks page address (e.g. for mysite.com/links, type links in the Permalinks Page field)

Once this is done:

  • Put the [link-library-cats] shortcode on a page
  • Put the [link-library] shortcode on the page specified in the Permalinks Page field.

You should then be up and running. All categories that you click on will direct you to distinct URLs and there is only a single page created.

Support for other link types (e.g. file://)

To configure Link Library to accept types of links other than http or https links, go to the General Settings tab and look for the field called Additional Protocols. Set the value of this field to file and save options.

Importing links

Import/Export Settings

General Configuration

 

Create your website at WordPress.com
Get started
%d bloggers like this: