Title: Hyperlink Inside of Array
Last modified: August 20, 2016

---

# Hyperlink Inside of Array

 *  Resolved [tapkid113](https://wordpress.org/support/users/tapkid113/)
 * (@tapkid113)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/hyperlink-inside-of-array/)
 * Hello,
 * I’m in the middle of editing the WP Nivo Slider plugin (the free one) to customize
   the title. I am having the following problem, though:
    I want to link the title
   that is inside of $thumb_attr array, but I can’t seem to figure it out. :/ I 
   don’t know much about PHP, so I am fumbling my way through this.
 * The code for the plugin is as follows:
 *     ```
       <div id="slider">
       <?php
       	$category = get_option('wpns_category');
       	$n_slices = get_option('wpns_slices');
       ?>
       <?php query_posts( 'cat='.$category.'&posts_per_page='.$n_slices.'' ); if( have_posts() ) : while( 
   
       have_posts() ) : the_post(); ?>
       	<?php if(has_post_thumbnail()) : ?>
       	<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
       		<?php $thumb_attr = array(
       				'title' => '<h3>' . '<a href="THIS IS WHERE LINK SHOULD GO">' . get_the_title() . '</a>' . '</h3>' . '<h4>' . get_the_excerpt() . '</h4>'
       		); ?>
       		<?php the_post_thumbnail('featured-thumbnail', $thumb_attr );  ?>
       </a>
       	<?php endif ?>
       	<?php endwhile; endif;?>
       	<?php wp_reset_query();?>
       </div>
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [tapkid113](https://wordpress.org/support/users/tapkid113/)
 * (@tapkid113)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/hyperlink-inside-of-array/#post-2213368)
 * I should have mentioned this above, but using `<a href="<?php the_permalink();?
   >">` didn’t work. I figured that was because the code is already inside of a `
   <?php ?>` tag, though.
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/hyperlink-inside-of-array/#post-2213402)
 * instead `the_permalink()` [http://codex.wordpress.org/Function_Reference/the_permalink](http://codex.wordpress.org/Function_Reference/the_permalink)
 * you would need to use `get_permalink()`
    [http://codex.wordpress.org/Function_Reference/get_permalink](http://codex.wordpress.org/Function_Reference/get_permalink)
   to use the permalink in a string;
 * example:
 *     ```
       <?php $thumb_attr = array(
       				'title' => '<h3>' . '<a href="' . get_permalink($post->ID) . '">' . get_the_title() . '</a>' . '</h3>' . '<h4>' . get_the_excerpt() . '</h4>'
       		); ?>
       ```
   
 * in wordpress, for functions starting with `the_` ,there are often equivalent 
   functions to return a string, starting with `get_` or `get_the_` .
 *  Thread Starter [tapkid113](https://wordpress.org/support/users/tapkid113/)
 * (@tapkid113)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/hyperlink-inside-of-array/#post-2213407)
 * That worked perfect!
 * Thank you so much!!!!! 😀

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Hyperlink Inside of Array’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [get_permalink](https://wordpress.org/support/topic-tag/get_permalink/)
 * [nivo](https://wordpress.org/support/topic-tag/nivo/)

 * 3 replies
 * 2 participants
 * Last reply from: [tapkid113](https://wordpress.org/support/users/tapkid113/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/hyperlink-inside-of-array/#post-2213407)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
