Jacek
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Administrator lost it’s role on CPTIt looks like ogles_role does not have “read” capability, as is is required to access dashboard. Please check it by placing this code i functions.php or plugin:
global $wp_roles; print_r($wp_roles->roles);
You should see:
... [oglasi_role] => Array ( [name] => Oglasi role [capabilities] => Array ( ... [read] => 1 ... ) ) ...
Can you see it?
Forum: Developing with WordPress
In reply to: gutenberg change html attributes of custom blockJS is not necessary, beacuse you can always access any single HTML node with proper selector. Still the question for me is what do you want to acheive. Do you want to:
– make a border around some columns in some posts/pages? You can do that by adding class in theme and specyfing it in Gutenberg (select column, then click Advanced, enter class name in ‘Additional CSS Class(es)’)
– make a border around all columns in all WP posts and pages?
– make a border around all columns in single WP post or page?
– something else?Forum: Developing with WordPress
In reply to: gutenberg change html attributes of custom blockI do not understand what do you want to achieve. If you want to change the look of columns in the frontend globally then you can do it with CSS, you can also do it per page/post using body.page-id-XXX or body.postid-XXX in selector. Is that what you want to do?
Forum: Developing with WordPress
In reply to: Administrator lost it’s role on CPTThe main problem is that you mix two different approaches to create capabilities for your post type, you pass capability_type and capabilities in args array to register_post_type. Passing string as capability_type will cause creation of capabilities based on string or array of strings (singular and plural). For example if you pass
capability_type' => array('oglas', 'oglase')
then capabilities edit_oglas, edit_oglase and so on will be created automatically. And in this case you should not pass capabilities.
So code for your post type should look like this:add_action( 'init', 'oglasi_custom_post_type', 0 ); // Creating a Deals Custom Post Type function oglasi_custom_post_type() { $labels = array( 'name' => __( 'Oglasi' ), 'singular_name' => __( 'Oglas'), 'menu_name' => __( 'Oglasi'), 'parent_item_colon' => __( 'Roditelj Oglas'), 'all_items' => __( 'Svi Oglasi'), 'view_item' => __( 'Pregledaj Oglas'), 'add_new_item' => __( 'Dodaj Novi Oglas'), 'add_new' => __( 'Dodaj Nov'), 'edit_item' => __( 'Izmeni Oglas'), 'update_item' => __( 'A?uriraj Oglas'), 'search_items' => __( 'Tra?i Oglas'), 'not_found' => __( 'Nije Prona?en'), 'not_found_in_trash' => __( 'Nije Prona?en U Obrisanim') ); $args = array( 'label' => __( 'oglasi'), 'description' => __( 'Va?i Oglasi'), 'labels' => $labels, 'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'revisions', 'custom-fields'), 'public' => true, 'hierarchical' => false, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'has_archive' => true, 'can_export' => true, 'exclude_from_search' => false, 'yarpp_support' => true, 'publicly_queryable' => true, 'capability_type' => array('oglas', 'oglase'), ); register_post_type( 'oglasi', $args ); }
Now you should assign capabilities to admin, create custom role and assign capabilities to it too.
function add_oglasi_caps() { $role = get_role( 'administrator' ); $role->add_cap( 'edit_oglas' ); $role->add_cap( 'read_oglas' ); $role->add_cap( 'delete_oglas' ); $role->add_cap( 'edit_oglase' ); $role->add_cap( 'edit_others_oglase' ); $role->add_cap( 'publish_oglase' ); $role->add_cap( 'read_private_oglase' ); $role->add_cap( 'edit_oglase' ); add_role( 'oglasi_role', 'Oglasi role', array('read')); $role = get_role( 'oglasi_role' ); $role->add_cap( 'edit_oglas' ); $role->add_cap( 'read_oglas' ); $role->add_cap( 'delete_oglas' ); $role->add_cap( 'edit_oglase' ); $role->add_cap( 'edit_others_oglase' ); $role->add_cap( 'publish_oglase' ); $role->add_cap( 'read_private_oglase' ); $role->add_cap( 'edit_oglase' ); } add_action( 'admin_init', 'add_oglasi_caps');
Remember that the code for custom role creation and adding capabilities should be executed once.
- This reply was modified 5 years, 2 months ago by Jacek.
Forum: Fixing WordPress
In reply to: URGENCE, input box problemeCan you get some details from customer like device, web browser (name, version), OS?