WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post type setup problem (13 posts)

  1. WPWebs
    Member
    Posted 3 years ago #

    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

  2. SpankMarvin
    Member
    Posted 3 years ago #

    What problem are you having?

  3. WPWebs
    Member
    Posted 3 years ago #

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

  4. Alexandru Vornicescu
    Member
    Posted 3 years ago #

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

  5. WPWebs
    Member
    Posted 3 years ago #

    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

  6. WPWebs
    Member
    Posted 3 years ago #

    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

  7. WPWebs
    Member
    Posted 3 years ago #

    Hi,

    Have got any solution please.

    Thanks

  8. Alexandru Vornicescu
    Member
    Posted 3 years ago #

    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.

  9. robmuzo
    Member
    Posted 3 years ago #

    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!

  10. robmuzo
    Member
    Posted 3 years ago #

    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.

  11. SpankMarvin
    Member
    Posted 3 years ago #

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

  12. robmuzo
    Member
    Posted 3 years ago #

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

  13. WPWebs
    Member
    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.