Removing specific page title via php

Community Forums Forums Design Tips and Tricks Removing specific page title via php

This topic is: resolved

This topic contains 4 replies, has 2 voices, and was last updated by  benjeeno 5 months, 3 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #94176

    benjeeno
    Participant
    Post count: 248

    I got this snippet from http://wpsites.net/web-design/remove-titles-specific-conditions/

    On my local dev version I set it to remove the /our-agents title from that page and instead it removes the titles from the /blog and no other page.

    Here is what I used:

    
    // Remove title from Our Agents page
    add_action( 'get_header', 'remove_titles_from_pages' );
    function remove_titles_from_pages() {
        if ( is_page(array(our-agents) ) ) {
            remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
        }
    }
    

    Here’s the same page on a live server: http://coronadoislandrealtors.com/development/our-agents/

    • This topic was modified 5 months, 3 weeks ago by  benjeeno.
    • This topic was modified 5 months, 3 weeks ago by  benjeeno.
    http://coronadoislandrealtors.com/development/our-agents/
    #94178

    genwrock
    Member
    Post count: 523

    Try this once

    // Remove title from Our Agents page
    add_action( 'get_header', 'remove_titles_from_pages' );
    function remove_titles_from_pages() {
        if ( is_page(array('our-agents') ) ) {
            remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
        }
    }

    Working as a freelancer & helping the people on forum | Chinmoy @ PWD | Please Follow Me on Twitter If I’ve helped.

    #94187

    benjeeno
    Participant
    Post count: 248

    Adding quotes around the page didn’t work.

    #94188

    genwrock
    Member
    Post count: 523

    Ok. Then try the page id in is_page() function. See the codex for more details.

    // Remove title from Our Agents page
    add_action( 'get_header', 'remove_titles_from_pages' );
    function remove_titles_from_pages() {
        if ( is_page(PLACE YOUR PAGE ID HERE) ) {
            remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
        }
    }

    Working as a freelancer & helping the people on forum | Chinmoy @ PWD | Please Follow Me on Twitter If I’ve helped.

    #94294

    benjeeno
    Participant
    Post count: 248

    thanks!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.