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.

Add Post/Page Meta Options

  • Creator
    Topic
  • #431
    mizzinc
    Participant

    How do you add more Post or Page meta options using a child functions.php file?
    I understand you use the filter ‘themeblvd_xxx_meta’. Not sure how the array is suppose to written to add the custom function to this filter.

    Thanks,

     

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

    Hello,

    The filters you want to use are called “themeblvd_page_meta” and “themeblvd_post_meta”. In order to see how the array is structured to utilize it, you can see where it’s applied here:

    /framework/admin/functions/meta.php

    Basically, within the “options” portion there is smaller array for each option. Here’s an article that shows you how to format these individual options:

    http://dev.themeblvd.com/tutorial/formatting-options/

    So, let’s say you wanted to add a text option to the Post options meta box. It would look something like this:

    function my_post_meta( $config ){
    	$config['options'][] = array(
    	    'name'      => 'Example Option',
    	    'desc'      => 'This is the description for the option.',
    	    'id'        => 'example_option',
    	    'std'       => 'default value for option',
    	    'type'      => 'text'
    	);
    	return $config;
    }
    add_filter( 'themeblvd_post_meta', 'my_post_meta' );

    And then it would be retrieved like this:

    get_post_meta( $post->ID, 'example_option', true );
    #441
    mizzinc
    Participant

    I didn’t account for the ‘[]’ at the end of ‘$config[‘options’]’.

    Thank you Jason.

Viewing 2 replies - 1 through 2 (of 2 total)

The forum ‘Barely Corporate Responsive WordPress Theme’ is closed to new topics and replies.