Title: args for simple_links_widget_args
Last modified: August 22, 2016

---

# args for simple_links_widget_args

 *  Resolved [jeremy2805](https://wordpress.org/support/users/jeremy2805/)
 * (@jeremy2805)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/args-for-simple_links_widget_args/)
 * Hello,
 * I’m trying to do two things and struggling on both. Or rather, I can probably
   do it, but the wrong way, so I’d appreciate a bit of advice….
 * I’ve setup a repeating field using ACF for posts to point to one or more simple
   links. I want to show those specific simple links entries on the sidebar using
   the widget.
 * So…in sl_links_main I can see that maybe I should be using the simple_links_widget_args
   filter, but I can’t see how to specify an array of IDs in the args?
 * Also, I need to tinker with the link output displayed in the widget (just add
   a button). If I try to do so using the simple_links_widget_output hook, it looks
   like I have to rewrite the whole $links->output() method. I reckon I’m doing 
   that bit wrong?
 * Any pointers would be very welcome.
 * Many thanks.
 * [https://wordpress.org/plugins/simple-links/](https://wordpress.org/plugins/simple-links/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [jeremy2805](https://wordpress.org/support/users/jeremy2805/)
 * (@jeremy2805)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/args-for-simple_links_widget_args/#post-5756046)
 * Probably not the best way of doing what I wanted but without advice, the best
   I could come up with. The plugin could certainly do with some additional hooks…
 * `add_filter(‘simple_links_widget_output’,’change_widget_output’, 0 , 4);
    function
   change_widget_output( $output, $links_object, $instance, $args ){ global $post;
   $dinocompanies = get_field( ‘linked_companies’, $post->ID );
 *  $dinosintersect = array_intersect_key ( $links_object->links , $dinocompanies);
   
   $links_object->links = $dinosintersect;
 *  if (count($links_object->links)) {
    $dinooutput .= sprintf( ‘<h4 class=”simple-
   links-title”>%s</h4>’, ‘We recommend’ ); }
 *  $dinooutput .= $links_object->output();
 *  foreach ($links_object->links as $dinolink) {
    $needle = ‘showlistingbutton”
   >’; $newneedle = ‘showlistingbtn”>web_address. ‘” target=”_blank”>’; $pos = strpos(
   $dinooutput,$needle); if ($pos !== false) { $newstring = substr_replace($dinooutput,
   $newneedle,$pos,strlen($needle)); $dinooutput = $newstring; } } return $dinooutput;}

Viewing 1 replies (of 1 total)

The topic ‘args for simple_links_widget_args’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simple-links_3d6e81.svg)
 * [Simple Links](https://wordpress.org/plugins/simple-links/)
 * [Support Threads](https://wordpress.org/support/plugin/simple-links/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-links/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-links/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-links/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [jeremy2805](https://wordpress.org/support/users/jeremy2805/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/args-for-simple_links_widget_args/#post-5756046)
 * Status: resolved