Sei sulla pagina 1di 8

Beberapa kumpulan fungsi pada pembuatan theme CMS wordpress www.cerenauf.com # sidebar # # adding calendar <ul> ..

<li id="calendar"> ....<?php get_calendar(); ?> ..</li> </ul> # Adding Static Content in the Sidebar <h2>About Me</h2> <ul> ..<li> ...Hi I am Hasin Hayder, You can find my personal blog at <a ...href='http://hasin.wordpress.com'>The Storyteller</a> ..</li> </ul> # Enabling/Disabling Search Bar in the Sidebar <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>"> ..<p> ...<input type="text" value="<?php echo wp_specialchars($s, 1); ?>" ...name="s" id="s" /> ...<input type="submit" value="<?php _e('Search'); ?>" /> ..</p> </form> # showing archives <? wp_get_archives('type=monthly&limit=5'); ?> # Display an RSS Feed Image beside Every Category <? wp_list_cats("exclude=2,5,1,6&sort_column=name&feed_image=feed.gif") ; ?> # Enabling/Disabling Page Menu in the Sidebar <?php wp_list_pages('title_li=<h2>' . __('Pages') . '</h2>' ); ?> <?php wp_list_pages('title_li=<h2>'.__('Navigation').'</h2>' ); ?> #usage of the Pages list template tag in sidebar.php <?php wp_list_pages('title_li=<h2>Pages</h2>'); ?>

# Customize the Categories <h3><?php _e('The Categories'); ?></h3> <ul> <?php wp_list_cats("exclude=2,5,1,6&sort_column=name"); ?> </ul> # <h3><?php _e('The Categories'); ?></h3> <ul> <?php wp_list_cats("exclude=2,5,1,6"); ?> </ul> # <li id="categories"><?php _e('Categories:'); ?> <ul> <?php wp_list_cats(); ?> </ul> </li> # Adding Feeds in the Sidebar <div class="line"></div> <h3>Feeds from PHPExperts</h3> <? rss_sidebar("http://rss.groups.yahoo.com/group/phpexperts/rss",5); ?> <div class="tab_1_content"> <h2><a name="last_comments" id="last_comments"></a></h2> <div class="last_comments"><ul><? get_recent_comments (); ? ></ul></div> </div> <div class="tab_1_content"> <h2><a name="popular_posts" id="popular_posts"></a></h2> <div class="popular_posts"><ul><?get_mostcommented (); ? ></ul></div> </div> <div class="tab_1_content"> <h2><a name="random_posts" id="random_posts"></a></h2> <div class="random_posts"><ul><? random_posts (); ?></ul></div> </div> <div class="tab_1_content"> <h2><a name="tags" id="tags"></a></h2> <div class="tags-sidebar"><ul><?php wp_tag_cloud(''); ? ></ul></div> </div>

# page # # Adding Content to Our Theme (index.php)

<?php if (have_posts()) { while(have_posts()) { the_post(); the_title(); echo "<br/>"; } } ?> # <?if (have_posts()):?> <? while(have_posts()):?> <? the_post()?> <a href='<?=the_permalink()?>'><?=the_title()?></a> <br/> <?endwhile;?> <?endif;?> # <?if (have_posts()):?> <? while(have_posts()):?> <? the_post()?> <a href='<?=the_permalink()?>'><?=the_title()?></a> <?if (!is_home()):?> <p> <?the_content();?> </p> <?endif;?> <br/> <?endwhile;?> <?endif;?> # <? if (have_posts()) : while (have_posts()) : the_post(); ?> <h2><? the_title(); ?></h2> <? the_content(); ?> <? edit_post_link(__('Edit'), '<p>', '</p>'); ?> <? endwhile; endif; ?> # Displaying the Post Excerpt on the Front Page <?if (have_posts()):?> <? while(have_posts()):?> <? the_post()?> <a href='<?=the_permalink()?>'><?=the_title()?></a> <?the_content("more");?> <br/> <?endwhile;?> <?endif;?>

# making content availabe in front page <?php if (is_home()) { query_posts("category_name='frontpage'"); } ?> # Turn off Commenting on Front Page Posts <? if (single_cat_title("",false)!="frontpage"):?> <div class="comments"> <?php wp_link_pages(); ?> <?php comments_popup_link(__('<strong>0</strong> Comments'), __ ('<strong>1</strong> Comment'), __('<strong>%</strong> Comments')); ?> </div> <? endif; ?>

