• Is there a way to change the <title>title</title> of a page that I’m creating with this code?

    <?php
    require_once($_SERVER["DOCUMENT_ROOT"].'/wp/wp-load.php');
    get_header();
    ?>

    Thank you

Viewing 14 replies - 16 through 29 (of 29 total)
  • Thread Starter marcnyc

    (@marcnyc)

    so if I made a header template file, could I then change the title of the page that get_header() generates?
    but how would I tell the get_header() function to call MY new template file?

    I think you misunderstood my comment. I am saying to go away from the partial loading of WP and calling get_header(). Use full WP and load your external content instead.
    (If you made your own header template, you wouldn’t be calling get_header() or WP.)

    Thread Starter marcnyc

    (@marcnyc)

    sorry for misunderstanding…
    sadly it’s impossible to load external content into WP when the external content is a fully fledged out script with its own database, queries etc… at least not to my knowledge… correct me if I’m wrong but I don’t think that can be done without a full rewrite of the script…
    and if I’m right about this then I guess there is no way to change the title of the WP header that’s generated…

    I gave you three ways to do it. It’s not impossible. The iframe seems easiest.

    You could also probably get it done your way, but I have no experience with that, and it makes no sense to me to expect WP to work when it’s only partially loaded.

    Thread Starter marcnyc

    (@marcnyc)

    I’m not sure what you mean. Even if I added an iFrame to a WP page/post it still wouldn’t change the title of the page/post, in fact, since my content is in an iFrame the page that has the WP header would never even change…

    Thread Starter marcnyc

    (@marcnyc)

    Thank you for thinking of me and posting… 3 of those are old and outdated… the one that could have worked (Include Me) didn’t work (not sure why, and I’m looking into it)… but i have little hope that a plugin will be able to include an entire script that generates output on multiple pages, with search queries, URL queries ($_GET and &_POST) etc… I guess an iFrame that is dynamically resized with every page call COULD work but that wouldn’t solve the issue of changing the title to the page we are on so it defeats the purpose

    You’re missing the point again. Plugins are not just to use; they are to learn from.
    And if you are in a full-blown WP page, you can easily change the title, unlike when you only load half of WP.
    But maybe I still don’t understand what you are doing trying to make one WP page represent multiple pages of your external script.

    Thread Starter marcnyc

    (@marcnyc)

    Ok, here’s the real life scenario:
    https://www.chaindlk.com is the site i run
    it’s wordpress, except for this section:
    https://www.chaindlk.com/reviews which is a custom CMS specific to music reviews that was built custom for that site years ago (before the rest of the site migrated to WP).
    It uses $_GET URL query strings to find reviews (https://www.chaindlk.com/reviews/?id=11356) or to select categories (https://www.chaindlk.com/reviews/index.php?type=music&category=4) or to perform searches (https://www.chaindlk.com/reviews/index.php?search=test&type=music) or to select type of reviews, from music, to books etc (https://www.chaindlk.com/reviews/?type=books) – all of these type of URL-based calls would break if I included the contents of this page inside a WP page with a plugin that allows for PHP inclusion.
    And then there is the admin side of that custom script which makes heavy use of $_POST variables, which would also break if it were simply included…
    if it were as easy to include I would have used the PHP include() function and just installed a WP plugin that allows me to run PHP code.
    So unless I still don’t understand what you mean, I don’t see a way to wrap all this external code into WP

    You also didn’t say why you want to involve WP. What’s the point?
    If you want to integrate them, it looks like it is simply a plugin that generates a few rewrite rules for a specialized template.

    Thread Starter marcnyc

    (@marcnyc)

    The point is to have a unified look across all the pages of the website. Since the header and footer are generated by WP I want the same headers and footers across all pages

    Thread Starter marcnyc

    (@marcnyc)

    Good to know that what I told you a week ago is what your answer is.

    Thread Starter marcnyc

    (@marcnyc)

    I did not doubt your @joyously but a week ago I tried it and it didn’t work (not because of you, but because I’m a WP novice and I couldn’t apply the code you suggested to my example)… the code I found there worked right off the bat… I’m still not sure I understand it but it does work ??
    thank you for helping me all along

Viewing 14 replies - 16 through 29 (of 29 total)
  • The topic ‘changing title to page in get_header()’ is closed to new replies.