Twenty Fourteen
[resolved] Custom Post Type as Featured content (4 posts)

  1. Zulfikar Nore
    Posted 1 year ago #

    I'm working on a filter to pull in pages and custom post types as replacement for posts for the featured content.

    I've hit a little blocker in terms of the CPT tag taxonomy - the custom taxonomy will not work unless it is of the post_tag type.

    My question is, is there anyway to override the set post_tag and use any custom registered taxonomy? I can setup a dropdown select option for all available types but as mentioned only the post_tag will work.

    Appreciate any help anyone can give on this.


  2. Zulfikar Nore
    Posted 1 year ago #

    Resolved this by way of a 3rd party plugin: http://wordpress.org/plugins/taxonomy-tools/ - it simply re-maps the custom taxonomies to post_tag.

  3. inkans
    Posted 1 year ago #

    It would be helpful if you could explain how you did it, I am also looking for a way to show pages as featured content.
    Thank you!

  4. Zulfikar Nore
    Posted 1 year ago #

    I'm actually working this option in to the Fourteen Extended plugin and it will be available soon for all Twenty Fourteen users.

    The basics are...

    1: Enable tags for pages via a function - something like

    if( ! function_exists('fourteenxt_register_taxonomy') ){
        function fourteenxt_register_taxonomy() {
            register_taxonomy_for_object_type('post_tag', 'page');
        add_action('admin_init', 'fourteenxt_register_taxonomy');

    Then I set up options in the Customizer to set the number of posts, the content type i.e posts, pages or custom post type via $post_types = get_post_types(); - the values are then passed to a twentyfourteen_get_featured_posts filter via a function callback.

    2: The rest of the code is a bit long and involved to paste here - you can grab the Beta version of the plugin here: Fourteen Extended Beta and have a look at the code. You can either use the plugin or pull out what you need and use it :)

    If you are going to incorporate the code in to a child theme then take a look at how I've done it in Ridizain: http://wordpress.org/themes/ridizain/developers/ - you'll want to grab the version 1.0.19 for the code.

    3: Most custom post types don't use the standard WordPress post_tag for their taxonomies - this is where the Taxonomy Tools plugin comes in handy.

    Once everything is set up you'll be able to use pages or custom post types as featured content.

    EDIT: Not sure if its permissible to post the zip link in the thread - if Mods object please remove it :)

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic