• •
;%20?>/images/610x150.gif)
在mytheme目录下创建 index.php ,style.css 两个文件,在wp后台 外观->主题 中就可以看到刚创建的主题
打开style.css文件输入
*/
?>
/*
Theme Name: 这里填主题名称
Theme URI: 这里填主题介绍的网址,没有就填你的博客网址吧
Description:这里填主题的简短介绍
Author: 作者名
Author URI: 作者的网址
Version: 版本号
Tags: 标签,多个用半角逗号隔开
*/
/*
在后台主题管理中即可看到主题相关信息,css中主题信息内容必须用注释符号括起来
找一个300*225的png图片,命名为 screenshot.png 放在主题目录下(mytheme文件夹中),在主题管理页中即可看到新建主题的预览图片
//==================================================header================================================================
可以把网站相同头内容放在一个头文件中,在主题目录下新建 header.php 文件向其中输入输入 统一的头部内容
在 index.php 或想调用该header.php页面的页面中 输入
*/
get_header(); //get_header()就相当于将header.php中的代码拷贝到当前的php文件
/*
在主题管理页面,该主题实时预览中,默认打开的 index.php 页面中即可引入 header.php 页面的内容
header.php 将会被所有的模板页面(主页、分类页、页面、标签页等)所包含,所以 header.php 中代码应该是动态的。
不同页面的title都是不一样,而且title的设置还会直接影响到SEO的效果,所以这里应该谨慎设置。下面提供一种SEO优化的title写法,
在header.php页面添加
*/
?>
/*
显示菜单栏,这里只在菜单栏中列出分类页和page页面,可以根据喜好来列出想要的。header.php中
*/
?>
if (! function_exists ( 'dynamic_sidebar' ) || ! dynamic_sidebar ( 'Second_sidebar' )) :
?>
if (! function_exists ( 'dynamic_sidebar' ) || ! dynamic_sidebar ( 'Third_sidebar' )) :
?>
if (! function_exists ( 'dynamic_sidebar' ) || ! dynamic_sidebar ( 'Fourth_sidebar' )) :
?>
制作index.php 文章列表
例子
*/
?>
the_permalink(); 当前指向文章的连接地址
the_title(); 当前指向文章的标题
the_tags('标签:'); 当前指向文章的标签
comments_popup_link('0 条评论', '1 条评论', '% 条评论', '', '评论已关闭'); 显示打印当前指向文章的评论链接
edit_post_link('编辑', ' • ', ''); 当前指向文章,显示打印当前指向文章的编辑链接
the_excerpt(); 当前指向文章,只要在写文章的时候在"摘要"框内填写摘要,在首页显示的就是摘要,如果不填就输出全文!
the_content('阅读全文...'); 用于输出当前指向文章全文,除非在文章中使用了
the_permalink(); 返回当前指向文章阅读全文的连接地址
previous_posts_link('next_posts_link('查看旧文章 >>', 0); 显示打印当前显示列表分页连接
the_time('Y年n月j日');显示日期如 1999年5月1日
另外,还有个存档页面的模板archive.php,跟index.php的制作过程完全一样,只不过需要在functions.php里添加一个函数
单文章页single.php,可以根据index.php页往这里添加自己想要显示的内容
page.php 也就是页面,博客上的所有网页都是页面,这里指的页面一个单独的页面,如"关于"、"联系方式"等,可以在WordPress后台 – 页面,进行页面的添加修改等。
可根据之前函数添加本页内容
*/
while (have_posts()) :
the_post(); update_post_caches($posts);
endwhile;
/*
update_post_caches($posts); 该函数重置文章缓存且未被记录。仅在页面的第一次循环检索到文章子集时,第二次循环可执行基本循环。
常用函数
get_avatar($comment, 48); 获取评论者的gravatar头像,尺寸为48 * 48
comment_reply_link() 回复留言的链接
get_comment_time('Y-m-d H:i'); 获取评论发布时间
edit_comment_link('修改'); 管理员修改评论的链接
comment_text() 输出评论内容
is_user_logged_in() 判断用户是否登录
wp_login_url( get_permalink() ); 博客登录地址
get_comment_author_link() 用于获取评论者博客地址
$comment_author 读取cookie,如果该用户之前已经发表过评论则自动帮助用户填写用户名
$comment_author_email 读取cookie,如果该用户之前已经发表过评论则自动帮助用户填写Email
$comment_author_url 读取cookie,如果该用户之前已经发表过评论则自动帮助用户填写博客地址
do_action(‘comment_form', $post->ID) 该函数为某些插件预留
wp_logout_url(get_permalink()) 退出登录的链接
*/
/*
创建模板文件
*/
/*
Template Name: 自建模板
*/
/*
模板文件中添加如上注释代码,模板文件名任意,在新建页面时模板选择即可显示 自建模板 来使用此模板
可添加想要的模板样式及页面内容,新建页面时只填标题不写内容,相当创建一个页面链接地址,新建页面存在 数据前缀_posts 表中
获取到页面地址后,在写地址时可在后添加参数,则转到该页时可通过$_GET,$_POST接收
可以单独建一个表存储地址,及所属页面类型,及各页面子父级关系,在插件中进行控制
wordpress fixed link
If it is not easy to modify the wordpress fixed link, open the option
#LoadModule rewrite_module modules/mod_rewrite.so in the apache configuration file httpd.conf
Remove the leading #, And change all AllowOverride None to AllowOverride all
If it is not an Apache server, but IIS is used for debugging, then you have to install an "ISAPI_Rewrite3_0069_Lite.msi" filter, and then set PHP as a priority in the site settings. .
Create a widget
Create a new custom file mytool.php in the theme directory with any file name and content
Then add the following code in functions.php
*/
register_sidebar_widget ( "I "Widget", "mytool_fun" ); // "My Gadget" is the name of the gadget displayed in the background, and mytool_fun is the method name for introducing the content of the self-built gadget page
function mytool_fun() {
include ( TEMPLATEPATH . "/mytool.php");
}
/*
You can see the customized gadget in the background gadget. After adding it, you can see the self-built gadget on the front page. Content of the page
*/
?>
What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.
PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.
PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.
PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.
PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.
PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.
PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip
PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.
AI-powered app for creating realistic nude photos
Online AI tool for removing clothes from photos.
Undress images for free
AI clothes remover
Generate AI Hentai for free.
Powerful PHP integrated development environment
Easy-to-use and free code editor
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
Small size, syntax highlighting, does not support code prompt function
Visual web development tools