Forum Replies Created

Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter danielwerner23

    (@danielwerner23)

    Thanks for help. That solved my problem.

    Thread Starter danielwerner23

    (@danielwerner23)

    I’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.

    Thread Starter danielwerner23

    (@danielwerner23)

    Hi 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”.

    Thread Starter danielwerner23

    (@danielwerner23)

    Not 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.

    Thread Starter danielwerner23

    (@danielwerner23)

    Thanks for you anwer. I’ve tried it, but i will only get the switch button under my block but no changes in my frontend.

    Thread Starter danielwerner23

    (@danielwerner23)

    I mark it as solved.

    Thread Starter danielwerner23

    (@danielwerner23)

    Thank 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);
    
        });
    
    }
    Thread Starter danielwerner23

    (@danielwerner23)

    Problem 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.

    Thread Starter danielwerner23

    (@danielwerner23)

    In 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?

    Thread Starter danielwerner23

    (@danielwerner23)

    I’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-none
    Thread Starter danielwerner23

    (@danielwerner23)

    Got 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.

    Thread Starter danielwerner23

    (@danielwerner23)

    It 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' => '...'),
    ));
    Thread Starter danielwerner23

    (@danielwerner23)

    Thanks. I’ve “solved” the problem and got two options:

    1. 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.
    2. 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.

    Thread Starter danielwerner23

    (@danielwerner23)

    Why 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.

    Thread Starter danielwerner23

    (@danielwerner23)

    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.

Viewing 15 replies - 1 through 15 (of 15 total)