How to imitate a WordPress site
WordPress imitation site:
1. To capture the target website, it is very easy to use the imitation site gadget 8.0.2, which can capture as much of the entire site as possible. Crawl the website.
Save the file to wp-content/tust. The saved homepage default.html and other file directories are as follows:
Then create a standard wp file. As shown in the figure below:
Split default.html into header.php, index.php, footer.php
header.php including body Navigation bar, the modified code will be posted later.
index.php contains the main part and needs to reference header.php and footer.php.
footer.php contains the final copyright and other information.
2. Modify the link in header.php to make the homepage normal. Commonly used template functions:
Basic condition judgment function:
is_home(): whether it is the home page
is_single(): whether it is the content page (Post)
is_page(): Whether it is a content page (Page)
is_category(): whether it is a Category/Archive page
is_tag(): whether it is a tag (Tag) archive page
is_date(): Whether to archive the page for the specified date
is_year(): Whether to archive the page for the specified year
is_month(): Whether to archive the page for the specified month
is_day(): Whether it is an archive page for the specified day
is_time(): Whether it is an archive page for the specified time
is_archive(): Whether it is an archive page
is_search( ): Whether it is a search result page
is_404(): Whether it is a "HTTP 404: Not Found" error page
is_paged(): Whether the homepage/Category/Archive page is displayed in multiple pages
Commonly used PHP functions in the Header part:
: Blog name (Title)
:CSS file path
:PingBack URL
: Template file path
: WordPress version
:Atom URL
:RSS 2.o URL
: Blog URL
: Blog page HTML type
:Blog page encoding
:Blog description
:Specific content page (Post /Page) title
Commonly used PHP functions and commands for templates:
: Call Header template
: Call the Sidebar template
: Call the Footer template
: Display content (Post/Page)
: Check whether Post/Page exists
: If Post/Page exists, display it
:While end
:If end
: Display time, the time format is determined by the "string" parameter, please refer to the PHP manual
php comments_popup_link(); ?>: Comment link in the text, if comments_popup_script(); is used, the link will be opened in a new window
: Content page (Post/Page ) Title
: Content page (Post/Page) URL
: Specific content page (Post/Page) Category
: Author
: Specific content page (Post/ Page) ID
: If the user is logged in and has permissions, display the edit link
: Display links in Blogroll
: Call message/reply template
: Display Page list
: Display the Categories list
: Next article link
:Previous article link
:Calendar
< ;?php wp_get_archives() ?>:Show content archives
: Navigation, display the previous/next article link
Other functions related to templates:
: Output Corresponding information
: Display registration link
: Display login/logout link
: Paging the current content
: Truncating the current content so that the entire content is not displayed on the homepage/catalog page
: Web page loading time (seconds)
: Web page loading query volume
will The css, js, and image links in the template are replaced with the above functions
3. When the page displays normally, modify the navigation bar.
When setting the navigation bar, modify the original code:
Use wp_nav_menu instead. The menu navigation code is as shown in the comment below. menus are annotated. When substituting, follow the parameters below.
<?php wp_nav_menu( array( 'theme_location' => '' //指定显示的导航名,如果没有设置,则显示第一个 'menu' => 'header-menu', 'container' => 'nav', //最外层容器标签名 'container_class' => 'primary', //最外层容器class名 'container_id' => '',//最外层容器id值 'menu_class' => 'sf-menu', //ul标签class 'menu_id' => 'topnav',//ul标签id 'echo' => true,//是否打印,默认是true,如果想将导航的代码作为赋值使用,可设置为false 'fallback_cb' => 'wp_page_menu',//备用的导航菜单函数,用于没有在后台设置导航时调用 'before' => '',//显示在导航a标签之前 'after' => '',//显示在导航a标签之后 'link_before' => '',//显示在导航链接名之后 'link_after' => '',//显示在导航链接名之前 'items_wrap' => '<ul id="%1$s">%3$s</ul>', 'depth' => 0,////显示的菜单层数,默认0,0是显示所有层 'walker' => ''// //调用一个对象定义显示导航菜单 )); ?>
After the modification of header.php on the home page is completed, it is roughly as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo('charset'); ?>" /> <title>天津科技大学海洋与环境学院</title> <meta name="keywords" content="天津科技大学海洋与环境学院" /> <meta name="description" content="<?php bloginfo('description'); ?>" /> <link rel="shortcut icon" type="image/ico" href="<?php echo get_option(' wpd_logo '); ?>" /> <link href="<?php bloginfo('template_url'); ?>/css/reset-min.css" rel="stylesheet" type="text/css" /> <link href="<?php bloginfo('template_url'); ?>/css/fonts-min.css" rel="stylesheet" type="text/css" /> <link href="<?php bloginfo('template_url'); ?>/css/grids-min.css" rel="stylesheet" type="text/css" /> <link href="<?php bloginfo('template_url'); ?>/css/common.css" rel="stylesheet" type="text/css" /> <script src="<?php bloginfo('template_url'); ?>/js/jquery-1.7.2.min.js" type="text/javascript"></script> <!--[if lt IE 7]> <script src="js/ie7.js"></script> <![endif]--> <script type="text/javascript" src="js/iepngfix_tilebg.js"></script> <link href="<?php bloginfo('template_url'); ?>/css/index.css" rel="stylesheet" type="text/css" /> <link href="<?php bloginfo('template_url'); ?>/css/frame-top-link.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/css/mainmenu.css" /> <link href="<?php bloginfo('template_url'); ?>/css/jqueryslidemenu.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/css/bigpic.css" /> <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/css/modulelist.css" /> <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/css/pager.css" /> <script src="<?php bloginfo('template_url'); ?>/js/jquery.slidemenu.js" type="text/javascript"></script> <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/xmosaic.js"></script> <script src="<?php bloginfo('template_url'); ?>/js/jquery.js" type="text/javascript"></script> <script src="<?php bloginfo('template_url'); ?>/js/kandytabs.pack.js" type="text/javascript"></script> <script src="<?php bloginfo('template_url'); ?>/js/custom.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/css/footer.css" /> <style> .tag_description { float: left; margin-top:7px; padding-bottom:5px; list-style:none; } .tag_description a { font-size: 12px; text-indent: 24px; } .tag_description p { font-family:"宋体",Verdana, Lucida, Arial, Helvetica; color: #666666; float:right; width:220px; line-height:24px; font-size: 12px; text-indent: 24px; text-align:justify; margin-top:0px; text-justify:inter-ideograph; } #AcadeInfoList { position:relative; top:-20px; } #AcadeInfo_spliter { position:relative; top:10px; } #AcadeInfoList:nth-of-type(n) { position:relative; top:0px; } #AcadeInfo_spliter:nth-of-type(n) { position:relative; top:30px; } .tag_title{ line-height:24px; background-position-x: 0%; background-position-y: -540px; background-repeat: no-repeat; overflow-x: hidden; width:370px; } .tag_title a{color: #666666; font-size:12px; margin-left:0px; padding-left:5px; } </style> </head> <body> <div id="frame-top"> <div id="frame-top-warpper"> <div class="frame-top-link"> <ul> <li class="first"><a target="" href="/">学院首页</a></li><li class=""><a target="" href="/7db3dc.html">联系我们</a></li><li class=""><a target="_blank" href="/admin.html">管理员入口</a></li> </ul> </div> <div id="frame-top-logo"> <table> <tr> <td style="vertical-align:top"> <a href="/" title="天津科技大学海洋与环境学院"> <img src="/static/imghw/default1.png" data-src="<?php bloginfo('template_url'); ? alt="How to imitate a WordPress site" >/picture/2015-09-16-19-7642419411.png" class="lazy" /> </a> </td> </tr> </table> </div> <div id="frame-top-navbar"> <script type="text/javascript"> $(document).ready(function () { mlddminit(375); }); </script> <div id="navbar-left"></div> <?php wp_nav_menu( array( 'container' => 'div','container_id' => 'navbar-middle','menu_class' => 'mlddm') ); ?> <!--<ul class="mlddm" params="1,-1,500,slide,200,h"> <li class=""> <a href="#" target="">学院概况</a> <ul> <li><a href='/01589e.html' target="">学院简介</a> </li><li><a href='/cbc95b.html' target="">历史沿革</a> </li><li><a href='/1ab539.html' target="">学院领导</a> </li><li><a href='/ad9daf.html' target="">学院党委</a> </li><li><a href='/0c2b70.html' target="">职能部门</a> </li><li><a href='#' target="">学术机构</a> </li> 替换这里第一条的东西。 --> <div id="navbar-right"></div> </div> <?php wp_head(); ?>
4. Modify
in index.php. Here we first modify the carousel image, among which The modified code for the carousel image is as follows:
<?php get_header(); ?> <div id="frame-top-slider-detail"> </div> <div id="frame-top-slider" class="smallslider"> <!-- 大图轮播--> <script type="text/javascript"> $(document).ready(function () { var l=$('#bigpic').children().length; var str=''; for(var i=0; i < l;i++) { if(i==0) str += '<li class="on" ></li>'; else str += '<li class=" "></li>'; } $('#pager').html(str); var mosaic = XMosaic('bigpic', { pager: 'pager', delay: 10000, countX: 10, countY: 5, how: 9, order: 0 }); }); </script> <div id ="bigpic"> <a style="left: 0px; top: 0px; position: absolute;" target="_blank" href="/13v0to-1.html"> <img src="/static/imghw/default1.png" data-src="<?php bloginfo('template_url'); ? alt="How to imitate a WordPress site" >/picture/540_225.jpg" class="lazy" src='<?php echo get_option(' wpd_banner1 '); ?>' alt='1' /> </a><a style="left: 0px; top: 0px; position: absolute;" target="_blank" href=""> <img src="/static/imghw/default1.png" data-src="<?php bloginfo('template_url'); ? alt="How to imitate a WordPress site" >/picture/540_225.jpg" class="lazy" src='<?php echo get_option(' wpd_banner2 '); ?>' alt='2' /> </a> </div> </div> </div>
Then modify the list part of the article:
<div id="frame-top-slider-mask"> <ul class="ctrls" id="pager"> </ul> </div> </div> <div id="frame-main-body"> <div id="frame-main-wrapper" class="yui3-g"> <div id="frame-main" class="yui3-u"> <div id="frame-main-left" class="yui3-u-1-2"> <div class="module module_left"> <div class="module-name"> <a href="/75d14e-1.html" target="_blank">学院新闻</a> <a style="font-size:13px; margin-left:250px; color:blue;" target="_blank" href="/75d14e-1.html">更多</a> </div> <div class="module-spliter"> <div> </div> </div> <div class="module-warpper"> <div> <div class="row pd5 fb"> <a target="_blank" title="海洋与环境学院孙军院长一行走访国家海洋信息中心" href="/lqpmfv.html">海洋与环境学院孙军院长一行走访国家海洋信息中心</a> </div> <li class="row spic tag_description"> <a target="_blank" href="/lqpmfv.html" title="海洋与环境学院孙军院长一行走访国家海洋信息中心"> <img src="/static/imghw/default1.png" data-src="<?php bloginfo('template_url'); ? alt="How to imitate a WordPress site" >/picture/540_225.jpg" class="lazy" width=360 style="max-width:90%" align="left" alt="海洋与环境学院孙军院长一行走访国家海洋信息中心" > </a> </li> <div style="clear:both;"></div> </div> <table cellspacing="0" cellpadding="0" class="tag_table"> <tbody> <?php query_posts( //'query_type = post&posts_per_page=8' array ( 'category_name' => 'business', 'posts_per_page' => 8 ) ); $i=0; while(have_posts()) : the_post(); $i++; ?> <tr> <td width="100%"> <ul> <li class="tag_title"> <a target="_blank" title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </li> </ul> </td> </tr> <?php endwhile; wp_reset_query(); ?> </tbody> </table> </div> </div> </div> <div id="frame-main-right" class="yui3-u-1-2"> <div class="module"> <div class="module-name"> <a href="/c6c7e7-1.html" target="_blank">通知公告</a> <a style="font-size:13px; margin-left:250px; color:blue;" target="_blank" href="/c6c7e7-1.html">更多</a> </div> <div class="module-spliter"> <div> </div> </div> <div class="module-warpper"> <table cellspacing="0" cellpadding="0" class="tag_table"> <tbody> <?php query_posts( //'query_type = post&posts_per_page=8' array ( 'category_name' => 'technolo', 'posts_per_page' => 8 ) ); $i=0; while(have_posts()) : the_post(); $i++; ?> <tr> <td width="100%"> <ul> <li class="tag_title"> <a target="_blank" title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_time('Y年n月j日'); ?> <?php the_title(); ?></a> </li> </ul> </td> </tr> <?php endwhile; wp_reset_query(); ?> </tbody> </table> </div> </div> </div> </div> <div id="frame-side" class="yui3-u"> <div id="placehoder"></div> <ul> <li><a target="" href="/906368.html">研究成果</a></li><li><a target="" href="/faef50-1.html">学术交流</a></li><li><a target="_blank" href="http://hyxy.tust.edu.cn/shiyanshifan/1shoye.html">实践教学</a></li><li><a target="" href="/ccac59.html">教学成果</a></li><li><a target="" href="/4d3baa-1.html">学生资助</a></li><li><a target="" href="/801d37-1.html">校友相聚</a></li><li><a target="" href="#">学术报告</a></li> </ul> </div> </div> <div id="frame-main-link" class="yui3-g"> <div> <div id="demo" style="overflow:hidden;height:110px;margin:0 auto;"> <table align="left" cellpadding="0" cellspace="0" border="0"> <tr> <td id="demo1" valign="top"> <div> <a style="width:0px;" href="/0c8a9f.html#ppzy" target="_blank"><img src="/static/imghw/default1.png" data-src="<?php bloginfo('template_url'); ? alt="How to imitate a WordPress site" >/picture/57243dbb36ec49fe8ea8839a947fe310.jpg" class="lazy" /></a><img src="/static/imghw/default1.png" data-src="<?php bloginfo('template_url'); ? alt="How to imitate a WordPress site" >/picture/869b86dfeae34a31b851fb01cec2b074.jpg" class="lazy" /><a style="max-width:90%" href="http://hyhjbhjs.cl1.soochong.com" target="_blank"><img src="/static/imghw/default1.png" data-src="<?php bloginfo('template_url'); ? alt="How to imitate a WordPress site" >/picture/2015-08-27-20-0606158108.jpg" class="lazy" /></a><img src="/static/imghw/default1.png" data-src="<?php bloginfo('template_url'); ? alt="How to imitate a WordPress site" >/picture/39bfa2a5c9be4d87bb8c50a886d3f3c0.jpg" class="lazy" /></div> </td> <td id="demo2" valign="top"> </td> </tr> </table> </div> </div> </div> </div> <?php get_footer(); ?>
For more wordpress-related technical articles, please visit the wordpress tutorial column to learn !
The above is the detailed content of How to imitate a WordPress site. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



WordPress is easy for beginners to get started. 1. After logging into the background, the user interface is intuitive and the simple dashboard provides all the necessary function links. 2. Basic operations include creating and editing content. The WYSIWYG editor simplifies content creation. 3. Beginners can expand website functions through plug-ins and themes, and the learning curve exists but can be mastered through practice.

WordPressisgoodforvirtuallyanywebprojectduetoitsversatilityasaCMS.Itexcelsin:1)user-friendliness,allowingeasywebsitesetup;2)flexibilityandcustomizationwithnumerousthemesandplugins;3)SEOoptimization;and4)strongcommunitysupport,thoughusersmustmanageper

