[Resolved] Sorry, bit of an simple one… how to change the 404 Layout?

Home Forums Support [Resolved] Sorry, bit of an simple one… how to change the 404 Layout?

Home Forums Support Sorry, bit of an simple one… how to change the 404 Layout?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1382893
    Henry

    Changing the text is easy, I used a snippet I found here:

    add_filter( 'generate_404_title','generate_custom_404_title' );
    function generate_custom_404_title()
    {
          return 'Custom Text';
    }
    
    add_filter( 'generate_404_text','generate_custom_404_text' );
    function generate_custom_404_text()
    {
          return 'Custom Text';
    }

    However, what about the actual layout? Do we just edit the 404.php file and place in child theme?

    #1382907
    David
    Staff
    Customer Support

    Hi there,

    yes the best method is to create your own 404.php template in your Child Theme.

    In GP 3.0 will be making it easier to do this without a Child Theme.

    #1383510
    Henry

    OK, thanks.

    Will GP 3.0 also allow to create templates (layouts) for archive posts and other nested content like tag archive pages?

    #1383513
    Henry

    Also – regarding the custom PHP page:

    I am trying to hide the sidebar and I thought that I would be able to

    So, at the bottom of the script (404 template) there is this line which if I comment out removes the sidebar – just want to make sure that that’s the best approach to remove the sidebar?

    	<?php
    	/**
    	 * generate_after_primary_content_area hook.
    	 *
    	 * @since 2.0
    	 */
    	do_action( 'generate_after_primary_content_area' );
    
    	generate_construct_sidebars();
    
    get_footer();

    //generate_construct_sidebars();

    I tried it and it works (i.e. removes sidebar) but want to make sure I did it correctly – thanks

    #1383557
    Leo
    Staff
    Customer Support

    Will GP 3.0 also allow to create templates (layouts) for archive posts and other nested content like tag archive pages?

    Not yet but it’s in the plan.

    And the sidebar removal should work. The other option is to use a layout element.

    #1387623
    Henry

    Thanks – yes of course, much easier > elements > layout > 404 display….

    #1388391
    Leo
    Staff
    Customer Support

    No problem 🙂

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