WordPress.org

Forums

Ajaxize
[resolved] Whats the function namne for this plugin? HELP (7 posts)

  1. phattrance
    Member
    Posted 2 years ago #

    Can someone help me find the function namne in this plugin? the code i add to my theme is: <? wp_days_ago(); ?>

    i couldnt find any help in the plugin documentary.

    --------------

    function wp_days_ago ($mode = 0, $prepend = "", $append = "",
    $texts = array("Today", "Yesterday", "One week ago", "days ago", "year",
    "years", "ago", "day ago", "days ago", "Just now", "One minute ago", "minutes ago", "1 hour ago", "hours ago", "Some time in the future")) {

    $days = round((strtotime(date("Y-m-d", gmmktime() + (get_option('gmt_offset') * 3600))) - strtotime(date("Y-m-d", get_the_time("U")))) / 86400);

    $minutes = round((strtotime(date("Y-m-d H:i", gmmktime() + (get_option('gmt_offset') * 3600))) - strtotime(date("Y-m-d H:i", get_the_time("U")))) / 60);

    $output = $prepend;

    if($minutes < 0) {
    $output .= $texts[14];
    } else if($mode == 0 && $minutes < 1440) {
    if($minutes == 0) {
    $output .= $texts[9];
    } else if($minutes == 1) {
    $output .= $texts[10];
    } else if($minutes < 60) {
    $output .= $minutes . " " . $texts[11];
    } else if($minutes < 120) {
    $output .= $texts[12];
    } else {
    $output .= floor($minutes / 60) . " " . $texts[13];
    }
    } else {
    if($days == 0)
    $output = $output . $texts[0];
    elseif($days == 1)
    $output = $output . $texts[1];
    elseif($days == 7)
    $output = $output . $texts[2];
    else {
    $years = floor($days / 365);
    if($years > 0) {
    if($years == 1)
    $yearappend = $texts[4];
    else
    $yearappend = $texts[5];

    $days = $days - (365 * $years);
    if($days == 0)
    $output = $output . $years . " " . $yearappend . " " . $texts[6];
    else if($days == 1)
    $output = $output . $years . " " . $yearappend . ", " . $days . " " . $texts[7];
    else
    $output = $output . $years . " " . $yearappend . ", " . $days . " " . $texts[8];
    } else {
    $output = $output . $days . " " . $texts[3];
    }
    }
    }

    $output = $output . $append;

    echo $output;
    }

    add_filter('Posts', 'wp_days_ago');
    ?>

    http://wordpress.org/extend/plugins/ajaxize/

  2. yoav.aner
    Member
    Plugin Author

    Posted 2 years ago #

    What are you trying to do exactly? If you want to 'ajaxize' this function (or any function) you created, as long as it does not expect any parameters, simply do the following:

    go to your wordpress admin, Settings->Ajaxize
    Enter the function name in the 'Function Name' field, and click 'Generate DIV'. Then you can copy&paste this div into any page/widget you want. You can also see the output below.

    If you're still having trouble, you can also simply click on 'Help' and there's much more information available.

  3. phattrance
    Member
    Posted 2 years ago #

    yeah im trying to make this plugin: http://wordpress.org/extend/plugins/wp-days-ago/ compatible with the ajaxize.
    i used the function call name "wp_days_ago" but it broke my theme every time i tried to add the new code to it. dont know if im doing something wrong here. any ideas?

  4. yoav.aner
    Member
    Plugin Author

    Posted 2 years ago #

    I don't know this plugin and haven't tested it, but simply follow the instructions above, and use wp_days_ago as the function name on the settings->ajaxize page. Then copy&paste the div that ajaxize outputs to the appropriate php file for your theme. the output div would look something like:
    <div id="ajaxize_this:wp_days_ago:b48260e95c5c15da55b33dfed6027ea17d33b478"></div>

  5. phattrance
    Member
    Posted 2 years ago #

    yeah i already tried that and this is how the theme looks like after adding the code: http://i.imgur.com/HIH51.jpg

    blog url: http://funny-pictures-blog.com/

  6. yoav.aner
    Member
    Plugin Author

    Posted 2 years ago #

    are you using nginx as your web server? If so, then take a look at a potential solution on the answer I gave here: http://wordpress.org/support/topic/plugin-ajaxize-infinite-loop

  7. yoav.aner
    Member
    Plugin Author

    Posted 2 years ago #

    Didn't hear back from OP for some time, so marking as resolved

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Ajaxize
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.