• Hi,
    I want to add this code to end of all posts:

    <iframe src="https://test.com/query.php?&q={QUERY}"
                        width="100%" frameborder="0"></iframe>

    And replace “QUERY” and “query” with the post title.
    I tried to add a short code to get the page title and then edited the code like this, but did not work:

    <iframe src="https://test.com/[page_title].php?&q={[page_title]}"
                        width="100%" frameborder="0"></iframe>

    Also tried this, but no success:

    <iframe src="https://test.com/<?php Echo get_the_title();?>.php?&q={<?php Echo get_the_title();?>}"
                        width="100%" frameborder="0"></iframe>
Viewing 6 replies - 16 through 21 (of 21 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Is it because you’re using a capital E? What is the error exactly?

    Thread Starter m107

    (@m107)

    No, you can try it in your wordpress in any web server.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    So there aren’t any syntax errors in that code snippet. Maybe there are in context of the file you’re using for the iFrame code. Can you copy all of the code from that file and paste it into https://pastebin.com – then link us that?

    Thread Starter m107

    (@m107)

    I dont have access to that, but it can be anything, there is no problem there, but my wordpress should pass the post title to that iframe code.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I don’t understand how you are getting server errors only when you add the iFrame code if you don’t have a syntax error

    Thread Starter m107

    (@m107)

    I think I found the problem. How can I add the code after every post tile? just in the post page(single).

Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘A code to get the page title’ is closed to new replies.