Hoe Widget omzetten naar recursive widgets?
-
Hallo
heb een widget plugin gemaakt en dat werkt echter deze widget mag je maar 1 keer toekennen. Het zou “recursive widget” moeten zijn maar snap niet hoe ik het aanpas
Dit is mijn code
function knoppenGenerator( ) { } // set function KGCode_widget($args) { extract($args); $options = get_option('KGCode_widget'); ?> <div class="widget_header_1"><?php echo $options['title_widget'];?> <div class="widget_header_2"><?php echo $options['text_widget'];?> <br /><br /> <div class="widget_button"> <div class="widget_button_tekst"> <a class="button_generator_1" style="text-decoration: none;" a href="<?php echo $options['uri'];?>" target="_self"> <?php echo $options['text_knop'];?> </a> </div></div> </div></div> <?php } // controlls function KGCode_control() { $options = get_option('KGCode_widget'); if (isset($_POST['KGCodeSubmit'])) { $options['title_widget'] = htmlspecialchars($_POST['widgetTitle']); $options['text_widget'] = htmlspecialchars($_POST['widgetText']); $options['text_knop'] = htmlspecialchars($_POST['widgetknop']); $options['uri'] = htmlspecialchars($_POST['widgetUri']); update_option('KGCode_widget', $options); } ?> <div class="widget-content"> <p> <label for="widgetTitle" >Title: </label> <input type="text" id="widgetTitle" name="widgetTitle" class="QPBG" value="<?php echo $options['title_widget']; ?>" /> </p> <p> <label for="widgetText">Omschrijving: </label> <input type="text" id="widgetText" name="widgetText" class="QPBG" value="<?php echo $options['text_widget']; ?>" /> </p> <p> <label for="widgetknop">Knop text: </label> <input type="text" id="widgetknop" name="widgetknop" class="QPBG" value="<?php echo $options['text_knop']; ?>" /> </p> <p> <label for="widgetUri">Url: * </label> <input type="text" id="widgetUri" name="widgetUri" class="QPBG" value="<?php echo $options['uri']; ?>" /> <br /><small>* bv /chat</small> </p> <p> <input type="hidden" id="KGCodeSubmit" name="KGCodeSubmit" value="1" /> </p> </div> <?php } // init function KGCode_init() { wp_register_sidebar_widget('KG_widget', 'Knoppen generator', 'KGCode_widget', null); wp_register_widget_control('KG_widget', 'Knoppen generator', 'KGCode_control', null, null); } add_action('plugins_loaded', 'KGCode_init');
2 reacties aan het bekijken - 1 tot 2 (van in totaal 2)
2 reacties aan het bekijken - 1 tot 2 (van in totaal 2)
- Het onderwerp ‘Hoe Widget omzetten naar recursive widgets?’ is gesloten voor nieuwe reacties.