How to code for dynamic title and description?

First take a look at the code:

<title><?php echo getMetaTitle(); ?></title>

HTML form field

 <div class="form-group">
        <label for="post_meta_title">SEO Meta Title</label>
        <span class="countdown">
            <span id="content-metatitle" title="64">64</span>
            characters left
        <input type="text" class="form-control-meta-title" name="post_meta_title" id="content">
function env($key, $default = '')
    return getenv($key) ?: $default;

function setMetaTitle($post_meta_title)
    putenv("post_meta_title = $post_meta_title");

function getMetaTitle()
    return env('post_meta_title', POST_META_TITLE);

|| define("POST_META_TITLE", "This is my default title in case I skipped the custom title");

Right now, I can’t able to connect above code with the html input form, so I can add my meta title over there.

I’m making a blog, so in every post, there should be a separate meta title, I want like when the user write its own meta title in html form field, this will update his particular post with the meta title for search engine.

Please help

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.