WordPress.org

Forums

Customizr
[resolved] Remove title on Custom Page (7 posts)

  1. mikeill
    Member
    Posted 1 year ago #

    I had been just commenting out the Title on a custom page (child theme -> album-gallery-page.php), but didn't work after upgrading to the new theme.

    Can I filter it out something like this:

    /*Remove Album Gallery Title*/
    add_filter('wp_title', 'set_page_title');
    function set_page_title($title) {
      if (is_page_template('album-gallery-page.php')) {}
      else
         return $title;
    }
  2. d4z_c0nf
    Member
    Posted 1 year ago #

    https://codex.wordpress.org/Function_Reference/wp_title
    You want to remove the title.. that one you see on the browser bar?

  3. mikeill
    Member
    Posted 1 year ago #

    No the one displayed on the page. The entry header?

  4. d4z_c0nf
    Member
    Posted 1 year ago #

    So wrong filter.
    In this custom template you have something like that: right?

    <?php
    /*
    Template Name: gallery
    */
    ?>
    <?php do_action( '__before_main_wrapper' ); ##hook of the header with get_header ?>

    make it become that:

    <?php
    /*
    Template Name: gallery
    */
    ?>
    <?php
    remove_action('__before_content',array(TC_headings::$instance, 'tc_content_headings'));
    ?>
    <?php do_action( '__before_main_wrapper' ); ##hook of the header with get_header ?>

    Hope it helps.

  5. mikeill
    Member
    Posted 1 year ago #

    Beautiful! I had just discovered that filtering out the_title as opposed to wp_title would do the trick. But your way makes much more sense because it's specific to the one page. Thank you again.

  6. d4z_c0nf
    Member
    Posted 1 year ago #

    Yeah if I have to use a custom template I prefer to put there specific hacks.
    Plus if you remove the action you will skip all the customizr logic to print it..
    (Mind marking this topic as resolved?)

  7. mikeill
    Member
    Posted 1 year ago #

    And then some.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic