How to do a custom bookmarks post type?
-
30-10-2019 - |
سؤال
Let me first explain what I am wanting to do...
I am wanting to add all my hundreds of website bookmarks that I have now in my browser, into wordpress for the following reasons.
- Can search my bookmarks by tags
- Can search my bookmarks by description and/or name
- Can access my bookmarks from anywhere
- Can add a description to all my bookmarks
- Can add a screenshot image of website (optional)
- Will have a custom template for viewing the bookmarks which will look different from a regular blog post/list
And what I have done so far...
- Created a new post type "Website Bookmarks" with the code below
functions.php
<?php
/*
* Add custom post type
* name: website_bookmarks
*/
function bookmark_post_type()
{
// Set some labels for our bookmarks post type
$bookmark_labels = array(
'name' => _x('Website Bookmark', 'post type general name'),
'singular_name' => _x('Websiteite Bookmark', 'post type singular name'),
'add_new' => _x('Add New', 'Websiteite Bookmark'),
'add_new_item' => __('Add New Website Bookmark'),
'edit_item' => __('Edit Website Bookmark'),
'new_item' => __('New Website Bookmark'),
'all_items' => __('All Website Bookmarks'),
'view_item' => __('View Website Bookmark'),
'search_items' => __('Search Website Bookmarks'),'not_found' => __('No website Bookmarks found'),
'not_found_in_trash' => __('No Website Bookmarks found in Trash'),
'parent_item_colon' => '',
'menu_name' => 'Website Bookmarks'
);
$bookmark_args = array(
'labels' => $bookmark_labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array(
'slug' => 'bookmark',
'with_front' => false),
'taxonomies' => array('post_tag', 'category'),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'can_export' => true,
'supports' => array(
'post-thumbnails',
'thumbnail',
'excerpt',
'custom-fields',
'editor',
'title'
)
);
register_post_type('website_bookmarks', $bookmark_args);
}
add_action('init', 'bookmark_post_type');
And then what I need help/ideas with...
I basically need the following...
- Website Title
- Website URL
- Website Description
- Bookmark Tags (can be more then 1) This will be done with a custom taxonomy
- Screenshot image (can be optional)
So...
I can use the built in post title for the website title,
Website URL ? Should I use custom fields for this?
Website description ? Again custom fields or something else like the content input box?
Bookmark tags, done with custon taxonomy
Screenshot image ? should I just use the post thumbnail for this?
Please help, this will be my first time using wordpress do do any kind of custom stuff.
لا يوجد حل صحيح
لا تنتمي إلى wordpress.stackexchange