• Hi there,

    This is vipul jariwala and I have a site http://wpwebs.com.

    I want to add custom post type to my site. I got related help from the link: http://codex.wordpress.org/Function_Reference/register_post_type

    I use the same example given there:
    add_action(‘init’, ‘my_custom_init’);
    function my_custom_init()
    {
    $labels = array(
    ‘name’ => _x(‘Books’, ‘post type general name’),
    ‘singular_name’ => _x(‘Book’, ‘post type singular name’),
    ‘add_new’ => _x(‘Add New’, ‘book’),
    ‘add_new_item’ => __(‘Add New Book’),
    ‘edit_item’ => __(‘Edit Book’),
    ‘new_item’ => __(‘New Book’),
    ‘view_item’ => __(‘View Book’),
    ‘search_items’ => __(‘Search Books’),
    ‘not_found’ => __(‘No books found’),
    ‘not_found_in_trash’ => __(‘No books found in Trash’),
    ‘parent_item_colon’ => ”
    );
    $args = array(
    ‘labels’ => $labels,
    ‘public’ => true,
    ‘publicly_queryable’ => true,
    ‘show_ui’ => true,
    ‘query_var’ => true,
    ‘rewrite’ => true,
    ‘capability_type’ => ‘post’,
    ‘hierarchical’ => false,
    ‘menu_position’ => null,
    ‘supports’ => array(‘title’,’editor’,’author’,’thumbnail’,’excerpt’,’comments’)
    );
    register_post_type(‘book’,$args);
    }

    ——————-
    I have set my blog permalink like “/%postname%/“.
    ——————-
    It’s ok while I set ‘rewrite’ => true, to false but it create problem while I set it to true.

    Please help what wrong with me?

    Thanks

Viewing 12 replies - 1 through 12 (of 12 total)
  • What problem are you having?

    Thread Starter vipul Jariwala

    (@vipuljariwala-1)

    if I set permalink enable, the view post page of front page takes me to 404 instead of detail page.

    use this, should work ‘rewrite’ => array(‘slug’ => ‘books’, ‘with_front’ => FALSE),

    Thread Starter vipul Jariwala

    (@vipuljariwala-1)

    Hi there,

    I solve it.

    My final code is:

    add_action(‘init’, ‘my_custom_init’);
    function my_custom_init()
    {
    $labels = array(
    ‘name’ => _x(‘Blog’, ‘post type general name’),
    ‘singular_name’ => _x(‘Book’, ‘post type singular name’),
    ‘add_new’ => _x(‘Add New’, ‘book’),
    ‘add_new_item’ => __(‘Add New Book’),
    ‘edit_item’ => __(‘Edit Book’),
    ‘new_item’ => __(‘New Book’),
    ‘view_item’ => __(‘View Book’),
    ‘search_items’ => __(‘Search Blog’),
    ‘not_found’ => __(‘No Blog found’),
    ‘not_found_in_trash’ => __(‘No Blog found in Trash’),
    ‘parent_item_colon’ => ”
    );
    $args = array(
    ‘labels’ => $labels,
    ‘public’ => true,
    ‘publicly_queryable’ => true,
    ‘show_ui’ => true,
    ‘query_var’ => true,
    ‘rewrite’ => true,
    ‘capability_type’ => ‘post’,
    ‘hierarchical’ => false,
    ‘menu_position’ => null,
    ‘supports’ => array(‘title’,’editor’,’author’,’thumbnail’,’excerpt’,’comments’)
    );
    register_post_type(‘blog’,$args);
    }

    The problem is solved and the issue was super cache plugin. Because of super cache .htaccess rule, it was problem.

    Thanks

    Thread Starter vipul Jariwala

    (@vipuljariwala-1)

    Hi there,

    The problem is not solved. while I set premalink. I try to make blog section with custom post type.

    Check at for your reference :
    http://wpwebs.com/wpwebs/wp-admin
    Id: admin
    Pw: 12345

    Code is in functions.php file , you can edit form theme editor section at very bottom part.

    Please help me.
    Thanks

    Thread Starter vipul Jariwala

    (@vipuljariwala-1)

    Hi,

    Have got any solution please.

    Thanks

    messed a little :)))
    but it worked for me in Twenty-ten theme, hope you have a backup.
    look in functions.php of the default theme.

    Do you want someone to hack your server? Don’t post your login and password on a public forum. I have just installed the ftp plugin on your blog so you can go and have a look what anyone can access with access to your test wordpress site, ie all the way back to your root, cpanel, email cache etc someone could take control of your whole server space!

    I suggest you change your password strait away!

    It gets better, your a reseller with around 100 clients sites on your server!!! all accessible via that login!!! I have changed your password and emailed you the new one.

    Wow. You’re very lucky there’s a trustworthy person who noticed this. That is indeed, bad news. Nice work, robmuzo!

    Well I wouldn’t like it if it happened to me, seems he has locked it down now.

    Thread Starter vipul Jariwala

    (@vipuljariwala-1)

    the problem solved. One of theme developer One of theme developer company help to solve it.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Custom Post type setup problem’ is closed to new replies.