# Blog name and description <h1><a href="<?php echo get_settings('home'); ?>/"> <?php bloginfo('name'); ?> </a></h1> <div class="description"> <?php bloginfo('description'); ?> </div> </div> # Theme Template Files List style.css The main stylesheet index.php The main template comments.php The comments template. If not present, comments.php from the "default" Theme is used. comments-popup.php The popup comments template. If not present, comments-popup.php from the "default" Theme is used. home.php The home page template. single.php The single post template. Used when a single post is queried. For this and all other query templates, index.php is used if the query template is not present. page.php The page template. Used when an individual Page is queried. category.php The category template. Used when a category is queried. author.php The author template. Used when an author is queried. date.php

The date/time template. Used when a date or time is queried. Year, month, day, hour, minute, second. archive.php The archive template. Used when a category, author, or date is queried. Note that this template will be overridden by category.php, author.php, and date.php for their respective query types. search.php The search results template. Used when a search is performed. 404.php The 404 Not Found template. Used when WordPress cannot find a post or page that matches the query. archives.php Archive Index Page footer.php Footer Template header.php Header Template links.php Links * * * * * * Popup Comments Template = comments-popup.php Post Template = single.php Search Form = searchform.php Search Template = search.php Sidebar Template = sidebar.php Stylesheet = style.css

# Official wordpress theme http://wordpress.org/extend/themes/ http://www.alexking.org/software/wordpress/theme_browser.php http://themes.wordpress.net http://codex.wordpress.org/Using_Themes/Theme_List http://www.emilyrobbins.com/how-to-blog/comprehensive-list-of-615free-wordpress-15-and-20-themes-templates-available-for-download266.htm http://www.bloggingpro.com/archives/category/wordpress-themes/ # Adding Tag Display to Theme ...<p class="authorName">by <?php the_author_firstname(); ?> <?php the_author_lastname(); ?> for <?php the_category(', ') ?> <br/><em><?php the_tags(); ?></em></p> <div class="entry"> # viewing date <?php echo date('l, F dS, Y'); ?> # displaying home page and rss <ul> <li class="first"><a href="<?php bloginfo('url'); ? >">Home</a></li>

<?php wp_list_pages('title_li='); ?> <li class="rss"><a href="<?php bloginfo('rss2_url'); ? >">RSS</a></li> </ul> # displaying categories <?php wp_list_categories('hierarchical=1&title_li='); ?> # Wordpress Conditional Tags * is_home() * is_front_page() * is_admin() * is_single() * is_sticky() * is_comments_popup() * comments_open() * pings_open() * is_page() * is_page_template() * is_category() * is_archive() * is_tag() * has_tag() * is_author() * is_date() * is_year() * is_month() * is_day() * is_time() * is_search() * is_404() * is_paged() * is_attachment() * is_singular() * is_feed() * is_trackback() * is_preview() * has_excerpt() * in_the_loop() * is_active_sidebar() <h3>Terpopuler</h3> <ul> <?php $result = $wpdb->get_results("SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 7"); foreach ($result as $post) { setup_postdata($post); $postid = $post->ID; $title = $post->post_title; $commentcount = $post->comment_count;

if ($commentcount != 0) { ?> <li><a href="<?php echo get_permalink($postid); ? >" title="<?php echo $title ?>"> <?php echo $title ?></a> (<?php echo $commentcount ?>)</li> <?php } } ?> </ul> # Display Author's Public Name <p>This post was written by <?php the_author(); ?></p> # author's Profile Display <?php the_author_link(); ?> # display posts by author <?php the_author_posts_link(); ?> # Breadcrum function the_breadcrumb() { if (!is_home()) { echo '<a href="'; echo get_option('home'); echo '">'; bloginfo('name'); echo "</a> "; if (is_category() || is_single()) { the_category('title_li='); if (is_single()) { echo " "; the_title(); } } elseif (is_page()) { echo the_title(); } } } # display Breadcrum <?php the_breadcrumb(); ?> #query post front page <?php query_posts('pagename=home'); # Wordpress query post for a specific page <?php $contact_drop = new WP_Query('pagename=contact'); while ($contact_drop->have_posts()) : $contact_drop->the_post(); $do_not_duplicate = $post->ID; ?> <div id="contact-slide">

<h3 class="page-page-title"><?php the_title(); ?></h3> <?php the_content(); ?> </div> <?php endwhile; ?> ?> #display author, tags, category <p class="authorName"> <?php the_author_firstname(); ?> <?php the_author_lastname(); ?> for <?php the_category(', ') ?> <?php the_tags(); ?> </p>

Potrebbero piacerti anche