做网站用什么编程软件,wordpress 页面属性 模板,网站建设兼职招聘,软件开发步骤包括哪些过程如何你是个wordpress主题设计者#xff0c;可能会在制作wordpress主题时为了一些寻找合适的wordpress代码焦虑#xff0c;这里搜集总结wordpress主题开发中常用的代码片段#xff0c;希望为你工作中带来方便 最新文章最新更新文章/页面最新评论最受欢迎文章文章分类下拉框文…如何你是个wordpress主题设计者可能会在制作wordpress主题时为了一些寻找合适的wordpress代码焦虑这里搜集总结wordpress主题开发中常用的代码片段希望为你工作中带来方便 最新文章最新更新文章/页面最新评论最受欢迎文章文章分类下拉框文章分类文章归档下拉框文章归档页面菜单显示头像连接列表登陆/登出边侧栏显示次级页面动态title标签 1显示最新文章 这段代码显示最新发布5篇文章 ?php query_posts(showposts5); ?ul?php while (have_posts()) : the_post(); ?lia href?php the_permalink() ??php the_title(); ?/a/li?php endwhile;?/ul 2显示最新更新文章/页面 ?php$today current_time(mysql, 1);$howMany 5; //Number of posts you want to displayif ( $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); ?/h2ul?phpforeach ($recentposts as $post) {if ($post-post_title ) $post-post_title sprintf(__(Post #%s), $post-ID);echo lia href.get_permalink($post-ID).;the_title();echo /a/li;}?/ul?php endif; ? 3显示最新评论 ?phpglobal $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_excerptFROM $wpdb-commentsLEFT OUTER JOIN $wpdb-posts ON ($wpdb-comments.comment_post_ID $wpdb-posts.ID)WHERE comment_approved 1 AND comment_type ANDpost_password ORDER BY comment_date_gmt DESCLIMIT 10;$comments $wpdb-get_results($sql);$output $pre_HTML;$output . \nul;foreach ($comments as $comment) {$output . \nli.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;? 4最受欢迎文章 ?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) { ?lia href?php echo get_permalink($postid); ? title?php echo $title ??php echo $title ?/a/li?php } } ? 5文章分类 h2Categories/h2ul?php wp_list_cats(sort_columnname); ?/ul 6下拉框文章分类 form action?php bloginfo(url); ?/ methodget?php$select wp_dropdown_categories(show_option_noneSelect categoryshow_count1orderbynameecho0);$select preg_replace(#select([^]*)#, select$1 onchangereturn this.form.submit(), $select); echo $select; ?noscriptinput typesubmit valueView //noscript/form 7文章归档 h2Archives/h2ul?php wp_get_archives(typemonthly); ?/ul 8下拉框文章归档 select name\archive-dropdown\ onChangedocument.location.hrefthis.options[this.selectedIndex].value;option value\\?php echo attribute_escape(__(Select Month)); ?/option?php wp_get_archives(typemonthlyformatoptionshow_post_count1); ? /select 9页面菜单 h2Pages/h2ul?php wp_list_pages(title_li); ?/ul 10显示头像 ?php if(function_exists(’get_avatar’)){ echo get_avatar($comment, ‘50?);} ? 11连接列表 ul?php get_links_list(); ?/ul 12登陆/登出 ul?php wp_register(); ?li?php wp_loginout(); ?/lilia hrefhttp://www.wordpress.org/WordPress/a/li?php wp_meta(); ?lia hrefhttp://validator.w3.org/check?urirefererXHTML/a/li/ul 13边侧栏显示次级页面 在你的博客siderbar显示次级页面 ?php$children wp_list_pages(title_lichild_of.$post-ID.echo0);if ($children) { ?ul ?php echo $children; ?/ul?php } ? 14标签云 ?php wp_tag_cloud(smallest8largest36); ? 15主题模板名字 ?php /* Template Name: Portfolio */ ? 16动态title标签 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