Home  >  Article  >  CMS Tutorial  >  How to imitate a WordPress site

How to imitate a WordPress site

尚
Original
2019-07-12 17:16:4313192browse

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.

How to imitate a WordPress site

Save the file to wp-content/tust. The saved homepage default.html and other file directories are as follows:

How to imitate a WordPress site

Then create a standard wp file. As shown in the figure below:

How to imitate a WordPress site

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:

How to imitate a WordPress site

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.

 '' //指定显示的导航名,如果没有设置,则显示第一个  
'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'      => '
    %3$s
', 'depth' => 0,////显示的菜单层数,默认0,0是显示所有层 'walker' => ''// //调用一个对象定义显示导航菜单 )); ?>

After the modification of header.php on the home page is completed, it is roughly as follows:




	
	天津科技大学海洋与环境学院
	
	
	








	
	
	
	
	
	
	
	
	
	
	
	



'div','container_id' => 'navbar-middle','menu_class' => 'mlddm') ); ?>

4. Modify

in index.php. Here we first modify the carousel image, among which The modified code for the carousel image is as follows:


Then modify the list part of the article:

	
'business', 'posts_per_page' => 8 ) ); $i=0; while(have_posts()) : the_post(); $i++; ?>
'technolo', 'posts_per_page' => 8 ) ); $i=0; while(have_posts()) : the_post(); $i++; ?>

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!

php css html echo if while include 字符串 JS default http WordPress atom
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to delete comments in wordpressNext article:How to delete comments in wordpress

Related articles

See more