snipt

Ctrl+h for KB shortcuts

Text only

Ajouter un widget au tableau de bord WordPress

function monwidget_dashboard_widget_function() {
        echo ('Ajoutez ici votre contenu texte et HTML');
} 

function outils_add_dashboard_widgets() {
	wp_add_dashboard_widget('monwidget_dashboard_widget', 'Ajoutez ici le titre de votre widget', 'monwidget_dashboard_widget_function');
}

add_action('wp_dashboard_setup', 'monwidget_add_dashboard_widgets' );
}
https://snipt.net/embed/a3ea27fcc1231def669e0c51bde4b813/
/raw/a3ea27fcc1231def669e0c51bde4b813/
a3ea27fcc1231def669e0c51bde4b813
text
Text only
10
2019-08-17T21:15:19
True
False
False
/api/public/snipt/50169/
ajouter-un-widget-au-tableau-de-bord-wordpress
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1"> 1</a> <a href="#L-2"> 2</a> <a href="#L-3"> 3</a> <a href="#L-4"> 4</a> <a href="#L-5"> 5</a> <a href="#L-6"> 6</a> <a href="#L-7"> 7</a> <a href="#L-8"> 8</a> <a href="#L-9"> 9</a> <a href="#L-10">10</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>function monwidget_dashboard_widget_function() { </span><span id="L-2"><a name="L-2"></a> echo (&#39;Ajoutez ici votre contenu texte et HTML&#39;); </span><span id="L-3"><a name="L-3"></a>} </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>function outils_add_dashboard_widgets() { </span><span id="L-6"><a name="L-6"></a> wp_add_dashboard_widget(&#39;monwidget_dashboard_widget&#39;, &#39;Ajoutez ici le titre de votre widget&#39;, &#39;monwidget_dashboard_widget_function&#39;); </span><span id="L-7"><a name="L-7"></a>} </span><span id="L-8"><a name="L-8"></a> </span><span id="L-9"><a name="L-9"></a>add_action(&#39;wp_dashboard_setup&#39;, &#39;monwidget_add_dashboard_widgets&#39; ); </span><span id="L-10"><a name="L-10"></a>} </span></pre></div> </td></tr></table>
php, wordpress