开发者

how can replace some of words when I added post from

开发者 https://www.devze.com 2023-01-11 03:05 出处:网络
my friends .. I want to design a small plugin .. it is work is: when the user write a post for example :

my friends ..

I want to design a small plugin ..

it is work is: when the user write a post for example :

<< WordPress >> widgets are the dynamic objects which eases the customization of the content on << sidebars >> and widgetized << footers >>. << Widgets >> allows drag-n-drop interface in the Dashboard << admin panel >>, for easy << management >>.

directly the plugins search about the words which between <<..>> then search in the db for wordpress if there a title like this word. if it exist replace it by the url of page .. if it not exist create a new page with some 'text .. ect' then replace the word by the url of page.

for e开发者_开发问答xample : when I wrote these: << wordpress >> widgets are the dynamic << objects >> . the plugins search about 'wordpress' in the title pages if it existe set the url: wordpress. then the plugins search about ' objects' in the title pages if it not exist the first step: create a page: object then fill it some text the final step . replace the word << objects >> , by the url of the post of object ,

I want to know how to do it. Give me example I will try to develompe it .

Thank you very much ..


You could use preg_replace to find the "<>" pattern and replace it.

WordPress provides a Class: wpdb to interact with the database.

You could query the db for the title, create a link to the page, and replace the text pattern with the link.

I don't know about creating a page dinamically with a plugin though...

0

精彩评论

暂无评论...
验证码 换一张
取 消