简体   繁体   中英

How to put own HTML into Wordpress theme?

I installed a Wordpress theme, but I would need to put there my own HTML code. So, I would suppose I'll go into: wp-content/themes/theme_name/header.php and on the needed place I inserted needed HTML code.

I did it, but it didn't affect the website - the newly put HTML elements are not seen in the website. Do I disregard anything? Or is needed to set up something in the WP administration? Or problem with cache?

Sorry, maybe a stupid queston, I am just playing with WP for the first time.

The pages of your blog are created from different theme "parts". header.php is one of them. it creates the header of the page. Usually, before most HTML is output. footer.php is used for the footer of the page. If you want your HTML code to go in the homepage only, use index.php (which calls header.php and footer.php ). If you want your code to show in a page, use page.php . If you want your code to show when viewing a post, use single.php . Hope this helps.

Look in your different pages if get_header() function is called correctly. It is this function that includes header.php .

Check also your "theme_name/inc" directory. Sometimes the header.php or footer.php can be placed in the main theme folder and in the inc. If that is the situation you need to make sure to be editing the right file (the one in /inc ).

首先,您必须在wp-admin中检查哪个主题在您的网站中处于活动状态,假设有三个主题并且二十一个处于活动状态,并且您正在检查二十二个,所以也许这就是您的新html不会在前端显示的原因,因此请检查您的当前主题并根据该位置工作,您可以从当前位置检查当前主题,然后转到wp-admin =>外观=>主题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM