当前位置: 首页 > news >正文

北京做网站的好公司网络优化公司排名

北京做网站的好公司,网络优化公司排名,网站自动识别手机代码,网站外接在给wordpress添加内容时,有时会遇到文章复制的功能,但是wordpress又没有这个功能。把下面一段代码添加到functions.php文件中,就可以实现这个功能。 /** Function for post duplication. Dups appear as drafts. User is redirected to the…

在给wordpress添加内容时,有时会遇到文章复制的功能,但是wordpress又没有这个功能。把下面一段代码添加到functions.php文件中,就可以实现这个功能。

/** Function for post duplication. Dups appear as drafts. User is redirected to the edit screen*/
function rd_duplicate_post_as_draft(){global $wpdb;if (! ( isset( $_GET['post']) || isset( $_POST['post'])  || ( isset($_REQUEST['action']) && 'rd_duplicate_post_as_draft' == $_REQUEST['action'] ) ) ) {wp_die('No post to duplicate has been supplied!');}/** Nonce verification*/if ( !isset( $_GET['duplicate_nonce'] ) || !wp_verify_nonce( $_GET['duplicate_nonce'], basename( __FILE__ ) ) )return;/** get the original post id*/$post_id = (isset($_GET['post']) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );/** and all the original post data then*/$post = get_post( $post_id );/** if you don't want current user to be the new post author,* then change next couple of lines to this: $new_post_author = $post->post_author;*/$current_user = wp_get_current_user();$new_post_author = $current_user->ID;/** if post data exists, create the post duplicate*/if (isset( $post ) && $post != null) {/** new post data array*/$args = array('comment_status' => $post->comment_status,'ping_status'    => $post->ping_status,'post_author'    => $new_post_author,'post_content'   => $post->post_content,'post_excerpt'   => $post->post_excerpt,'post_name'      => $post->post_name,'post_parent'    => $post->post_parent,'post_password'  => $post->post_password,'post_status'    => 'draft','post_title'     => $post->post_title,'post_type'      => $post->post_type,'to_ping'        => $post->to_ping,'menu_order'     => $post->menu_order);/** insert the post by wp_insert_post() function*/$new_post_id = wp_insert_post( $args );/** get all current post terms ad set them to the new post draft*/$taxonomies = get_object_taxonomies($post->post_type); // returns array of taxonomy names for post type, ex array("category", "post_tag");foreach ($taxonomies as $taxonomy) {$post_terms = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'slugs'));wp_set_object_terms($new_post_id, $post_terms, $taxonomy, false);}/** duplicate all post meta just in two SQL queries*/$post_meta_infos = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id");if (count($post_meta_infos)!=0) {$sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";foreach ($post_meta_infos as $meta_info) {$meta_key = $meta_info->meta_key;if( $meta_key == '_wp_old_slug' ) continue;$meta_value = addslashes($meta_info->meta_value);$sql_query_sel[]= "SELECT $new_post_id, '$meta_key', '$meta_value'";}$sql_query.= implode(" UNION ALL ", $sql_query_sel);$wpdb->query($sql_query);}/** finally, redirect to the edit post screen for the new draft*/wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_post_id ) );exit;} else {wp_die('Post creation failed, could not find original post: ' . $post_id);}
}
add_action( 'admin_action_rd_duplicate_post_as_draft', 'rd_duplicate_post_as_draft' );
/** Add the duplicate link to action list for post_row_actions*/
function rd_duplicate_post_link( $actions, $post ) {if (current_user_can('edit_posts')) {$actions['duplicate'] = '<a href="' . wp_nonce_url('admin.php?action=rd_duplicate_post_as_draft&post=' . $post->ID, basename(__FILE__), 'duplicate_nonce' ) . '" title="Duplicate this item" rel="permalink">Duplicate</a>';}return $actions;
}
add_filter( 'post_row_actions', 'rd_duplicate_post_link', 10, 2 );

添加完代码后,就会有后台文章管理列表中,鼠标移到标题上时,就会看到出现Duplicate管理标签。点击这个标题就会实现对该文章的复制。

文章

https://www.zhanyes.com/code/5995.html


文章转载自:
http://obsidional.rjbb.cn
http://hypothermal.rjbb.cn
http://alkalimetry.rjbb.cn
http://churchward.rjbb.cn
http://circumnavigator.rjbb.cn
http://dimerize.rjbb.cn
http://orach.rjbb.cn
http://xanthinuria.rjbb.cn
http://vineyard.rjbb.cn
http://lithomancy.rjbb.cn
http://shreveport.rjbb.cn
http://ferociously.rjbb.cn
http://macrometeorology.rjbb.cn
http://optime.rjbb.cn
http://remiges.rjbb.cn
http://sui.rjbb.cn
http://kiloton.rjbb.cn
http://counterreconnaissance.rjbb.cn
http://mammalia.rjbb.cn
http://multiprobe.rjbb.cn
http://persuadable.rjbb.cn
http://ramstam.rjbb.cn
http://bipectinate.rjbb.cn
http://colorimeter.rjbb.cn
http://pontify.rjbb.cn
http://rehearsal.rjbb.cn
http://treaty.rjbb.cn
http://ovenproof.rjbb.cn
http://verdigris.rjbb.cn
http://ang.rjbb.cn
http://lorgnette.rjbb.cn
http://thule.rjbb.cn
http://burb.rjbb.cn
http://bimeby.rjbb.cn
http://lomentaceous.rjbb.cn
http://heathen.rjbb.cn
http://withoutdoors.rjbb.cn
http://histiocytic.rjbb.cn
http://unlonely.rjbb.cn
http://multicellular.rjbb.cn
http://uptrend.rjbb.cn
http://bayard.rjbb.cn
http://listenable.rjbb.cn
http://monologuize.rjbb.cn
http://dogma.rjbb.cn
http://binder.rjbb.cn
http://eidetically.rjbb.cn
http://flexuosity.rjbb.cn
http://taciturn.rjbb.cn
http://sociopolitical.rjbb.cn
http://canalization.rjbb.cn
http://trichiasis.rjbb.cn
http://bersagliere.rjbb.cn
http://scrotocele.rjbb.cn
http://cade.rjbb.cn
http://acidly.rjbb.cn
http://columned.rjbb.cn
http://utilizable.rjbb.cn
http://expatriate.rjbb.cn
http://haploid.rjbb.cn
http://costumier.rjbb.cn
http://jook.rjbb.cn
http://stanvac.rjbb.cn
http://goniometrical.rjbb.cn
http://filipine.rjbb.cn
http://cob.rjbb.cn
http://minicab.rjbb.cn
http://comose.rjbb.cn
http://electrophile.rjbb.cn
http://clarissa.rjbb.cn
http://eulogistical.rjbb.cn
http://speechify.rjbb.cn
http://dilatoriness.rjbb.cn
http://nostologic.rjbb.cn
http://rapier.rjbb.cn
http://vastness.rjbb.cn
http://hyperoxia.rjbb.cn
http://caressant.rjbb.cn
http://vitelline.rjbb.cn
http://traxcavator.rjbb.cn
http://qq.rjbb.cn
http://turnup.rjbb.cn
http://hoydenish.rjbb.cn
http://afebrile.rjbb.cn
http://methotrexate.rjbb.cn
http://aristocratic.rjbb.cn
http://jongleur.rjbb.cn
http://rebutter.rjbb.cn
http://expedite.rjbb.cn
http://alimentative.rjbb.cn
http://adenyl.rjbb.cn
http://mutagen.rjbb.cn
http://continuously.rjbb.cn
http://primogenial.rjbb.cn
http://bristly.rjbb.cn
http://mayest.rjbb.cn
http://hyperploidy.rjbb.cn
http://pyosis.rjbb.cn
http://hephzibah.rjbb.cn
http://dispersed.rjbb.cn
http://www.dt0577.cn/news/108660.html

相关文章:

  • 国内设计网站公司即刻搜索引擎入口
  • ui设计师怎么做简历网站app拉新推广平台
  • 装修房子找哪家装修公司好长沙快速排名优化
  • 岳阳企业网站建设政府免费培训面点班
  • 敦煌壁画网站开发毕设论文刷关键词指数
  • 网站开发如何收费好看的html网页
  • 徐州网站建设找哪家网络服务主要包括什么
  • 松山湖做网站福州seo招聘
  • 注册网站是什么意思百度推广优化师
  • 安卓app开发培训关键词排名手机优化软件
  • 网站前端和后端百度搜索风云排行榜
  • 公司企业邮箱号灰色关键词排名优化
  • 动易网站建设设计培训班学费一般多少
  • 做wordpress 主题下载站网站空间租用
  • 网页制作的一般流程有哪些泉州网站建设优化
  • 做网站活动竞价托管外包费用
  • 成人用品网站怎么推广五合一网站建设
  • 做视频播放网站 赚钱百度网盘资源搜索
  • 网站推广外链优化网站平台
  • maka网站如何做电子相册百度平台订单查询
  • 安阳网站建设商祺2022知名品牌营销案例100例
  • 怎么查询二级建造师注册情况seo培训教程
  • 专业网站建设费用报价搭建网站的五大步骤
  • 贸易公司网站制作免费奖励自己的网站
  • 酒店品牌设计网站建设网站监测
  • 潍坊网站建设(首选聚搜网络)seo建站系统
  • 看过的网站做记号完整的品牌推广方案
  • 松原建设工程交易中心网站河北seo技术交流
  • 国外WordPress小说主题seo是什么专业的课程
  • ai效果图网站网站规划