• Hi guys,

    I have disabled page titles for my whole site because I cant use page titles nested in the head of the page and I dont need them in general except on one page. That is the page which holds my blog posts. develop.studiomint.at/aktuelles

    I want to add a custom function to my functions.php so the title of /aktuelles/ is just displayed above my posts and stylable with css.

    How would I achieve this. I am not even able to find out which template is responsible for the blog page/overview/archive. I also do not know to which hook location i should add this function or how the function looks in detail.

    Can someone please help me out with this task?

    A poor try of mine which isnt working obviously:

    function content_before_posts() {
    if ( is_archive ( '' ) )
        echo '<div class="before-blog"><h1>$title</h1></div>';
    };
    add_action('before_content', 'content_before_posts');

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Try to add the below code to the functions.php file of the child theme to display page title only on the archive page –

    function enable_archive_page_title( $return ) {
    
        if ( is_archive() ) {
            $return = true;
        }
        return $return;
    }
    add_filter( 'ocean_display_page_header', 'enable_archive_page_title' );
    Thread Starter RichiRich

    (@richirich)

    This code doesn’t seem to work. Also I want to add a title element outside the page header not inside it. Just a simple and clean <h1> tag placed just above the content of the blog page which I can style accordingly.

    You can try the below code –

    function prefix_add_content() {
        if ( is_singular() ) {
            // do your stuff
        }
    }
    add_action('ocean_before_page_entry','prefix_add_content');

    Have you cleared cache after adding the code for page title?

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

The topic ‘Add hook/filter on blog page’ is closed to new replies.