Title: Implement in Widget
Last modified: August 22, 2016

---

# Implement in Widget

 *  Resolved [Wouter Vellekoop](https://wordpress.org/support/users/dowodesign/)
 * (@dowodesign)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/implement-in-widget/)
 * Hé Man,
 * Great plugin!
 * Maybe you can help me with a problem, I’m trying to implement the code in to 
   a plugin. but I can’t get it to work. Do you have any tips?
 *     ```
       function generate_art_title($i) {
       	 	$art_title = '';
       	 	$art_ID = '';
       	 	$art_url = '';
   
       	 	if($this->wdgt_config['data_source_type'] == 'custom') {
       	 		$art_title = $this->wdgt_results[0][$i]->post_title;
       	 		$art_ID = $this->wdgt_results[0][$i]->ID;
       	 	} else {
       	 		$art_title = $this->wdgt_results[$i]->post_title;
       	 		$art_ID = $this->wdgt_results[$i]->ID;
       	 	}
   
       	 	$art_url = get_permalink($art_ID);
       	 	$art_title_short = $this->cut_text('article_title', $art_title);
   
       	 	$output = '<h3 class="gk-nsp-header"><a href="'.$art_url.'" title="'.str_replace('"','', $art_title).'">'.$art_title_short.'</a></h3>';
   
       	 	return apply_filters('gk_nsp_art_title', $output);
       	 }
       ```
   
 * I want the H3 to be replaced with the secondary title, I tried all sorts of things..
 * So something like;
 *     ```
       <h3 class="gk-nsp-header"><a href="'.$art_url.'" title="'.str_replace('"','', $secondary_title).'">'.$secondary_title.'</a></h3>
       ```
   

Viewing 1 replies (of 1 total)

 *  Plugin Author [thaikolja](https://wordpress.org/support/users/thaikolja/)
 * (@thaikolja)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/implement-in-widget/#post-5324420)
 * I’d love to help you but it’d be a lot easier if you could describe in a few 
   sentences what you’d like to do. The code excerpt is not that easy to understand
   with all that variables I can’t trace back.
 * Secondary Title only works in widgets if you deactivate the function “Only show
   in main posts” on the settings page. After that you should be able to use the
   secondary title in the widget as you’d anywhere else.

Viewing 1 replies (of 1 total)

The topic ‘Implement in Widget’ is closed to new replies.

 * ![](https://ps.w.org/secondary-title/assets/icon.svg?rev=2520363)
 * [Secondary Title](https://wordpress.org/plugins/secondary-title/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/secondary-title/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/secondary-title/)
 * [Active Topics](https://wordpress.org/support/plugin/secondary-title/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/secondary-title/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/secondary-title/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [thaikolja](https://wordpress.org/support/users/thaikolja/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/implement-in-widget/#post-5324420)
 * Status: resolved