Support » Plugins » php script need to assign a css class

  • Resolved oldbag66


    Hi, this script show a widget in a side bar but i want to style the link it produces, im not sure if im right but im guessing the attached script is what produces this, can anyone tell me where i can add “class” to?

    ### New Download Widget
      function widget_dm_new_download($args) {
        $settings = get_option('widget_dm_new_download');
        $title = $settings['title'];
        echo $before_widget.$before_title.$title.$after_title;
        dm_get_new_download('<li>', '</li>', $settings['limit'], $settings['avarage'], $settings['category']);
        echo $after_widget;
      function widget_dm_new_download_settings() {
        $settings = get_option('widget_dm_new_download');
    		if (!is_array($settings))
    			$settings = array('title' => __('New Downloads', 'downloads-manager'), 'limit' => 10, 'avarage' => false, 'category' => false);
        if ($_POST['new_download_widgets_update']) {
    			$settings['title'] = strip_tags(addslashes($_POST['new_download_widgets_title']));
    			$settings['limit'] = intval($_POST['new_download_widgets_limit']);
    			$settings['avarage'] = $_POST['new_download_widgets_avarage'];
          $settings['category'] = $_POST['new_download_widgets_category'];
    			update_option('widget_dm_new_download', $settings);
        $checked = $settings['category'] ? 'checked' : '';
        echo '<p><label>'.__('Title', 'downloads-manager').': <input type="text" name="new_download_widgets_title" value="'.htmlspecialchars(stripslashes($settings['title'])).'"></label></p>';
        echo '<p><label>'.__('Limit', 'downloads-manager').': <input type="text" name="new_download_widgets_limit" value="'.stripslashes($settings['limit']).'"></label></p>';
        echo '<p>'.__('Show Category', 'downloads-manager').': <input type="checkbox" name="new_download_widgets_category" value="true" '.$checked.'></p>';
        $checked = $settings['avarage'] ? 'checked' : '';
        echo '<p>'.__('Show Avarage', 'downloads-manager').': <input type="checkbox" name="new_download_widgets_avarage" value="true" '.$checked.'></p>';
        echo '<input type="hidden" id="new_download_widgets_update" name="new_download_widgets_update" value="1" />';
      register_sidebar_widget(__('Most Downloaded', 'downloads-manager'), 'widget_dm_top10', 1);
      register_widget_control(__('Most Downloaded', 'downloads-manager'), 'widget_dm_top10_settings', 400, 200);
      register_sidebar_widget(__('New Downloads', 'downloads-manager'), 'widget_dm_new_download', 1);
      register_widget_control(__('New Downloads', 'downloads-manager'), 'widget_dm_new_download_settings', 400, 200);

Viewing 4 replies - 1 through 4 (of 4 total)
  • …or even just add some styling within the php script.


    The link is created here:

    dm_get_new_download('<li>', '</li>', $settings['limit'], $settings['avarage'], $settings['category']);

    which is apparently a plugin function.

    However, you could always just use some specific CSS selectors to identify the a elements you want to style, such as

    div.widget-download li a {

    Hopefully the xhtml generated by that widget already has some unique classes that you can use in your stylesheet. Then you wouldn’t have to mess with the code.

    thanks, ill try the css option and see how it goes.

    great thanks, i viewed the page as source html to see the classes/id generated then used those to style it!

    nice and easy after all, thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘php script need to assign a css class’ is closed to new replies.