how can I place something at the top of the events list widget?

Home Forums Calendar Products Events Calendar PRO how can I place something at the top of the events list widget?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #73765
    ironandsteel
    Participant

    If I modify widgets/list-widget.php, I see my changes repeated for every event shown in the widget. In other words, list-widget.php is the template for display of a single event. What I need to do is stick something at the top of the widget, and I cannot figure out where to do this. I’ve spent probably 6 hrs searching and experimenting with this- perhaps someone can point me to the right file?

    #73846
    Kelly
    Participant

    Hi, ironandsteel. This is a great question! πŸ™‚ I’m happy to help you out with this.

    The list widget does both set up the widget and populate the events. Would it be possible for you to share your overridden file with us via pastebin or github so that I can see what you’re trying to do?

    Also, if you could explain the end result that you’re aiming for, that would be helpful, too.

    Thanks!

    #73921
    ironandsteel
    Participant

    Kelly- what I want to do is extremely simple: I want to have control over what appears at the top of the list events widget- like be able to put whatever html there that I want. Specifically, I want to put a graphic there that is a link. I just have not been able to figure out what code draws the widget itself. I can put some text at the top of the file, and it gets repeated for every event. I just want to see how to print “hello world” at the top of the widget. In my override I have the line “I want html this to only appear once, at the top” at the top of the file, yet it appears with every event.
    Here is a pastebin of my list-widget.php override.
    http://pastebin.com/Qn45pWWH
    It is very brain dead what I’m doing, but it works. If the title for the widget is set to “Next Event”, then I display the_content(). I use this on the home page of the site to display the next upcoming event.
    Thanks for helping!

    #74033
    ironandsteel
    Participant

    To clarify my last paragraph- in order to use the same widget in two different roles (a list of upcoming events & a “next event only” widget), I simply test for the value of the widget title, and if it is “Next Event”, then I customize the view to display to entire event details. This is not really related to the question on this thread- I just wanted to explain what I was doing in the code.

    #74166
    Barry
    Member

    Hi ironandsteel,

    There are two possible approaches I might consider here. One would be to build my own widget – not as hard as it sounds, as your widget definition can inherit from our existing one – and tweak whatever you need to tweak.

    The second would be to work with the Widgets API, detect if the widget is a list widget and insert what you want. Here’s a minimal example to get you started which simply injects some HTML before the title (but, importantly, it does not remove the pre-existing before-the-title markup).

    In your case you want to add a graphic or something different to what I have done, but the process will be similar (and you can add any additional checks you need, if your targeting needs to be more specific).

    Hope that helps!

    #74189
    ironandsteel
    Participant

    Barry- I tried making my own widget and got pretty far (it was discussed in this forum) but I never could figure out how to specify what template file to use.
    Regarding your 2nd idea- I don’t know where I would use this code.
    I did finally figure out my answer- all I needed to know was this: the title of the widget is drawn in plugins/the-events-calendar/lib/widget-list-class.php on line 113. I didn’t realize that the free version of your plugin played a role in the list widget. Is there something that explains the relationship of the free version and the pro version?

    #74291
    Barry
    Member

    Regarding your 2nd idea- I don’t know where I would use this code.

    Sorry, I should have been clearer: you could add it either to your theme’s functions.php file or else create a new plugin to act as a container for it.

    Is there something that explains the relationship of the free version and the pro version?

    Only the code itself, as for most users it is effectively a moot point – but yes the Pro version of the widget does indeed inherit from the equivalent core widget and makes use of the same widget_output() method in particular.

    I did finally figure out my answer

    Great! Since it sounds like you’re on top of this/you’ve got a few more ideas to explore (and it is anyway beyond the scope of support to offer much more guidance here) I will go ahead and close this thread – I hope the rest of the customization process goes smoothly πŸ™‚

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘how can I place something at the top of the events list widget?’ is closed to new replies.