I need to create a function so that I can use that inside any page which is outside the WordPress regular page. I mean wp_head()
will not be placed there. I need it for a purpose.
The purpose is for AMP (ampproject.org) a page where I can't use any CSS or JavaScript. That's why I need this; I need to place a function at wp_title()
so that the Yoast title be placed there.
I need something like this:
function yoastVariableToTitle($variable){
return yoast_vaialble_to_show_title($variable);
}
To only get Title of the page/post:
There can be 2 possibility with SEO title
Case I: Admin enters
%%title%% %%page%% %%sep%% %%sitename%%
in SEO title field then the above code will return Post/Page default title.Case II: Admin enters
My Custom Title %%page%% %%sep%% %%sitename%%
in SEO title field then the above code will return My Custom Title.To get the full Meta Title of the page/post:
Hope this helps!