Site logo

[Resolved] Remove posts (archive) page title-Why doesn’t the code work?

Home Forums Support [Resolved] Remove posts (archive) page title-Why doesn’t the code work?

Home Forums Support Remove posts (archive) page title-Why doesn’t the code work?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2108935
    Yumei

    I am testing layouts for archive pages for posts and want the page title to be gone.

    I saw a code snippet in a response to someone’s question earlier on a related topic, but the snippet doesn’t work–why?
    add_action( ‘after_setup_theme’, function() {
    remove_action( ‘generate_archive_title’, ‘generate_archive_title’ );
    } );

    I also tried CSS-also no effect
    .entry-title { # as well as h2.entry-title a and .entry-title a
    display: none;
    }

    #2108983
    Fernando
    Customer Support

    Hi Yumei,

    Can you try replacing the PHP snippet you added with this one?:

    add_action( 'after_setup_theme', function() {
        remove_action( 'generate_archive_title', 'generate_archive_title' );
    } );

    It could be that the current PHP snippet you added has syntax errors. This especially occurs if the quotation marks used are curly ones instead of straight ones.

    Kindly let us know how it goes. 🙂

    #2110089
    Yumei

    Thanks, Fernando! I made an error-I was experimenting with elements and one of them has {{entry-title}} in it. Appreciate the reminder to be careful with curly quotes!

    #2110245
    Fernando
    Customer Support

    You’re welcome Yumei! Glad the issue is now resolved! Feel free to reach out any time if you’ll need assistance with anything else. 🙂

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