php为wordpress中的帖子创建小小的url(代码片段)

author author     2023-01-13     164

关键词:

//place in functions.php in theme folder
<?php function getTinyUrl($url)  $tinyurl = file_get_contents("http://tinyurl.com/api-create.php?url=".$url); return $tinyurl;  ?>
 
//call the function on the page
<a href="http://twitter.com/home?status=Currently reading <?php the_title(); ?> : <?php $turl = getTinyUrl(get_permalink($post->ID)); echo $turl ?>" title="Tweet this">Twitter link</a>

php将acf自定义字段保存为wordpress中的帖子标题(代码片段)

查看详情

如何在wordpress中为帖子创建自定义属性[关闭]

】如何在wordpress中为帖子创建自定义属性[关闭]【英文标题】:Howtocreatecustomattributeforpostinwordpress[closed]【发布时间】:2021-10-2119:23:36【问题描述】:我需要一些自定义属性用于wordpress中的帖子,我正在创建一个过滤功能,当任何... 查看详情

为 Wordpress 中的每个新帖子自动创建一个新的 Mailchimp 邮件列表(M​​ailchimp API 3.0+)

】为Wordpress中的每个新帖子自动创建一个新的Mailchimp邮件列表(M​​ailchimpAPI3.0+)【英文标题】:AutomaticallycreateanewMailchimpmailinglistforeachnewpostinWordpress(MailchimpAPI3.0+)【发布时间】:2018-06-2517:51:09【问题描述】:要求:创建新帖子... 查看详情

url中的wordpress自定义帖子类型类别slug

】url中的wordpress自定义帖子类型类别slug【英文标题】:wordpresscustomposttypecategorysluginurl【发布时间】:2017-02-2822:44:29【问题描述】:我有两个不同类别的自定义帖子类型(投资组合),然后我有2个页面显示来自这两个类别的帖子... 查看详情

php获取wordpress中主要帖子页面的url(代码片段)

查看详情

添加第二个 Wordpress 循环,显示 single.php 中的最新帖子

】添加第二个Wordpress循环,显示single.php中的最新帖子【英文标题】:AddasecondWordpressLoopthatdisplayslatestpostsinsingle.php【发布时间】:2014-07-2500:36:08【问题描述】:我正在创建自己的主题,但只有PHP的基本知识。我一直在寻找一种在... 查看详情

如何根据wordpress中的当前帖子自动选择一个值?

】如何根据wordpress中的当前帖子自动选择一个值?【英文标题】:Howtoautoselectavalueaccordingtocurrentpostinwordpress?【发布时间】:2021-04-3021:53:42【问题描述】:我正在尝试在single-services.php页面上显示自动选择值,而服务是我的自定义... 查看详情

php 创建 zip 文件(来自 post 附件 wordpress)

】php创建zip文件(来自post附件wordpress)【英文标题】:Phpcreatezipfile(frompostattachmentswordpress)【发布时间】:2012-03-2811:19:46【问题描述】:我正在尝试从wordpress中的帖子附件创建一个zip文件。我已经尝试了以下两种方法-但它没有任... 查看详情

Wordpress 如何创建自定义帖子模板

】Wordpress如何创建自定义帖子模板【英文标题】:Wordpresshowtocreatecustomposttemplate【发布时间】:2017-11-2012:01:49【问题描述】:Wordpress如何从INDEX.php的部分创建自定义帖子模板!在我的首页(Index.php)我有一个很棒的PostGrid。我想在每... 查看详情

为evernote中的wordpress帖子添加书签

ThiswillcreateabookmarklinktosendaWordpressposttoyourEvernoteAccountsimilartothesendtoGooglereaderfeatureontheEvernoteblog.<ahref="http://s.evernote.com/grclip?url=<?phpthe_permalink();?>&title=<?phpthe_title();?>">sendtoevernote</a> 查看详情

wordpress中具有自定义帖子类型的单个页面的层次结构(代码片段)

我有一个名为cities的自定义帖子类型。对于此自定义帖子类型,我将有N个城市相关。我正在尝试为这些页面创建文件,我认为这样可行:single.php-通用的single-cities.php-列出城市single-cities-city-slug.php-为城市提供信息当我尝试:/citi... 查看详情

php获取wordpress中的最新帖子(代码片段)

查看详情

为自定义帖子类型创建存档:wordpress

】为自定义帖子类型创建存档:wordpress【英文标题】:CreatearchiveforCustomPostType:wordpress【发布时间】:2016-08-2318:29:50【问题描述】:我已经为我的自定义帖子类型创建了一个archive.php。存档-CUSTOM_POSTTYPE.php我在其中放置了标准循环... 查看详情

Wordpress // 删除 URL 的帖子类型 slug

】Wordpress//删除URL的帖子类型slug【英文标题】:Wordpress//removeposttypeslugforURL【发布时间】:2019-03-1519:50:17【问题描述】:我创建了一个CPT和几个应用于此CPT的自定义分类法。目前我的网址如下(使用插件):www.example.com/[cpt]/[taxon... 查看详情

php从wordpress中的循环中排除粘滞帖子(代码片段)

查看详情

php检测wordpress循环中的最后一个帖子(代码片段)

查看详情

自动获取wordpress帖子的短url

thisishowtoautomaticallygetshorturlsforyourblogpostsinwordpress,WhatyouneedistodecidewhichtinyurlserviceyouwillbeusingandgetitsapiURL,forexamplerinyurl.com,bit,ly,tr.im,herearetheapiURLSforthemostfamousservices.tinyurl.com:http://tinyurl.com/api-create.php?url=is.gd:http://is.gd/api.php?longurl=href... 查看详情

在functions.php中获取wordpress帖子ID

】在functions.php中获取wordpress帖子ID【英文标题】:GettingwordpresspostIDinfunctions.php【发布时间】:2020-06-1219:01:43【问题描述】:我在Wordpress中使用JQuery表单,提交时会调用functions.php文件中的函数。我需要能够访问该函数(test_function)... 查看详情