[Support request] Change page layout in bulk

Home Forums Support Change page layout in bulk

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1024073
    Jan

    Hello.

    I have a question: My website have 5000 pages with layout “Content / Right sidebar” (our standard layout).
    Now, we want to upload 10.000 extra pages with a layout no-sidebar.

    How can we do this? We use all import pro to upload these pages.

    Hope to hear from you,

    Friendly regards,

    Jan

    #1024204
    David
    Staff
    Customer Support

    Hi there,

    thats a lot of content 🙂 Are these pages or posts ? As you would need some way of differentiating the content from existing such as a Taxonomy.

    #1024205
    Jan

    Hi David. Indeed a lot of content (hotels).

    Those are pages.

    #1024244
    David
    Staff
    Customer Support

    And i assume the existing content are also Pages ?
    First thing that comes to mind is to register a taxonomy for the pages you’re going to import then use that for a Layout Elements Display Rules where you can remove the sidebar.
    Ultimately we need something to differentiate the two that isn’t going to change.

    #1024248
    Jan

    Yes. Existing content are also Pages.

    How can i register a taxonomy for the pages that i am going to import?

    #1024278
    David
    Staff
    Customer Support

    Before doing any of this i suggest you test it out using backup/staging sites of both the current and export data site.

    This PHP Snippet will register a custom taxonomy called Element Controls with a default term of Display Rules for your pages:

    add_action( 'init', 'element_control_custom_tax' );
    function element_control_custom_tax() {
        register_taxonomy(
            'element-controls',
            array( 'post', 'page' ),
            array(
                'label' => __( 'Element Controls' ),
                'rewrite' => array( 'slug' => 'element-controls' ),
    			'hierarchical'      => true,
    			'show_in_rest' => true,
            )
        );
        register_taxonomy_for_object_type( 'element-controls', 'page' );
        $parent_term = term_exists( 'element-controls', 'element-controls' ); // array is returned if taxonomy is given
    	$parent_term_id = $parent_term['term_id']; // get numeric term id
    	wp_insert_term(
    		'Use Display Rules', // the term 
    		'element-controls', // the taxonomy
    		array(
    			'description'=> 'Post will use the Display Rule Terms', 
    			'slug' => 'display-rules', 
    			'parent'=> $parent_term_id
    		)
    	);
    }

    You would need it on both sites ( the import to and export from ).
    Then on the site you want to export from you can set the category for each of your pages.
    I don’t have a solution for pragmatically setting the term on all your export pages, so you would need to use Bulk Edit ( 999 pages at a time ) to include the term.

    I believe in WP All Import you have the option to include Taxonomies / Custom Taxonomies.

    May be worth doing a test of one or two pages to begin with.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.