Functions/link to advanced search

The link_to_advanced_search function will create a link to your advanced search page.

Usage

<?php link_to_advanced_search(
        $text = 'Advanced Search', 
        $props = array(), 
        $uri=null
      );
?>

Arguments

  • text - (string) The string of text for the link. Default is 'Advanced Search'.
  • props - (array) An array of properties for the advanced search link. These are attributes and values for the <a> tag.
  • uri - The uri for your advanced search page. If null, the default advanced search uri (advanced-search) is used.

Examples

Changing the text of the link

By default, the link to your advanced search page will say 'Advanced Search'. If you would like to change that, simply pass the new text as the first argument to the function:

<?php echo link_to_advanced_search('More Search Options'); ?>

This will generate:

<a href="http://example.com/advanced-search/">More Search Options</a>

Adding Attributes to the Link

You can add attributes to the link, such as id or class, by passing those attributes to the props argument in an array:

<?php 
echo link_to_advanced_search(
        'Advanced Search', 
        array(
            'id' => 'advanced-search-link', 
            'class' => 'link')
            ); 
?>

This will generate:

<a href="http://example.com/advanced-search/" 
id="advanced-search-link" class="link">Advanced Search</a>

You can add any valid attribute to the link tag.