This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Post Options to Custom Post Type

Viewing 10 replies - 1 through 10 (of 10 total)
  • Author
    Replies
  • #23894
    Jason Bobich
    Keymaster

    Hi,

    You’d do it like this:

    function my_post_meta( $setup ) {
        $setup['config']['page'][] = 'your_post_type';
        return $setup;
    }
    add_filter( 'themeblvd_post_meta', 'my_post_meta' );

    And our Portfolios plugin serves as a really good example for incorporating a bunch of items in the framework with a custom post type.

    https://github.com/themeblvd/Theme-Blvd-Portfolios/blob/master/tb-portfolios.php

    #23895
    bchastain
    Participant

    Thanks Jason,

    I’m afraid I might need a bit more “hand holding” 🙂 Where exactly would I need to put that code. Would I have to create a similar “plugin”?

    Thanks again.

    #23896
    Jason Bobich
    Keymaster

    Any kind of PHP code like that where you’re working with actions and filters is going to go in your child theme’s functions.php

    There’s a sample child theme included in your download package from ThemeForest. Here’s more info on that:

    https://vimeo.com/70832266

    #23897
    bchastain
    Participant

    Wow. Ok, that was easy. Thanks for the help Jason!

    #23898
    bchastain
    Participant

    Hmmm. Ok, I got the options to show up in the custom post type admin but it’s not showing on the frontend.

    custom post type is “hymn” Thanks.

    <?php
    /*——————————————————-*/
    /* Run Theme Blvd framework (required)
    /*——————————————————-*/

    require_once( get_template_directory() . ‘/framework/themeblvd.php’ );

    /*——————————————————-*/
    /* Start Child Theme
    /*——————————————————-*/

    /**
    * Maintain options ID for saved options from parent
    * theme. (optional)
    *
    * This allows you to switch between parent and child theme,
    * with your theme options remaining saved to the same value
    * in your WordPress database.
    */
    function tb_demo_option_id( $id ) {
    return ‘denali’;
    }
    add_filter(‘themeblvd_option_id’, ‘tb_demo_option_id’);

    /**

    * Setup Post Options on Custom Post Type Hymns

    */

    function my_post_meta( $setup ) {
    $setup[‘config’][‘page’][] = ‘hymn’;
    return $setup;
    }
    add_filter( ‘themeblvd_post_meta’, ‘my_post_meta’ );

    #23899
    Jason Bobich
    Keymaster

    What’s not showing on the frontend specifically? Something related to one of the options?

    #23900
    bchastain
    Participant

    I selected full screen paralax for the image and it’s just showing a standard width image. Also, I specified using Drop cap and that’s not showing either.

    http://blaynechastain.net/index.php/hymn/test/

    #23915
    Jason Bobich
    Keymaster

    I tested this on my end to give you a more specific answer. So first off, all of those post options should be working except for the two you specifically mentioned.

    1. The dropcap option is only for standard posts. Apologies for the confusion, I’ve added a note in the option’s description for the next theme update. The reason is because the option ties into the global option on your theme options page. So, if the post option applied to all types of posts, then when someone selected the global option on their theme options (that is meant for the user’s “blog”), the dropcap would appear everywhere to all pages across the website.

    Anyway, that’s why the option isn’t working, but if that specific feature is something you want on your Hymn post type, it is possible through customization and we can talk more about that if you want. While support doesn’t include providing customizations, I can try to point you to the relevant information to make this happen.

    2. In terms of the featured image display option not applying, there is a filter I put in there you can utilize to add your post type.

    function my_epic_thumb_types( $types ) {
        $types[] = 'your_post_type';
        return $types;
    }
    add_filter( 'denali_epic_thumb_types', 'my_epic_thumb_types' );

    Being new to this (I’m not sure if you’re new to PHP in general, or just WordPress), I would really suggest trying to learn what you’re doing with this code and not just pasting it in.

    First, it’ll be really helpful to learn the concept of filters in WordPress. And then see line 799 in /includes/theme-functions.php of the theme; that’s what you’re filtering with the above code.

    #23917
    bchastain
    Participant

    1. No prob. Not crucial – may look at that later.

    2. Works perfect. Thank you SO much.

    I’ve taken PHP courses on Lynda.com and such over the years. I’ve setup a few wordpress sites over the years but very basic. This is for my personal site that I’m porting over form Drupal (www.blaynechastain.com is the live one). I’ll make sure to do as you suggested and study up on filters and such. That all said, I do tend to stay out of the deep code as I have too many other hats I wear day-to-day as a musician and film maker. It’s handy that I work in a collab space here with other web devs and one of them is helping me with the transition to wordpress though he’s a drupal dev by day 😉 Funny, we actually have one of the guys that works for Automatic here in the office but he’s on the .com side of things.

    #23918
    Jason Bobich
    Keymaster

    Awesome, glad to hear it! Knowing whether you have any knowledge at all of PHP or not helps me in answering your questions in the future, so thanks 🙂 And good luck with the new site.

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.