• Resolved Aliosha Kasin

    (@aliosha-kasin)


    How can I remove the left column from posts that contains leave a comment and post category? It takes up too much space from my single posts and is completely unnecessary.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Aliosha Kasin,

    You can remove this section using the function below. I would suggest adding it using a plugin like Code Snippets: https://ww.wp.xz.cn/plugins/code-snippets/

    add_action( 'template_redirect', 'marce_remove_storefront_entry_meta', 20 );
    
    function marce_remove_storefront_entry_meta() {
        if ( is_singular() ) {
          remove_action( 'storefront_single_post', 'storefront_post_meta', 20 );
        }
    }

    The is_singular checks to make sure it’s only a singular post or page. You would also need to add some CSS to make the entry content larger:

    .single .hentry .entry-content {
        width: 100%;
    }

    Cheers,

    Actually, hooking into the wp action would be more proper than hooking into template_redirect:

    add_action( 'wp', 'marce_remove_storefront_entry_meta', 20 );
    
    function marce_remove_storefront_entry_meta() {
        if ( is_singular() ) {
          remove_action( 'storefront_single_post', 'storefront_post_meta', 20 );
        }
    }
    Thread Starter Aliosha Kasin

    (@aliosha-kasin)

    thanks that solved it.

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

The topic ‘Removing left column from single posts’ is closed to new replies.