Placing "Page Title" in Content Area

This topic contains 4 replies, has 3 voices, and was last updated by  Giri 7 years, 11 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #229897

    mlad20
    Expired Member
    Post count: 4

    I am trying to simply show or echo the page title in the content section of a page whereby it shows exactly what is on the browser tab (e.g. ‘Hotels in New York – ‘sitename’ ) per the meta settings. %%category%% %%in_location%% %%sep%% %%sitename%%,

    I created a very simple shortcode below and placed in my KLEO child theme functions file. It works EXCEPT it pulls up the first actual listing (and not the page title as shown in the browser tab). Any thoughts on how to accomplish this whether as a KLEO function or adding a simple “GEO shortcode”

    function myshortcode_title() {
    return get_the_title();
    }
    add_shortcode( ‘page_title’, ‘myshortcode_title’ );

    Thanks much

    #230179

    Paolo
    Site Admin
    Post count: 31206

    get_the_title will pull the title of the listings, not the meta title.

    I asked to the developers to let us know if there is an easy way to do this.

    They’ll let you know asap.

    Thanks

    #230521

    Giri
    Expired Member
    Post count: 3155

    Try like this

    
    
    
    function myshortcode_title() {
        return wp_get_document_title();
    }
    add_shortcode( 'page_title', 'myshortcode_title' );
    #230779

    mlad20
    Expired Member
    Post count: 4

    THANK YOU!!!!! Works like a charm!

    #230780

    Giri
    Expired Member
    Post count: 3155

    You are welcome 🙂

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

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket