• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Display List of Post Under the custom taxonomy in Genesis News Pro

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Display List of Post Under the custom taxonomy in Genesis News Pro

This topic is: not resolved

Tagged: custom taxonomy

  • This topic has 3 replies, 2 voices, and was last updated 8 years, 3 months ago by Brad Dalton.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • August 12, 2015 at 7:57 pm #162217
    jianpey
    Member

    Hi,

    I manage to create a new custom taxonomy (taxonomy = 'Locations') with the code below and able to show it below my post.
    But when I click the new taxonomy (eg. Locations) below my post,, suppose it will open a new page showing all the post under the taxonomy 'Locations'. It is showing 404 error pages.

    How can I do that?

    add_action( 'init', 'register_taxonomy_locations', 0 );
    function register_taxonomy_locations() {
    $labels = array(
    'name' => _x( 'Locations', 'taxonomy general name' ),
    'singular_name' => _x( 'Locations', 'taxonomy singular name' ),
    'search_items' => __( 'Search Locations' ),
    'popular_items' => __( 'Popular Locations' ),
    'all_items' => __( 'All Locations' ),
    'parent_item' => null,
    'parent_item_colon' => null,
    'edit_item' => __( 'Edit Locations' ),
    'update_item' => __( 'Update Locations' ),
    'add_new_item' => __( 'Add New Locations' ),
    'new_item_name' => __( 'New Locations Name' ),
    'separate_items_with_commas' => __( 'Separate locations with commas' ),
    'add_or_remove_items' => __( 'Add or remove locations' ),
    'choose_from_most_used' => __( 'Choose from the most used locations' ),
    'menu_name' => __( 'Locations' ),
    );

    register_taxonomy('locations','post',array(
    'hierarchical' => false,
    'labels' => $labels,
    'show_ui' => true,
    'show_admin_column' => true,
    'update_count_callback' => '_update_post_term_count',
    'query_var' => true,
    'rewrite' => array( 'slug' => 'locations' ),
    ));
    }

    add_filter( 'genesis_post_meta', 'register_locations' );
    function register_locations( $post_meta ) {
    if ( !is_page() ) {
    $post_meta = '[post_categories before="Categories: "] [post_tags before="Tags: "] [post_terms taxonomy="locations" before="Locations: "]';
    return $post_meta;
    }}

    http://www.malaysianflavours.com
    August 14, 2015 at 5:31 am #162349
    Brad Dalton
    Participant

    Re-save your Permalinks and see if that works.

    Note: The code you embedded is broken as it has not been embedded correctly so anyone trying to test it will discover it breaks their site.


    Tutorials for StudioPress Themes.

    August 15, 2015 at 3:18 am #162440
    jianpey
    Member

    I re-save the Permalinks and it works!

    Can you correct me which part of the code is not embedded correctly?

    August 15, 2015 at 6:22 am #162446
    Brad Dalton
    Participant

    Good stuff!

    All PHP code needs to be wrapped in tags. Please see the linked page in previous thread.


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble