php - custom permalink issue on wordpress -


i created plugin , accessed plugin page using code:

add_filter('page_template', 'in_page_template4' );   function in_page_template4(){   global $wpdb;   $new_page_title = 'inventory';   $new_page_title1 = 'inventory-details';    $new_page_title2 = 'spanos-inventory';     $new_page_title3 = 'trade-in-inventory';     $ppid=$_get['page_id'];   $sql = "select * wp_posts id='".$ppid."';";  // $sql = "select * wp_posts post_name='".$new_page_title."';";   $cnt_post = $wpdb->get_results($sql);    if(count($cnt_post)!=0){ $page_title=$cnt_post[0]->post_name;       if($new_page_title==$page_title){          $page_template = dirname( __file__ ) . '/car_inventory.php';         return $page_template;       }elseif($new_page_title1==$page_title){         $page_template = dirname( __file__ ) . '/inventory_details.php';         return $page_template;       }       elseif($new_page_title2==$page_title){         $page_template = dirname( __file__ ) . '/car_inventory.php';         return $page_template;       }         elseif($new_page_title3==$page_title){         $page_template = dirname( __file__ ) . '/car_inventory.php';         return $page_template;       }    } } 

if using default permalink plugin working nicely when used custom permalink plugin page showing page not found error.

in attempts answer question would want change section

dirname( __file__ ) 

to actual directory want if want plugin dir

plugin_url('car_inventory.php'); 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -