How to put own HTML into Wordpress theme?

寵の児 提交于 2019-12-08 10:45:33

问题


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.


回答1:


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.




回答2:


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




回答3:


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).




回答4:


First you have to check in wp-admin which theme is actives in your site suppose there are three theme and twenty eleven is active and you were checking twenty twelve so maybe this reason your new html will not shown in front-end so please check your current theme and work according to that from this location you can check it your current theme go to wp-admin => appearance => themes



来源:https://stackoverflow.com/questions/13423805/how-to-put-own-html-into-wordpress-theme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!