DKGupta-git / Wordpress

0 stars 0 forks source link

custom post and category related #1

Open DKGupta-git opened 1 year ago

DKGupta-git commented 1 year ago

https://developer.wordpress.org/reference/functions/register_taxonomy/

DKGupta-git commented 1 year ago

<?php /**

// add_action('wp_enqueue_scripts', 'callback_for_setting_up_scripts'); // function callback_for_setting_up_scripts() { // wp_register_style( 'assets_css', 'http://locationofcss.com/mycss.css' ); // wp_enqueue_style( 'assets_css' ); // wp_enqueue_script( 'assets_js', 'http://locationofscript.com/myscript.js', array( 'jquery' ) ); // } include( plugin_dir_path( FILE ) . 'custom-post-type.php');

function your_namespace() { wp_register_style('assets_css', plugins_url('/assets/assets_css.css',FILE )); wp_enqueue_style('assets_css'); wp_register_script( 'assets_js', plugins_url('/assets/assets_js.js',FILE )); wp_enqueue_script('assets_js'); } add_action( 'admin_enqueue_scripts','your_namespace');

/**

DKGupta-git commented 1 year ago

<?php

/Custom Post type start/

function cw_post_type_news() {

$supports = array(
'title', // post title
'editor', // post content
'author', // post author
'thumbnail', // featured images
'excerpt', // post excerpt
'custom-fields', // custom fields
'comments', // post comments
'revisions', // post revisions
'post-formats', // post formats
);

$labels = array(
'name' => _x('news', 'plural'),
'singular_name' => _x('news', 'singular'),
'menu_name' => _x('news', 'admin menu'),
'name_admin_bar' => _x('news', 'admin bar'),
'add_new' => _x('Add New', 'add new'),
'add_new_item' => __('Add New news'),
'new_item' => __('New news'),
'edit_item' => __('Edit news'),
'view_item' => __('View news'),
'all_items' => __('All news'),
'search_items' => __('Search news'),
'not_found' => __('No news found.'),
);

$args = array(
'supports' => $supports,
'labels' => $labels,
'public' => true,
'query_var' => true,
'menu_position' => 5,
'rewrite' => array('slug' => 'news'),
'has_archive' => true,
'hierarchical' => false,
);
register_post_type('news', $args);
}
add_action('init', 'cw_post_type_news');

?>
DKGupta-git commented 1 year ago

// Hook

add_action('admin_menu', 'add_tutorial_cpt_submenu_example');

//admin_menu callback function

function add_tutorial_cpt_submenu_example(){

 add_submenu_page(
                 'edit.php?post_type=tutorial', //$parent_slug
                 'Tutorial Subpage Example',  //$page_title
                 'Tutorial Settings',        //$menu_title
                 'manage_options',           //$capability
                 'tutorial_subpage_example',//$menu_slug
                 'tutorial_subpage_example_render_page'//$function
 );

}

//add_submenu_page callback function

function tutorial_subpage_example_render_page() {

 echo '<h2> Tutorial Subpage Example </h2>';

}

DKGupta-git commented 1 year ago

https://www.wpcodingdev.com/blog/how-to-create-custom-form-in-wordpress-admin-panel/

DKGupta-git commented 1 year ago

https://stackoverflow.com/questions/47407711/read-csv-file-with-wordpress

DKGupta-git commented 1 year ago

https://www.sitepoint.com/programmatically-creating-wordpress-posts-from-csv-data/

DKGupta-git commented 1 year ago

Programmatically Creating WordPress Posts from CSV Data - SitePoint.zip

DKGupta-git commented 1 year ago

wps.zip