Can learn WordPress within three days. 1. Master basic knowledge, such as themes, plug-ins, etc. 2. Understand the core functions, including installation and working principles. 3. Learn basic and advanced usage through examples. 4. Understand debugging techniques and performance optimization suggestions.

WordPress itself is free, but it costs extra to use: 1. WordPress.com offers a package ranging from free to paid, with prices ranging from a few dollars per month to dozens of dollars; 2. WordPress.org requires purchasing a domain name (10-20 US dollars per year) and hosting services (5-50 US dollars per month); 3. Most plug-ins and themes are free, and the paid price ranges from tens to hundreds of dollars; by choosing the right hosting service, using plug-ins and themes reasonably, and regularly maintaining and optimizing, the cost of WordPress can be effectively controlled and optimized.

Wix is suitable for users who have no programming experience, and WordPress is suitable for users who want more control and expansion capabilities. 1) Wix provides drag-and-drop editors and rich templates, making it easy to quickly build a website. 2) As an open source CMS, WordPress has a huge community and plug-in ecosystem, supporting in-depth customization and expansion.

The core version of WordPress is free, but other fees may be incurred during use. 1. Domain names and hosting services require payment. 2. Advanced themes and plug-ins may be charged. 3. Professional services and advanced features may be charged.

People choose to use WordPress because of its power and flexibility. 1) WordPress is an open source CMS with strong ease of use and scalability, suitable for various website needs. 2) It has rich themes and plugins, a huge ecosystem and strong community support. 3) The working principle of WordPress is based on themes, plug-ins and core functions, and uses PHP and MySQL to process data, and supports performance optimization.

WordPress is a Content Management System (CMS). It provides content management, user management, themes and plug-in capabilities to support the creation and management of website content. Its working principle includes database management, template systems and plug-in architecture, suitable for a variety of needs from blogs to corporate websites.
