• Mihail Semjonov

    (@muxahuk1214)


    Hi there,
    I’m trying to develop something new for my theme and I wonder can i somehow create custom post format ?
    (for ex. “available” and “not available”) So that standart would be “available” and if clien makes some product that for now is “not available” he chooses “not available” ). If the answer is yes, you can than the next question is how to add thous custom post formats to my custom post type: “Products”.

    (or for example i wont to make for posts custom post format “products” that will contain price,image,features field along with standard title and editor)
    I have seen beta 3.6 wordpress and there post formats have nice look and they are easy to aditable.

    So is there a chance to create custom post formats and apply them to custom post type ?

    PS: sorry for my bad english. It’s not my native.
    PSS: on how to add post formats to custom post type i’v found, but how to add a new post formats and add them – no.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Mihail Semjonov

    (@muxahuk1214)

    in includes/post.php i have found wordpress funtion that contains array of post formats

    function get_post_format_strings() {
    	$strings = array(
    		'standard' => _x( 'Standard', 'Post format' ), // Special case. any value that evals to false will be considered standard
    		'aside'    => _x( 'Aside',    'Post format' ),
    		'chat'     => _x( 'Chat',     'Post format' ),
    		'gallery'  => _x( 'Gallery',  'Post format' ),
    		'link'     => _x( 'Link',     'Post format' ),
    		'image'    => _x( 'Image',    'Post format' ),
    		'quote'    => _x( 'Quote',    'Post format' ),
    		'status'   => _x( 'Status',   'Post format' ),
    		'video'    => _x( 'Video',    'Post format' ),
    		'audio'    => _x( 'Audio',    'Post format' ),
    	);
    	return $strings;
    }

    I’m not realy fomiliar with php (i mean i’m not to good at it).
    Can i redeclear that function, so that wordpress do not fall for that function but so that it returns my own (that will be decleared in functions.php in theme) so I mean something like these:

    if( function_exists( 'get_post_format_strings' ) ){
      //delete the function that is decleared in includes/post.php
      //declear new 'get_post_format_strings' function :
      function get_post_format_strings() {
    	$strings = array(
    		'standard' => _x( 'Standard', 'Post format' ), // Special case. any value that evals to false will be considered standard
    		'aside'    => _x( 'Aside',    'Post format' ),
    		'chat'     => _x( 'Chat',     'Post format' ),
    		'gallery'  => _x( 'Gallery',  'Post format' ),
    		'link'     => _x( 'Link',     'Post format' ),
    		'image'    => _x( 'Image',    'Post format' ),
    		'quote'    => _x( 'Quote',    'Post format' ),
    		'status'   => _x( 'Status',   'Post format' ),
    		'video'    => _x( 'Video',    'Post format' ),
    		'audio'    => _x( 'Audio',    'Post format' ),
                    'product'  => _x( 'Product',    'Post format' ),
    	);
    	return $strings;
      }
    }

    I think we can not able to create custom post format.
    I am not sure.Because the above code is default WordPress Function.
    We do not overwrite the default function.

    We can change the name for example “Aside” to “News”.

    http://wpmu.org/how-to-quickly-rename-a-wordpress-post-format/

    If you are comfortable editing the default includes, you can add custom post types directly to get_post_format_strings and then work with them normally.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to create custom post format and add it on custom post type ?’ is closed to new replies.