WordPress.org

Ready to get started?Download WordPress

Forums

Artiss Timed Content
[Plugin: Simple Timed Content] Trying to use a php variable to calcualat ondate ... not working. (7 posts)

  1. kirkward
    Member
    Posted 2 years ago #

    I have the execphp plugin installed and am able to run php in a post. I have installed the simple timed conetent plugin and am attempting to insert a variable into the plugin so that I will not have to calculate the show date of content in a multitude of similar posts.

    For example, I have season content that will be released on a different day each month during the month after the post is published. One post in January, another post in February, and so forth throughout the year.

    The following code calculates the date, but the shortcode does not hide the content during the period between publication and the desired show date.

    <?php $showdate_10 = get_the_date('U') + (60 * 60 * 24 * 10); $ondate_10 = date('Y-m-d', $showdate_10); ?>
    
    [timed ondate="<?php $ondate_10; ?>"]This link should appear ten days after publication, on <?php echo $ondate_10; ?>.  If you can see it before then, something is not working.[/timed]

    I have tried using both double quotes, and single quotes to wrap the variable in within the shortcode, but neither worked. Any suggestions?

    http://wordpress.org/extend/plugins/simple-timed-plugin/

  2. dartiss
    Member
    Plugin Author

    Posted 2 years ago #

    I think this is an issue over the way that shortcodes work - I suspect the PHP can't be embedded into the shortcode call.

    David.

  3. kirkward
    Member
    Posted 2 years ago #

    I think you are right. I've tried every plugin I could find that performed this function and could not insert a php variable in any of them. I presume I will have to code the whole blooming thing in php myself ... and maybe build a plugin that does what I need.

    Thanks for your response.

  4. dartiss
    Member
    Plugin Author

    Posted 2 years ago #

    That's a function I can add in a future release - but I'm not planning on changing this plugin imminently (probably sometime in the next couple of months).

    David.

  5. kirkward
    Member
    Posted 2 years ago #

    That would be a good addition for me. Not sure how mny others would use it ... but my belief is it would help others, once they discovered it. In the meantime, I plug away trying to figure out how to cobble it together with php. Sigh.

  6. dartiss
    Member
    Plugin Author

    Posted 2 years ago #

    Yes. I don't always add features because I think the majority need them - even if one person does it was worthwhile!

    To update my plugin to work how you need it to you'll probably just need to add the code that you mentioned above, but in the plugin code itself.

    David.

  7. kirkward
    Member
    Posted 2 years ago #

    Thanks for your advice. Will get on it to see what I can do ... be interesting as isn't a coder. I'm a cobbler. I cobble things together and see if they work.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic