danielwerner23
Forum Replies Created
-
Forum: Everything else WordPress
In reply to: Migrate pages, posts and cpts to another wordpress instanceThanks for help. That solved my problem.
Forum: Developing with WordPress
In reply to: Get relationship between CPT and quantityI’ve stored in a meta field as json string. It works. Maybe later i create a custom input where i can edit these json string.
Forum: Plugins
In reply to: [Advanced Custom Fields (ACF®)] Extend cpt api endpointHi there. This is NOT a special ACF question/problem. There are 2 existing CPTs: products and products-category. It doesnt matter if you are create these 2 with acf or manualy in your functions.php. So please move the question into the normal support forum. Thanks a lot.
You can edit my question and remove the “acf wording”.
- This reply was modified 2 years, 5 months ago by danielwerner23.
Forum: Developing with WordPress
In reply to: upgrade galery with lightbox functionNot sure about the switch you’re talking about.
Are you using the default WP gallery block or some kind of custom solution?
Yes, the default wordpress gallery block.Make sure that in the gallery settings you’ve selected link to media file (lightbox needs the link to full image to work properly)
It’ selected. But the lightbox want work.There is a plugin too https://wordpress.org/plugins/simplelightbox/
This plugin works out of the box, nice. It converts all of my gallery blocks with the lightbox function.Forum: Developing with WordPress
In reply to: upgrade galery with lightbox functionThanks for you anwer. I’ve tried it, but i will only get the switch button under my block but no changes in my frontend.
Forum: Developing with WordPress
In reply to: backend user to page restrictionI mark it as solved.
Forum: Developing with WordPress
In reply to: backend user to page restrictionThank you for your answer. I am asking for page-permissions not for the posts. I’ve testet some plugins, but you can only edit the permissions. In wordpress itself you cant disable/edit which elements the backend user can have/see/use.
So i’ve coded a snipped which allows only editing and puplishing pages (changes). Also it hides the new button, the meta boxes to prevent the change of parent page and the menu media item (its only css hiding, but i dont know a better solution). Thats solved my problem:
/** * Add custom user roles for backend * notice: use remove_role('pageeditor') onchange! * you need it only once or on changes */ /* add_role('pageeditor', 'Editor (specific for pages)', array( 'read' => false, 'create_posts' => false, 'edit_posts' => false, 'edit_others_posts' => false, 'publish_posts' => false, 'manage_categories' => false, 'manage_links' => false, 'moderate_comments' => false, 'edit_comments' => false, 'moderate_comments' => false, 'create' => false, 'create_pages' => false, 'manage_options' => false, 'delete' => false, 'delete_pages' => false, 'delete_others_pages' => false, 'edit_other_pages' => false, 'edit_pages' => true, 'edit' => true, 'edit_published_pages' => true, 'publish_pages' => true, 'upload_files' => true, )); */ /** * Modify backend view for role pageeditor */ if (current_user_can('pageeditor') && !current_user_can('manage_options')) { add_action('admin_init', function () { //remove meta box remove_post_type_support('page', 'page-attributes'); //remove media nav item remove_menu_page('upload.php'); }); //add role-* class to backend body add_filter('admin_body_class', function ($classes) { global $current_user; foreach ($current_user->roles as $role) $classes .= ' role-' . $role; return trim($classes); }); }- This reply was modified 2 years, 6 months ago by danielwerner23.
Forum: Developing with WordPress
In reply to: Prevent loading scriptsProblem solved. wp_enqueue_script “string[] $deps = array()” param got to “[]” and all the other scripts are gone. If i need react later i can fall back to another value.
Thanks for the help.
Forum: Developing with WordPress
In reply to: Prevent loading scriptsIn all my other wordpress instances (projects with the same current wordpress version) these files aren’t loaded. So do you have an idea how i can find the inititation of loading or i can debug to prefent the loading of these files?
Forum: Developing with WordPress
In reply to: Replace empty a-tags in nav walkerI’ve choosed the solution to disable the click with js and/or css:
document .querySelectorAll('#menu-header-menue a[href="#"]') .forEach(function (element) { element.addEventListener('click', function (event) { event.preventDefault(); }); });.menu-item-type-custom > a @apply pointer-events-noneForum: Developing with WordPress
In reply to: Add admin column with taxonomyGot it, with my custom solution:
add_action('manage_product_posts_custom_column', function ($column, $post_id) { if ('taxonomy' === $column) { $terms = get_the_terms($post_id, 'product-category'); echo isset($terms) && is_array($terms) ? implode(', ', array_column($terms, 'name')) : '-'; } }, 10, 2);The “show_admin_column” isn’t working.
- This reply was modified 3 years, 2 months ago by danielwerner23.
- This reply was modified 3 years, 2 months ago by danielwerner23.
Forum: Developing with WordPress
In reply to: Add admin column with taxonomyIt doesn’t work:
register_taxonomy( 'product-category', 'product', array( 'labels' => array(...), 'hierarchical' => true, 'query_var' => true, 'show_admin_column ' => true, 'rewrite' => array('slug' => '...') ) ); register_post_type('product', array( 'labels' => array(...), 'public' => true, 'publicly_queryable' => true, 'query_var' => true, 'rewrite' => true, 'hierarchical' => true, 'has_archive' => true, 'show_in_rest' => true, 'exclude_from_search' => false, 'menu_icon' => 'dashicons-insert', 'supports' => array('title'), 'rewrite' => array('slug' => '...'), ));Forum: Developing with WordPress
In reply to: CPT taxonomy url structureThanks. I’ve “solved” the problem and got two options:
- As you said. I created a route /products and build a logic to return my templates. This is possible but plugins like yoast (breadcrump) and many others are not compatible to this and i have to rebuild many modules. All in all, its a lot of work and many errors are possible. So thats not my favorite solution.
- I have returned to the build in and out of the box working solution with the wordpress side templates (single, archive, taxonomy, …) and i accepted the structure: “products” / “products/name_of_product” / “products/category/name_of_category”.
So thanks.
Forum: Developing with WordPress
In reply to: Ajax Form Handle Action outside functions.phpWhy i cant split these things?
in the functions.php:
add_action('wp_ajax_form_booking', 'handle_form_booking'); add_action('wp_ajax_nopriv_form_booking', 'handle_form_booking');in my template file:
function handle_form_booking() { die("so many stuff to do..."); }the reason is, my function is massive and thats a lot to load, every page and thats not that performant.
Forum: Fixing WordPress
In reply to: Image SRC Set (different images)The problem is, i have to use two different images from the wordpress media library. The wordpress image block can only support one image. The result in the frontend with “the_content()” is one image-tag with an srcset, but its from one image (the image i’ve choosen in the wp block), but i need an wp image block with two different images.
- This reply was modified 4 years, 3 months ago by danielwerner23.
- This reply was modified 4 years, 3 months ago by danielwerner23.