Tags on Pages?

Posted in: Newspaper
Post count: 174

Is there a way to put tags on pages through the theme? Or any other solution like plugin or function. Thanks

Post count: 9544

WordPress doesn’t have ‘tags’ built in for pages; so probably simplest way is via a plugin, or using custom fields. Or the ACF plugin (what I use). I actually use ACF to make a custom sub-head section after title, before post, where I can put in HTML if I want. I place the ACF field in the page template.

But at base level — ‘tags’ are not part of theme, but part of WordPress — so you may notice no option on page editor for tags, as WP doesn’t include them by default.

I don’t have a simpler solution; but perhaps simple ‘filter’ for functions.php to ‘add tag support to pages’ is available? I did this to add ‘excerpts’ – actually.

Not sure any of that is specific enough. Don’t work here. Stuck waiting on bunches of things to run this week, and killing time on dozen websites since I’m trapped here for awhile. 🙂

Post count: 174

Thanks for the info. Lol I hear ya.
I have 1000 ideas for things I want to add to my site but always get tangled with this kinda stuff lol.

Googled and found this code to put in functions.php. Now pages have tags and categories, nice

function add_taxonomies_to_pages() {
register_taxonomy_for_object_type( ‘post_tag’, ‘page’ );
register_taxonomy_for_object_type( ‘category’, ‘page’ );
}
add_action( ‘init’, ‘add_taxonomies_to_pages’ );
if ( ! is_admin() ) {
add_action( ‘pre_get_posts’, ‘category_and_tag_archives’ );

}
function category_and_tag_archives( $wp_query ) {
$my_post_array = array(‘post’,’page’);

if ( $wp_query->get( ‘category_name’ ) || $wp_query->get( ‘cat’ ) )
$wp_query->set( ‘post_type’, $my_post_array );

if ( $wp_query->get( ‘tag’ ) )
$wp_query->set( ‘post_type’, $my_post_array );
}

http://spicemailer.com/wordpress/add-categories-tags-pages-wordpress/

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.