Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i create a new post-type called servizi. I customize the permalink for this structure: /%post_id%/%postname%/ But there are a different width post link . For example the post link is www.mysite.it/site-wp/25/postname/ and the servizi's link is www.mysite.it/site-wp/servizi/postname/. I dont't understand what is the trouble .

In details page how can take the post_id variable? I use $_GET or i customize my function.php with special function?

Someone can i help me please?

share|improve this question

1 Answer 1

Is the reason you are adding the post_id to the URL because you are you trying to access the post_id variable in the template? You can do so much more easily by accessing it in the Loop of your template file

<?php 
if ( have_posts() ) : 
    while ( have_posts() ) : 
        the_post();
        // Two ways to get the Post ID //
        echo $post -> ID; 
        echo get_the_ID();
    endwhile; ?>
endif; 
?>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.