简体   繁体   中英

How to add “edit post” function into a wordpress page in which I am echoing a specific page id?

I am currently working on a theme customization from elegant themes (Aggregate), but needed to customize the home page to have editable content. I have been successful in pulling in the content from a separate page id and echoing that information. My question is: is there a way to code the "edit post" function into the following code so that when the page content is echoed the "edit post" appears. Here's what I have so far.

 <div id="main_content" class="nobg">
 <?php 
 $id=5; 
 $post = get_post($id); 
 $content_post = get_post($my_postid);
 $content = $content_post->post_content;
 $content = apply_filters('the_content', $content);
 echo $content;?></div>

I appreciate any insight. I just need a quick way to get to the page content from the front of the site. I would be interested in a way to override the admin toolbar for the home page so that "edit page" opens up page id 5, if there's a way to do that. Thank you in advance for any guidance.

用这个:

edit_post_link('edit', '<p>', '</p>', 5);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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