0

I'm coding my first theme. I want to have class event editable in Admin Panel as a widget. I don't know how to declare this widget in functions.php to keep my hierarchy and class names.

<div class="event">
<h2><i class="far fa-calendar-check"></i> Wydarzenia</h2>
<p><span class="date">7 lutego 2019 </span>Wywiadówka godzina 17.00</p>
</div>

In functions.php:

$args = array(
'name' => "Event",
'before_widget' => '<div class="event">',
'after_widget' => "</div>\n",
'before_title' => '<h2><i class="far fa-calendar-check"></i> ', 
'after_title' => "</h2>\n",
);
register_sidebar($args);

I don't know how to put P and SPAN inside and make it editable but if it wasn't possible, could you tell me how to do it? I want an effect like on the pic, but it's coded manually and is not editable in Admin Panel

pic1

Here, I want to have '7 lutego 2019' as individual input like Title. pic2

  • Hi welcome to SE: Wordpress development. A good starting point to build a custom widget is the Theme Handbook on wordpress.org. – user141080 Feb 17 at 16:15
  • @user141080 hmm, I don't even know how I missed that topic in handbook, after few minutes everything works as I want. Thank you! – Bartłomiej Fornalczyk Feb 17 at 22:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.