[Resolved] Change page title programmatically

Home Forums Support Change page title programmatically

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1376728
    Piotr

    Hi,

    I’d like to change titles of some pages without changing metadata stored in a database but rather to create and display a page title dynamically (based on e.g. embedded custom post id, etc.). What would be the optimal way to do it in GP?

    Peter

    #1377184
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    WordPress uses the_title() function to output the title. That function has the_title filter, however WordPress uses the same filter for things like widget titles and menu item titles, so it’s nearly impossible to target the content title, unfortunately.

    Your best bet would be to disable the standard title and add your own title function into the page using Elements. That way you could conditionally load the title based on your own parameters.

    Let me know if you need more info 🙂

    #1378410
    Piotr

    Ok thanks for the hints, I will play around 🙂

    #1378578
    Tom
    Lead Developer
    Lead Developer

    Sounds good – let me know if you run into any issues 🙂

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