简体   繁体   English

手动获取主要Wordpress网站到Wordpress博客的链接

[英]Getting the links from main wordpress website to wordpress blog manually

I have my wordpress site and a wordpress blog, the blog is subfolder of main website like http://www.wordpress.com/blog/ 我有我的wordpress网站和一个wordpress博客,该博客是主要网站的子文件夹,例如http://www.wordpress.com/blog/

Now, i wanted to place the footer links of main website in blog footer, so that whenever i change the permalinks structure in main website then blog footer links also follow the same permalinks structure. 现在,我想将主网站的页脚链接放在博客页脚中,以便每当我更改主网站中的永久链接结构时,博客页脚链接也将遵循相同的永久链接结构。 I want to write a function like getpagelink and connect to main website database. 我想编写类似getpagelink的功能并连接到主网站数据库。 i can get the page IDs of each post but how can i get the permalinks of that particular page. 我可以获取每个帖子的页面ID,但是如何获取该特定页面的永久链接。

Or is there any other way i can achieve this? 还是有其他方法可以实现这一目标?

If I understand your request, you can get the permalink of any post ID (including pages) with the following code: 如果我理解您的要求,则可以使用以下代码获取任何帖子ID(包括页面)的固定链接:

<?php $permalink = get_permalink( $id ); ?>

See the Codex . 参见食品法典

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM