Support » Plugin: Simple Links » customizing the widget

Viewing 7 replies - 1 through 7 (of 7 total)
  • Ok, I figured out how to modify the widget query using code like this:

    $query_args['meta_query'] = array(array( 'key' => 'state','value' => array('','arizona'),'key' => 'metro','value' => array('all','phoenix') ));

    but…

    I haven’t had much luck in modifying the widget query based on link categories. Any help would be appreciated!

    Sorry to be such a bother,

    I would also like to take all the links of a certain link category and output them on a page, but I would like to format the output into a 3 column table. Is there an easy way to use the built-in filters to accomplish this?

    Thanks

    Plugin Author Mat Lipe

    (@mat-lipe)

    Hello,
    You may select the category on the widget options to output a certain category’s links.

    To change the output into a table you may use the simple_links_widget_output filter like so.

    add_filter('simple_links_widget_output','change_widget_output', 0 , 4);
    function change_widget_output( $output, $links_object, $instance, $args ){
          return $output;
    }

    The second argument $links_object will be all the data associated with the links in that category. You may output the links however you would like using the data from that object.

    Otherwise to achieve a 3 column layout without a table you would style the default list items generated by the widget to layout that way like so

    .simple-links-list li {
    width: 30%;
    float: left;
    margin: 0;
    padding: 0;
    list-style-type: none;
    }

    Hope this helps.

    Cheers

    Hi Matt,

    Thanks for the response. So, if I already have two instances of the SL widget on my site, and I add a 3rd for this purpose, how do I specify:

    a. that the filter uses the output of the 3rd widget?
    b. to not display the 3rd widget in the sidebar?

    Thanks,
    Devin

    Plugin Author Mat Lipe

    (@mat-lipe)

    The filter supports specifying the the id of the widget for instance

    simple_links_shortcode_output_simple-links-3

    would target the widget with the id simple-links-3.

    You may have to look at the page’s output to see what the id of the specific widget you are targeting. As long as your theme is using a proper before_widget when creating your widget area, all SL widgets will have an id.

    The easiest way to remove it from the sidebar is to target it with CSS like so: Assuming your sidebar has an id of ‘sidebar’

    #sidebar #simple-links-3{
       display:none;
    }

    For now, I am just using a shortcode on a page to output the links of a certain category, which does the job. But for some reason, I can’t get your css to work on the output.

    .simple-links-list li {
    width: 30%;
    float: left;
    margin: 0;
    padding: 0;
    list-style-type: none;
    }

    never mind my last post, bad css code was breaking my stylesheet.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘customizing the widget’ is closed to new replies.