WordPress.org

Support

Support » Themes and Templates » [Theme: Oxygen] Use Custom Post Types on Front Page

[Theme: Oxygen] Use Custom Post Types on Front Page

Viewing 2 replies - 1 through 2 (of 2 total)
  • anallabres
    Member

    @anallabres

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

    Thanks!

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Theme: Oxygen] Use Custom Post Types on Front Page’ is closed to new replies.