Site logo

[Resolved] Add categories to Pages

Home Forums Support [Resolved] Add categories to Pages

Home Forums Support Add categories to Pages

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • #1834515
    David
    Staff
    Customer Support

    I am sure they had there reasons 🙂

    #1834517
    Marc

    Guess so…

    But if we can have a chopper flying at Mars, this should be a piece of cake 😉

    #2392050
    Casey

    Two things with this :

    Added the Function Code and i get:
    1) the JSON Error when saving
    — “Updating failed. The response is not a valid JSON response.”
    2) No Category Selector on Page

    Thoughts?

    Here’s the Code :

    <!–Add Categories to Pages –>
    <?php

    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 );
    }
    ?>

    #2392665
    David
    Staff
    Customer Support

    Hi there,

    where did you add the code ?

Viewing 4 posts - 16 through 19 (of 19 total)
  • You must be logged in to reply to this topic.