super easy question for php person, simple format problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mgason
Forum Newbie
Posts: 5
Joined: Thu Jun 24, 2010 11:52 am

super easy question for php person, simple format problem

Post by mgason »

I know nothing about PHP.
this code is supposed to create a countdown timer when used in a theme in wordpress. I need to use it in a php widget. The widget does not accept the short code PHP of [].
It needs a proper <?php ?> format.
I can not seem to guess what that is, hope someone can help

The following is from the plugin page.....

If you want to insert individual countdown timers, such as in posts or on pages, you can use the following shortcode:

[fergcorp_cdt_single date="ENTER_DATE_HERE"]

Where "ENTER_DATE_HERE" uses PHP's strtotime function and will parse about any English textual datetime description.

this code does work to return a list of timers when placed in the php sidebar widget.

Code: Select all

<li id='countdown'><h2>Countdown:</h2>
<ul>
<?php function_exists('fergcorp_countdownTimer')?fergcorp_countdownTimer():NULL; ?>
</ul>
</li>
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: super easy question for php person, simple format proble

Post by greyhoundcode »

Can you provide a few more details? What widget are we talking about - is it available on Extend?
internet-solution
Forum Contributor
Posts: 220
Joined: Thu May 27, 2010 6:27 am
Location: UK

Re: super easy question for php person, simple format proble

Post by internet-solution »

mgason wrote:I know nothing about PHP. ...
Then how do you know it is a super easy question for a php person? :mrgreen:
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: super easy question for php person, simple format proble

Post by greyhoundcode »

Plugin instructions (as posted by mgason) wrote:If you want to insert individual countdown timers, such as in posts or on pages, you can use the following shortcode:

[fergcorp_cdt_single date="ENTER_DATE_HERE"]
It sounds as if the intention (as is normally the case) is to use the shortcode from within pages and posts, rather than within widgets.

If I write a widget that accepts user parameters then I don't necessarily parse those parameters for shortcode, so yeah you might need a bit of PHP know how to resolve this.

It's not necessarily difficult but without seeing the code and some more detailed information it is difficult to answer.
Post Reply