![]() |
|
optimisasi worpress tnpa widget - Printable Version +- HN-Community (https://hacker-newbie.org) +-- Forum: Miscellaneous (https://hacker-newbie.org/forum-86.html) +--- Forum: Web/Graphic Design (https://hacker-newbie.org/forum-23.html) +--- Thread: optimisasi worpress tnpa widget (/thread-1987.html) |
optimisasi worpress tnpa widget - jurank_dankkal - 02-07-2010 display recent post Code: <?php query_posts('showposts=5'); ?>
<ul>
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
<?php endwhile;?>
</ul>Display Recently Updated Posts/Pages Code: <?php
$today = current_time('mysql', 1);
$howMany = 5; //Number of posts you want to display
if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_modified_gmt < '$today' ORDER BY post_modified_gmt DESC LIMIT $howMany")):
?>
<h2><?php _e("Recent Updates"); ?></h2>
<ul>
<?php
foreach ($recentposts as $post) {
if ($post->post_title == '') $post->post_title = sprintf(__('Post #%s'), $post->ID);
echo "<li><a href='".get_permalink($post->ID)."'>";
the_title();
echo '</a></li>';
}
?>
</ul>
<?php endif; ?>Display Recent Comments Code: <?php
global $wpdb;
$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,
comment_post_ID, comment_author, comment_date_gmt, comment_approved,
comment_type,comment_author_url,
SUBSTRING(comment_content,1,30) AS com_excerpt
FROM $wpdb->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 10";
$comments = $wpdb->get_results($sql);
$output = $pre_HTML;
$output .= "\n<ul>";
foreach ($comments as $comment) {
$output .= "\n<li>".strip_tags($comment->comment_author)
.":" . "<a href=\"" . get_permalink($comment->ID) .
"#comment-" . $comment->comment_ID . "\" title=\"on " .
$comment->post_title . "\">" . strip_tags($comment->com_excerpt)
."</a></li>";
}
$output .= "\n</ul>";
$output .= $post_HTML;
echo $output;?>Display Top Comments Code: <?php $result = $wpdb->get_results("SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 10");
foreach ($result as $topten) {
$postid = $topten->ID;
$title = $topten->post_title;
$commentcount = $topten->comment_count;
if ($commentcount != 0) { ?>
<li><a href="<?php echo get_permalink($postid); ?>" title="<?php echo $title ?>"><?php echo $title ?></a></li>
<?php } } ?>Display Categories Code: <h2>Categories</h2>
<ul>
<?php wp_list_cats('sort_column=name'); ?>
</ul>Display Categories in Drop-Down Box Code: <form action="<?php bloginfo('url'); ?>/" method="get">
<?php
$select = wp_dropdown_categories('show_option_none=Select category&show_count=1&orderby=name&echo=0');
$select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select); echo $select; ?>
<noscript><input type="submit" value="View" /></noscript>
</form>Display Archives Code: <select name=\"archive-dropdown\" onChange='document.location.href=this.options[this.selectedIndex].value;'>
<option value=\"\"><?php echo attribute_escape(__('Select Month')); ?></option>
<?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?> </select>Display a Pages Menu in your Sidebar Code: <h2>Pages</h2>
<ul>
<?php wp_list_pages('title_li='); ?>
</ul>Display Gravatars (WordPress 2.5+ Only) Code: <?php if(function_exists(’get_avatar’)){ echo get_avatar($comment, ‘50?);} ?>Display Blogroll Links Code: <ul>
<?php get_links_list(); ?>
</ul>Display Admin Section Code: <ul>
<?php wp_register(); ?>
<li><?php wp_loginout(); ?></li>
<li><a href="http://www.wordpress.org/">WordPress</a></li>
<?php wp_meta(); ?>
<li><a href="http://validator.w3.org/check?uri=referer">XHTML</a></li>
</ul>Display a Pages SubMenu in your Sidebar Code: <?php$children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');if ($children) { ?><ul> <?php echo $children; ?>
</ul>
<?php } ?>Display WordPress Tags Code: <?php the_tags(); ?>Display WordPress Tags Cloud Code: <?php wp_tag_cloud('smallest=8&largest=36&'); ?>Dynamic Title Tags Code: <title><?phpif (is_home()) { echo bloginfo('name');
} elseif (is_404()) {
echo '404 Not Found';
} elseif (is_category()) {
echo 'Category:'; wp_title('');
} elseif (is_search()) {
echo 'Search Results';
} elseif ( is_day() || is_month() || is_year() ) {
echo 'Archives:'; wp_title('');
} else {
echo wp_title('');
}
?></title>Display PHP on a Single Page Code: <?php if ( is_home() ) { include ('file.php'); } ?>Display an External RSS Feed Code: <?php include_once(ABSPATH.WPINC.'/rss.php');
wp_rss('http://wpforums.com/external.php?type=RSS2', 5); ?>Display Most Recent Twitter Entry Code: <?php
// Your twitter username.
$username = "TwitterUsername";
// Prefix - some text you want displayed before your latest tweet.
// (HTML is OK, but be sure to escape quotes with backslashes: for example href=\"link.html\")
$prefix = "";
// Suffix - some text you want display after your latest tweet. (Same rules as the prefix.)
$suffix = "";
$feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=1";
function parse_feed($feed) {
$stepOne = explode("<content type=\"html\">", $feed);
$stepTwo = explode("</content>", $stepOne[1]);
$tweet = $stepTwo[0];
$tweet = str_replace(”<”, “<”, $tweet);
$tweet = str_replace(”>”, “>”, $tweet);
return $tweet;
}
$twitterFeed = file_get_contents($feed);
echo stripslashes($prefix) . parse_feed($twitterFeed) . stripslashes($suffix);
?>Breaking Categories into Columns Code: <?php
$cats = explode("<br />",wp_list_categories('title_li=&echo=0&depth=1&style=none'));
$cat_n = count($cats) - 1;
for ($i=0;$i<$cat_n;$i++):
if ($i<$cat_n/2):
$cat_left = $cat_left.'<li>'.$cats[$i].'</li>';
elseif ($i>=$cat_n/2):
$cat_right = $cat_right.'<li>'.$cats[$i].'</li>';
endif;
endfor;
?>
<ul class="left">
<?php echo $cat_left;?>
</ul>
<ul class="right">
<?php echo $cat_right;?>
</ul>Adding a Social Bar to your Posts Code: <div class="socials">
<a class="btn_email" href="mailto:?subject=<?php the_title(); ?>&body=<?php the_permalink() ?>">E-mail</a>
<a class="btn_comment" href="#respond">Comment</a>
<a href="http://del.icio.us/post?url=<?php the_permalink() ?>&title=<?php the_title() ?>" title="Submit to Del.icio.us" target="_blank" class="btn_delicious">Del.icio.us</a>
<a href="http://www.digg.com/submit?phase=2&url=<?php the_permalink() ?>&title=<?php the_title() ?>" title="Submit Post to Digg" target="_blank" class="btn_digg">Digg</a>
<a href="http://reddit.com/submit?url=<?php the_permalink() ?>&title=<?php the_title() ?>" title="Submit Reddit" target="_blank" class="btn_reddit">Reddit</a>
<a href="http://technorati.com/faves?add=<?php the_permalink() ?>" title="Submit to Technorati" target="_blank" class="btn_technorati">Technorati</a>
<a href="http://furl.net/storeIt.jsp?t=<?php the_title() ?>&u=<?php the_permalink() ?>" title="Submit to Furl" target="_blank" class="btn_furl">Furl</a>
</div>File CSS Code: .socials {font-size:10px; font-weight:bold; margin-bottom:10px; background-color:#FFFFFF; border:1px solid #BBB9B2; padding:5px 5px 5px 10px; width:540px;}
.socials a {margin-right:10px; color:#BFBCB3;}
.btn_email {background:url(images/mail.gif) left no-repeat; padding-left:15px;}
.btn_comment {background:url(images/comments.gif) left no-repeat; padding-left:15px;}
.btn_delicious {background:url(images/delicious.gif) left no-repeat; padding-left:15px;}
.btn_digg {background:url(images/digg.gif) left no-repeat; padding-left:15px;}
.btn_reddit {background:url(images/reddit.gif) left no-repeat; padding-left:15px;}
.btn_technorati {background:url(images/technorati.gif) left no-repeat; padding-left:15px;}
.btn_furl {background:url(images/furl.gif) left no-repeat; padding-left:15px;}RE: optimisasi worpress tnpa widget - chi.myo - 02-08-2010 ini yg awak butuh kakak ![]() thank you so muach muach.. ![]() any other ![]() soalny chi baru bljr bwt web... RE: optimisasi worpress tnpa widget - CuKRiZ - 02-08-2010 Aku anak baru ne disini,salam kenal aja semua. Wah ne bisa buat belajar......Maskasih kk,masih awam ne
RE: optimisasi worpress tnpa widget - jurank_dankkal - 02-08-2010 sama2 all. . . . silahkan d'cicipi.. sama2 all. . . . silahkan d'cicipi.. RE: optimisasi worpress tnpa widget - samu1241 - 02-08-2010 wah.. ada pecinta WP jg nih kayaknya ![]() btw ini tambahan dari saya: http://www.smashingmagazine.com/2009/08/18/10-useful-wordpress-hook-hacks/ http://www.smashingmagazine.com/2009/10/20/10-useful-wordpress-hacks-for-advanced-themes/ http://www.smashingmagazine.com/2009/05/27/wordpress-theme-development-frameworks/ RE: optimisasi worpress tnpa widget - jurank_dankkal - 02-15-2010 tenqyu dah tmbhin kk samu. . . |