Custom Post Type with Post Format

Hello I am using a custom post type “Podcast” and I was using your custom Post Format to display the audio embed code for this custom post type.

When logging in, I noticed that when I create a new custom post, the field that used to appear and allow me to add the embed code, no longer appears.

Has something changed recently?

Thanks!

=====================

update:

I know that I had implemented some custom coding in the past to make this work, by making edits to setup.php and meta-entries.php, but it looks like the structure of where these need to be located in the child theme has changed and the old code no longer works.

on meta-entities.php I have added this:

  x_register_meta_box( array(
    'id'          => 'x-meta-box-audio',
    'title'       => __( 'Audio Post Settings', '__x__' ),
    'description' => __( 'These settings enable you to embed audio into your posts.', '__x__' ),
    'page'        => 'podcast',
    'context'     => 'normal',
    'priority'    => 'high',
    'fields'      => array(
      array(
        'name' => __( 'MP3 File URL', '__x__' ),
        'desc' => __( 'The URL to the .mp3 audio file.', '__x__' ),
        'id'   => '_x_audio_mp3',
        'type' => 'text',
        'std'  => ''
      ),
      array(
        'name' => __( 'OGA File URL', '__x__' ),
        'desc' => __( 'The URL to the .oga or .ogg audio file.', '__x__' ),
        'id'   => '_x_audio_ogg',
        'type' => 'text',
        'std'  => ''
      ),
      array(
        'name' => __( 'Embedded Audio Code', '__x__' ),
        'desc' => __( 'If you are using something other than self hosted audio such as Soundcloud paste the embed code here. This field will override the above.', '__x__' ),
        'id'   => '_x_audio_embed',
        'type' => 'textarea',
        'std'  => ''
      )
    )
  ) );

It was working before as the podcasts have audio embeds, but adding new ones does not render the meta-box anymore

========

update2:

When I make the change to the meta-entries.php file in the main theme, the change works, but when I add it to the child theme the file is not overwriting.

Hello @michigancreative,

Thanks for writing in!

Be advised that custom coding is beyond the scope of our support under our Support Policy. If you are unfamiliar with code and resolving potential conflicts, you may select our One service for further assistance.

In your case, you will have to create your own custom metabox for the Podcast custom type. Perhaps, this article can help you instead:

Best Regards.

Hey @ruenel

I am able to add the custom coding to add the audio embed metabox, my only issue is that I have to update the theme core file itself, replacing the file in my child theme does not work.

Hello @michigancreative,

Keep in mind that this code:

x_register_meta_box( array(
    'id'          => 'x-meta-box-audio',
    'title'       => __( 'Audio Post Settings', '__x__' ),
    'description' => __( 'These settings enable you to embed audio into your posts.', '__x__' ),
    'page'        => 'post',
    'context'     => 'normal',
    'priority'    => 'high',
    'fields'      => array(
      array(
        'name' => __( 'MP3 File URL', '__x__' ),
        'desc' => __( 'The URL to the .mp3 audio file.', '__x__' ),
        'id'   => '_x_audio_mp3',
        'type' => 'text',
        'std'  => ''
      ),
      array(
        'name' => __( 'OGA File URL', '__x__' ),
        'desc' => __( 'The URL to the .oga or .ogg audio file.', '__x__' ),
        'id'   => '_x_audio_ogg',
        'type' => 'text',
        'std'  => ''
      ),
      array(
        'name' => __( 'Embedded Audio Code', '__x__' ),
        'desc' => __( 'If you are using something other than self hosted audio such as Soundcloud paste the embed code here. This field will override the above.', '__x__' ),
        'id'   => '_x_audio_embed',
        'type' => 'textarea',
        'std'  => ''
      )
    )
  ) );

was coded specifically for the Audio metabox built into the theme. Modifying this will create issues sooner or later. This is why our developers made sure that these codes will not be tampered to prevent such issues. If you have a a custom post type Podcast and that you need a meta for this new custom post type, you will have to create your own metabox and please do not modify the current metaboxes in the theme. What you can do is to copy the parts of the code to create your own code and then add your code in your child theme’s functions.php file. That is the best way of doing this to avoid any future issues.

Alternatively, you can use the Advance Custom Field Pro plugin which you can install in Pro (or X if you are using this theme) > Validation > Extensions. This plugin allows you to create a metabox for you custom post type or on the existing pos types WITHOUT adding any piece of code. Kindly check the article which I have provided in my previous reply:

Hope this makes sense.

@ruenel

Yup, I understand that. What I did was just copy that code, and swapped out post with podcast. When I updated the core xpro file it worked without any problems, but when I copied the meta-entries.php file, added it to my child theme, and then made the appropriate edits. The change did NOT take place. It required me to updated the actual xpro core theme files.

Hi @michigancreative,

It might be the path of the file in the child theme is not correct. I would suggest you check the file path in the parent theme and made the exact file path in the child theme. Please remember that we never suggest updating the core files, as it will overridden with the Theme Updates.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.