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 have a long document that I am publishing as a page and splitting into sub-pages using page breaks <!--nextpage-->.

I am trying to find out if it is possible somehow to add tags to these sub-pages.

I can't seem to find a plugin or a tutorial out there on this subject.

Any help?

share|improve this question
    
Please post your code. I don't that pagination should necessarily effect the tag display. It has something to do with your particular theme code. –  s_ha_dum Dec 14 '12 at 14:24
    
I don't have any code. I just have a page into which I have inserted <!--nextpage--> which breaks the page up into sub-pages. I would like to add specific tags to these subpages. –  user18577 Dec 14 '12 at 14:28
    
Yes, you do have code. If you didn't the site wouldn't work. It is probably in index.php or single.php. If you tell me the URL for the problem page I might be able to tell you exactly. –  s_ha_dum Dec 14 '12 at 14:31
    
I just have a default install of wordpress with no additional code added yet. I was hoping to simply add a plugin or some code snippets to functions.php to add the tags functionality. –  user18577 Dec 14 '12 at 14:32
    
What theme are you using? –  s_ha_dum Dec 14 '12 at 14:34

1 Answer 1

You have to add tag support to your Pages.

function page_tags() {
   register_taxonomy_for_object_type('post_tags','pages'); // adds tag support
   add_meta_box('tagsdiv-page_tag','tags','post_tags_meta_box','page','side','low'); // adds the meta box itself
}
add_action('admin_init','page_tags');

You still won't see tags anywhere. You can move the meta box around using the 'side' and 'low' parameters. See the link below.

Now look in TwentyEleven's content-single.php and find the get_the_tag_list line. That is the part you want. You need to edit content-page.php to look like ...

<footer class="entry-meta">
    <?php echo get_the_tag_list( '', __( ', ', 'twentyeleven' ) ); ?>
    <?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-meta --> 

That should do it.

Be aware that editing a default theme is dangerous. It will be overwritten when you update. You should be creating a child theme.

http://codex.wordpress.org/Function_Reference/register_taxonomy_for_object_type

http://codex.wordpress.org/Function_Reference/add_meta_box

share|improve this answer
    
Thanks. But will this allow me to tag sub-pages created by using the <!--nextpage--> tag? These have the URL structure: www.mysite.com/mypage/1 , www.mysite.com/mypage/2 , www.mysite.com/mypage/3 , www.mysite.com/mypage/4 . From the dashboard they are all part of the same page. But they are separated on the frontend. –  user18577 Dec 14 '12 at 15:39
    
You want to individually tag subpages? –  s_ha_dum Dec 15 '12 at 15:45
    
yes - I need to tag individual sub-pages –  user18577 Dec 17 '12 at 10:20
    
Each sub-page with different tags? There is nothing built in that will do that, and I don't think it is a simple hack. Tags apply to the post and a paginated post is still just one post. –  s_ha_dum Dec 17 '12 at 14:13

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.