This plugin hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

WP PHP widget

Description

This plugin adds a new widget called PHP Widget, which will allow you to include PHP code, you can have Text, HTML, Javascript, Flash and/or PHP code wordpress template tags as content or title in this widget.
So, as long as you want, it can do everything, that is greatful.

Help?

when you add the PHP widget ,you will see help.

Usage . example

`
title:
code:

test

title:url test
code:

test

title:title
code:

test

title:video
code:

title:New Posts最新文章
code:

title:Rand Posts随即文章
code:

    ‘rand’, ‘showposts’ => 10));
    if (have_posts()) :
    while (have_posts()) : the_post();?>

  • <a href="”>

title:orderby comments评论排行
code:

    get_results(“SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 10”);
    foreach ($result as $post) {
    setup_postdata($post);
    $postid = $post->ID;
    $title = $post->post_title;
    $commentcount = $post->comment_count;
    if ($commentcount != 0) { ?>

  • <a href="” title=””>
    ()

title:new comments最新评论
code:

    comments
    LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID)
    WHERE comment_approved = ‘1’ AND comment_type = ” AND post_password = ”
    ORDER BY comment_date_gmt DESC
    LIMIT $src_count”;
    $comments = $wpdb->get_results($sql);

    $output = $pre_HTML;
    $output .= “\n

“;
$output .= $post_HTML;

if (empty($comments)) { return ”; } else { return $output; }

}
}

//简化版:echo ‘

  • comment_post_ID) . ‘#comment-‘ . $comment->comment_ID.'”>’.get_the_title($comment->comment_post_ID) .’
  • ‘; 只输出标题

    //输出评论人和评论内容: $output .= “\n\t

  • ID) . “#comment-” . $comment->comment_ID . “\” title=\” ” . htmlspecialchars($comment->post_title) . “\”>” . $comment->comment_author.”:”.substr(strip_tags($comment->comment_content),0,$src_length) . ” …
  • “;

    ?>

    title:postviews热门文章
    code:

    title:Time加载时间
    code:
    queries in s.

    `

    etc

    You can have Text, HTML, Javascript, Flash and/or PHP code as content or title in this widget.

    So, as long as you want, it can do everything, that is greatful.

    Screenshots

    • The widgets screen showing a PHP widget in use.
    • PHP widget .

    Installation

    1. Upload the folder wp-php-widget to the `/wp-content/plugins/
    2. Activate the plugin through the ‘Plugins’ menu in WordPress
    3. Navigate to Appear > widget > PHP widget
      you will see PHP widget ,Use the widget like any other widget.

    when you add the PHP widget ,you will see help.

    Contributors & Developers

    “WP PHP widget” is open source software. The following people have contributed to this plugin.

    Contributors

    Changelog

    1.0.2

    fixed usage,add help link

    1.0.1

    add usage code

    1.0.0

    create PHP widget