Home Forums Weaver Xtreme Theme Dynamic head content

Topic Resolution: Resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #66985
    cynical
    Participant

    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.

    #66986
    Weaver
    Keymaster

    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.

     

     

    #66989
    cynical
    Participant

    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.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.