Support » Fixing WordPress » Can I use PHP in a page to change title, description and keywords

  • Resolved Phacelia

    (@phacelia)


    I have the Exec PHP plugin and am running a PHP script inside pages to let users lookup things in a database (not the WP database). The user enters a search string and gets a list which comes out of the database.
    Would it be possible to then (on the fly) also change the <title> <description> and <keywords> of the result page, so that it reflects the content of the page? For example if the user searches with the word “fish”, then the <title> of the page should become something like “Search results for: Fish”, and the word “fish” should of course be in the list of keywords.

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

    (@phacelia)

    Was it a stupid question? or does nobody have an answer?

    jnhghy

    (@jnhghy)

    Hi Phacelia,
    The question is not stupid but if you use a plugin then in most cases at witch I can think at this point you’ll get the result only after the header was rendered so to change the page title you’ll probably have to use some extra html and javascript to change the title.
    Javascript/jquery can change the title of a page after it was randerd some info here.
    Regards

    Phacelia

    (@phacelia)

    Thanks, I will try that solution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can I use PHP in a page to change title, description and keywords’ is closed to new replies.