Use Custom Post Types on Front Page (3 posts)

  1. gsarcasm
    Posted 4 years ago #


    I'm using a series of custom post types and wanted to post them to the front page. But the "locations" options that are available on a standard post aren't available. Any idea how i enable them for custom posts.



  2. anallabres
    Posted 3 years ago #

    Trying to do the same here. Did you find out?


  3. Chris Knowles
    Posted 3 years ago #

    There are 2 steps to get custom content types onto the front page:

    1. Enable the location meta box on the content types
    2. Change the queries so that custom types are included

    If you haven't already created a child theme then you should do so, as it is much easier to keep track of your modifications and remove them, if necessary.

    1. If you don't already have a functions.php in your child theme, create one. Then add the following:

    add_action( 'add_meta_boxes', 'oxygen_create_metabox_2' );
    function oxygen_create_metabox_2() {
        add_meta_box( 'oxygen_metabox', __( 'Location', 'oxygen' ), 'oxygen_metabox', '<content-type-name>', 'side', 'low' );

    Add an add_meta_box call for each content type. Remember to use the plural name for your type, so "types" not "type".

    Edit a custom type entry and you should now see the Location metabox.

    2. To get the content in the featured slider, copy the themes/oxygen/featured-content.php to your child theme folder.

    Near the top, where the $args variable is defined, we need to add the "post_type" argument and set it to "any", as follows:

    $args = array( 'posts_per_page' => 6, 'meta_key' => '_oxygen_post_location', 'meta_value' => 'featured', 'post__not_in' => get_option( 'sticky_posts' ), 'post_type' => 'any' );

    If you have assigned some of your custom content types to the "featured" location then you should see them in the slider.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic