January 10, 2021 at 21:51 UTC - Views: 12 #66985cynicalParticipant
I have a database driven content site (displays humorous definitions for words).
The objective is to change the <title> and <meta name=”description”> tags based on the content the user called up (for example, if they called-up /definition/dog then the <title> tag might read <title>Definition for “dog”</title>).
How can this be accomplished in Xtreme? I don’t immediately see a good path and common hacks involve editing the functions.php file, which seems ill-advised.January 11, 2021 at 04:18 UTC - Views: 12 #66986WeaverKeymaster
That is getting pretty specialized, and will almost certainly will require custom code – either PHP or possibly as a plugin. The proper way to do custom PHP is with a child theme, where you could possibly use the wp_title filter to change the <title>. Weaver uses the default <title> automatically generated by WordPress. You could add a filter to the child functions.php file.
Creating custom code for <meta> tags would have to happen in the header.php child code. Or, there are a number of plugins that can generate custom <meta> tags in the site header. There is at least one plugin that can generate a custom <title>. But I don’t know if any of these can determine the exact context to create ‘Definition for “dog”‘ for example.
I suspect to get exactly what you want, you will need to have fairly complicated PHP code (in a child functions.php) to create the exact title you might want.January 11, 2021 at 13:39 UTC - Views: 8 #66989cynicalParticipant
Thanks. I suspected a child theme and separate functions.php was the only route, but it is good to have confirmation.
My needs are too corner-case for an enhancement request, but it would me interesting if page-level custom fields for common <head> tags could be created and allow for php script or short codes in the value parm to define the value.
- You must be logged in to reply to this topic.