WordPress.org

Ready to get started?Download WordPress

Forums

Widget Logic
Getting Date with Format (3 posts)

  1. mridl200
    Member
    Posted 1 year ago #

    Hi guys,

    This I believe should be something simple, however I couldnt get it to work correctly so after a quick search without finding anything I came here.

    I simply want to add the current date to the bottom of my webpage using Widget Logic. I looked up the PHP to do this and used
    <?php
    print_r(getdate());
    ?>
    This however will not load anything.

    Does anyone have a solution to this? Or know of a better way for me to go about it?

    Thanks in advance.

    http://wordpress.org/extend/plugins/widget-logic/

  2. mridl200
    Member
    Posted 1 year ago #

    An update,
    It seems the problem I was having was that I used the <?php tags inside the logic.
    Now I can display a time properly, so as a follow up question is there a way to display text, followed by the year?
    For example I am using a text box that has "Created by xxx on "Date""
    Where date is I would like to use Widget logic to display the year (so really I am just using print_r(date("Y"))).

    Thanks again.

  3. alanft
    Member
    Plugin Author

    Posted 1 year ago #

    You could do this with WL - ideally by using the widget_content filter on an existing widget. But there are PHP widgets out there that you can place in sidebars and widgetised-footers that you can put in the specific code you want - and that would be way easier I think.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic