首页 > 其他分享 >配置wordpress:自定义简码(wordpress 6.2)

配置wordpress:自定义简码(wordpress 6.2)

时间:2023-05-20 22:12:13浏览次数:51  
标签:简码 自定义 SERVER pageURL wordpress 6.2 https com

一,添加php代码的例子:

1,代码:

// 说明:得到当前时间
function lhdGetNowTime() {
	$now = date("Y-m-d H:i:s");
    return $now;
}
// 注册成简码,名字myNow
add_shortcode('myNow', 'lhdGetNowTime');

// 说明:获取完整URL
function curPageURL() { 
	$pageURL = 'http'; 
	if ($_SERVER["HTTPS"] == "on") {
		$pageURL .= "s"; 
	} 
	$pageURL .= "://"; 
	if ($_SERVER["SERVER_PORT"] != "80") { 
		$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; 
	} else { 
		$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; 
	} 
	return $pageURL;
}
// 注册成简码,名字myUrl
add_shortcode('myUrl', 'curPageURL');

如图:

把代码添加到functions.php中

2,在文章中引用简码:

当前是一个段落区块

二,测试效果

 

说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest

         对应的源码可以访问这里获取: https://github.com/liuhongdi/
         或: https://gitee.com/liuhongdi

说明:作者:刘宏缔 邮箱: [email protected]

三,查看wordpress的版本:

标签:简码,自定义,SERVER,pageURL,wordpress,6.2,https,com
From: https://www.cnblogs.com/architectforest/p/17417897.html

相关文章

  • 数据列表管理-底部的自定义代码参考
    <!--做数据的流转状态操作001--><divclass="div_bottom_control_location_area"id="div_rejected_or_approved"><buttononclick="submit_or_reject_for_review(0)"type="button"class="am-btnam-btn-dangerbtn_......
  • 数据列表管理-顶部查询条件的自定义代码参考
     银行:<selectid="sl_bank"class="fsbpmserachcontrolsearch_select"myts="sl"></select>状态:<selectid="sl_status_filter"class="fsbpmserachcontrolsearch_select"myts="sl"><......
  • 配置wordpress:在footer/页脚添加icp备案许可证号(wordpress 6.2)
    一,添加icp许可证号外观->主题文件编辑器->主题页脚:在class名为site-info的div中添加如下html代码:<div style="text-align:center"> <ahref="http://beian.miit.gov.cn/"class="imprint"rel="externalnofollow"target="_blank"......
  • el-table自定义表头
    实现效果<!--*@Descripttion:el-table自定义表头*@version:*@Author:zhangfan*@email:[email protected]*@Date:2020-05-1409:08:01*@LastEditors:zhangfan*@LastEditTime:2020-06-2918:53:17--><template><divclass="topCon......
  • el-tree实现自定义节点内容
    <!--*@Descripttion:el-tree实现自定义节点内容*@version:*@Author:zhangfan*@email:[email protected]*@Date:2020-07-0309:10:28*@LastEditors:zhangfan*@LastEditTime:2020-07-1611:21:20--><template><divclass="treeBo......
  • ExtJs GridPanel 自定义汇总
    {text:'订单金额',dataIndex:'amount',renderer:function(value){returnExt.util.Format.number(value,'0.00');},summaryType:function(records){varamount=0;varlength=records.length;for(var......
  • Vue 自定义指令实践
    Vue自定义指令一个自定义指令由一个包含类似组件生命周期钩子的对象来定义。钩子函数会接收到指令所绑定元素作为其参数。在 <scriptsetup> 中,任何以 v 开头的驼峰式命名的变量都可以被用作一个自定义指令。eg: 在上面的例子中,vFocus 即可以在模板中以 v-focus 的形......
  • CentOS 7 安装 WordPress
    参考0:https://blog.csdn.net/abcd5711664321/article/details/122554412参考1:https://www.yii666.com/article/551970.html参考2:https://www.cnblogs.com/yanans/p/12945001.html  修改文件/etc/httpd/conf/httpd.conf(一行不改也可以) 一行不改,原来是这样的   ......
  • \033[0m 有什么用——python 输出颜色自定义
    "\033"是什么?\033或\33相当于python中的关键字,可以改变输出字体的属性,具体参考ECMA-48标准《ControlFunctionsforCodedCharacterSets》参数有什么?字颜色:30-----------3730:黑31:红32:绿33:黄34:蓝色35:紫色36:深绿37:白色字背景颜色范围:40----47......
  • 折线图 最大值显示白点,默认显示tooltip框框,自定义tooltip
    效果图: 代码如下:(直接放整个vue文件了,省事)<template><div><divstyle="width:406px;height:220px"id="zz_r_two1"></div><divclass="xsTitle"><divclass="fang"></div>......