I've added categories and tags to pages, but now I'm trying to add these to a page, but it doesn't show anything unless I add the category to a post...

Could someone take a look at what I'm doing wrong?

  // The Query
  query_posts( array ( 'category_name' => 'powershell-start', 'posts_per_page' => -1 ) );

  // The Loop
 while ( have_posts() ) : the_post(); ?>
    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>

  <?php endwhile;

  // Reset Query


EDIT: I'm sorry I notice im not clear. I'm trying to show a specific category on a page with the tilte and link to each page. But the above part only works when I add the category to a post instead of a page.

This is what I added to my functions.php:

/* add categories and tags to pages */
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' );

(I can't comment) How I get it you want to show all posts on specific category on page?


But how you add categories on pages? Using plugin or?

Solution that worked:

Link - He haven't put more hooks and filters to his query

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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