This is A functions to register a Custom post in wordpress.
add_action( 'init', 'sonia_custom_post' );
function sonia_custom_post() {
register_post_type( 'post_name',
array(
'labels' => array(
'name' => __( 'Sonia' ),
'singular_name' => __( 'sonia' ),
'add_new_item' => __( 'Add New post' )
),
'public' => true,
'supports' => array('author', 'thumbnail', 'title', 'editor', 'custom-fields'),
'has_archive' => true,
'rewrite' => array('slug' => 'post-item'),
)
);
}
Friday, January 23, 2015
wordpress widget register
if Your Problem how to call wordpress widget, or register a widget area in wordpress functions
Wordpress widget register
function sonia_widget_areas() {
register_sidebar( array(
'name' => __( 'Footer Left', 'sonia' ),
'id' => 'footer_left',
'description' => __( 'Insert something for about us text.', 'sonia' ),
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>',
) );
}
add_action('widgets_init', 'sonia_widget_areas');
Wordpress widget register
function sonia_widget_areas() {
register_sidebar( array(
'name' => __( 'Footer Left', 'sonia' ),
'id' => 'footer_left',
'description' => __( 'Insert something for about us text.', 'sonia' ),
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>',
) );
}
add_action('widgets_init', 'sonia_widget_areas');
Subscribe to:
Posts (Atom)