WordPress - 定义Peramlink并在函数.php的URL中调用它


Wordpress - Define Peramlink and call it within URLs within functions.php

是否可以在函数中定义WordPress Permalink.php使用如下内容:

<?php $permalink = the_permalink;?>

其中"the_permalink"使用内置的WordPress函数来获取博客的永久链接,然后在函数中进一步使用$permalink.php例如,使用图像URL:<img src="'.$permalink.'/images/image1.png'"/>

我只需要将Peramlink拉入函数中.php以便在文件中进一步使用,如上例所示。 无论是the_permalink还是bloginfo('template_directory')都会很好用。

您可以在函数中传递 ID...比如你的函数($id(,然后在你的实际函数中使用get_permalink($id(。

通常,the_permalink用于要显示和格式化永久链接的情况,get_permalink允许您将其传递给变量。

http://codex.wordpress.org/Template_Tags/get_permalink

我自己想通了。 我最终在我的函数中使用以下链接结构.php文件

<img src="'.get_bloginfo('stylesheet_directory').'/images/map-point-medical.png"/>