• Resolved konti

    (@konti)


    Hello, is possible to add description to widget? I need to make a widget which will show actually event and two-three next, but with descriptions. By shortcode I cant use it as I want, only with widget but there is no option to show description. Is any way to add this feature?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor motopress

    (@motopress)

    Hi @konti,
    Thank you for your question and accept apologies for a delay. You can get this done by overriding plugin template files. For example you can add the code below:

    <p class="event-description">
        <?php echo $event->description ?>
    </p>

    to the following file overriding it within your theme folder
    \wp-content\plugins\mp-timetable\templates\theme\widget-upcoming-view.php

    • This reply was modified 6 years, 5 months ago by motopress.
    Thread Starter konti

    (@konti)

    Thank you for your answer, working perfectly. But I have another question and would be fantastic if You could help me. I have idea to make this description on hover with tooltip on “Info” word. But in same time, If there will be no description, I dont want to have this “Info” word. My code looks like this:

    <div class=”info”><i class=”fa fa-info-circle”></i> Info
    <p class=”description”>
    <?php echo $event->description ?>
    </p></div>

    I added css to classes and tooltip works fine. But if some event doesnt have description, it looks bad with not clickable “Info” word.

    Is any possible to add function If, to visible it only when description will be, and not visible when there will be no description?

    Looking forward for answer.
    Regards

    Plugin Contributor motopress

    (@motopress)

    Hi @konti,
    I’m sorry for a late reply. You may try adding this condition to check whether there is description available for this timeslot:

    <?php if (!empty($event->description)) {		
        echo $event->description;
    } 
    ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding description to widget’ is closed to new replies.