我将使用此永久链接设置www."mywebsite".com/12331406
现在聋人帖子链接> post_type
我有www."mywebsite".com/onur/post-title
简单: onur
onur的帖子使用这个永久链接> www."mywebsite".com/12331406
但我需要> www."mywebsite".com/onur/12331406
或/ else> function getSelectedText() {
var text = "";
if (typeof window.getSelection != "undefined") {
text = window.getSelection().toString();
} else if (typeof document.selection != "undefined" && document.selection.type == "Text") {
text = document.selection.createRange().text;
}
return text;
}
function doSomethingWithSelectedText() {
var selectedText = getSelectedText();
if (selectedText) {
alert("Got selected text " + selectedText);
}
}
document.onmouseup = doSomethingWithSelectedText;
document.onkeyup = doSomethingWithSelectedText;
没有问题。
任何帮助......?
答案 0 :(得分:0)
我这样做了你想要的但我不知道这是否适合你
只需在 functions.php 文件
中添加add_filter('post_type_link', 'woorei_33551_custom_listing_permalink', 1, 3);
function woorei_33551_custom_listing_permalink($post_link, $post = 0, $leavename) {
if ( $post->post_type == 'CUSTOM_POST_TYPE' ) {
//You can whatever you want to instead of post id
return home_url( '/' . $post->ID);
}
else {
return $post_link;
}
}
add_action( 'init', 'woorei_33551_rewrites_init' );
function woorei_33551_rewrites_init(){
add_rewrite_rule(
'([0-9]+)?$',
'index.php?post_type=CUSTOM_POST_TYPE&p=$matches[1]',
'top' );
}